v8  3.25.30(node0.11.13)
V8 is Google's open source JavaScript engine
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
compiler.h
Go to the documentation of this file.
1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are
4 // met:
5 //
6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided
11 // with the distribution.
12 // * Neither the name of Google Inc. nor the names of its
13 // contributors may be used to endorse or promote products derived
14 // from this software without specific prior written permission.
15 //
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 
28 #ifndef V8_COMPILER_H_
29 #define V8_COMPILER_H_
30 
31 #include "allocation.h"
32 #include "ast.h"
33 #include "zone.h"
34 
35 namespace v8 {
36 namespace internal {
37 
38 class ScriptDataImpl;
39 class HydrogenCodeStub;
40 
41 // ParseRestriction is used to restrict the set of valid statements in a
42 // unit of compilation. Restriction violations cause a syntax error.
44  NO_PARSE_RESTRICTION, // All expressions are allowed.
45  ONLY_SINGLE_FUNCTION_LITERAL // Only a single FunctionLiteral expression.
46 };
47 
52 };
53 
54 struct OffsetRange {
55  OffsetRange(int from, int to) : from(from), to(to) {}
56  int from;
57  int to;
58 };
59 
60 // CompilationInfo encapsulates some information known at compile time. It
61 // is constructed based on the resources available at compile-time.
63  public:
65  virtual ~CompilationInfo();
66 
67  Isolate* isolate() const {
68  return isolate_;
69  }
70  Zone* zone() { return zone_; }
71  bool is_osr() const { return !osr_ast_id_.IsNone(); }
72  bool is_lazy() const { return IsLazy::decode(flags_); }
73  bool is_eval() const { return IsEval::decode(flags_); }
74  bool is_global() const { return IsGlobal::decode(flags_); }
75  StrictMode strict_mode() const { return StrictModeField::decode(flags_); }
76  bool is_in_loop() const { return IsInLoop::decode(flags_); }
77  FunctionLiteral* function() const { return function_; }
78  Scope* scope() const { return scope_; }
79  Scope* global_scope() const { return global_scope_; }
80  Handle<Code> code() const { return code_; }
81  Handle<JSFunction> closure() const { return closure_; }
82  Handle<SharedFunctionInfo> shared_info() const { return shared_info_; }
83  Handle<Script> script() const { return script_; }
84  HydrogenCodeStub* code_stub() const {return code_stub_; }
85  v8::Extension* extension() const { return extension_; }
86  ScriptDataImpl** cached_data() const { return cached_data_; }
88  return cached_data_mode_;
89  }
90  Handle<Context> context() const { return context_; }
91  BailoutId osr_ast_id() const { return osr_ast_id_; }
92  Handle<Code> unoptimized_code() const { return unoptimized_code_; }
93  int opt_count() const { return opt_count_; }
94  int num_parameters() const;
95  int num_heap_slots() const;
96  Code::Flags flags() const;
97 
98  void MarkAsEval() {
99  ASSERT(!is_lazy());
100  flags_ |= IsEval::encode(true);
101  }
102  void MarkAsGlobal() {
103  ASSERT(!is_lazy());
104  flags_ |= IsGlobal::encode(true);
105  }
106  void set_parameter_count(int parameter_count) {
107  ASSERT(IsStub());
108  parameter_count_ = parameter_count;
109  }
110 
111  void set_this_has_uses(bool has_no_uses) {
112  this_has_uses_ = has_no_uses;
113  }
114  bool this_has_uses() {
115  return this_has_uses_;
116  }
118  ASSERT(this->strict_mode() == SLOPPY || this->strict_mode() == strict_mode);
119  flags_ = StrictModeField::update(flags_, strict_mode);
120  }
121  void MarkAsInLoop() {
122  ASSERT(is_lazy());
123  flags_ |= IsInLoop::encode(true);
124  }
125  void MarkAsNative() {
126  flags_ |= IsNative::encode(true);
127  }
128 
129  bool is_native() const {
130  return IsNative::decode(flags_);
131  }
132 
133  bool is_calling() const {
135  }
136 
138  flags_ |= IsDeferredCalling::encode(true);
139  }
140 
141  bool is_deferred_calling() const {
142  return IsDeferredCalling::decode(flags_);
143  }
144 
146  flags_ |= IsNonDeferredCalling::encode(true);
147  }
148 
149  bool is_non_deferred_calling() const {
150  return IsNonDeferredCalling::decode(flags_);
151  }
152 
154  flags_ |= SavesCallerDoubles::encode(true);
155  }
156 
157  bool saves_caller_doubles() const {
158  return SavesCallerDoubles::decode(flags_);
159  }
160 
162  flags_ |= RequiresFrame::encode(true);
163  }
164 
165  bool requires_frame() const {
166  return RequiresFrame::decode(flags_);
167  }
168 
170  flags_ = ParseRestricitonField::update(flags_, restriction);
171  }
172 
174  return ParseRestricitonField::decode(flags_);
175  }
176 
177  void SetFunction(FunctionLiteral* literal) {
178  ASSERT(function_ == NULL);
179  function_ = literal;
180  }
181  // When the scope is applied, we may have deferred work to do on the function.
184  ASSERT(global_scope_ == NULL);
185  global_scope_ = global_scope;
186  }
187  void SetCode(Handle<Code> code) { code_ = code; }
189  ASSERT(!is_lazy());
190  extension_ = extension;
191  }
194  cached_data_mode_ = cached_data_mode;
195  if (cached_data_mode == NO_CACHED_DATA) {
196  cached_data_ = NULL;
197  } else {
198  ASSERT(!is_lazy());
199  cached_data_ = cached_data;
200  }
201  }
203  context_ = context;
204  }
205 
207  flags_ |= IsCompilingForDebugging::encode(true);
208  }
210  return IsCompilingForDebugging::decode(flags_);
211  }
213  SetMode(CompilationInfo::NONOPT);
214  }
215 
216  bool ShouldTrapOnDeopt() const {
217  return (FLAG_trap_on_deopt && IsOptimizing()) ||
218  (FLAG_trap_on_stub_deopt && IsStub());
219  }
220 
221  bool has_global_object() const {
222  return !closure().is_null() &&
223  (closure()->context()->global_object() != NULL);
224  }
225 
227  return has_global_object() ? closure()->context()->global_object() : NULL;
228  }
229 
230  // Accessors for the different compilation modes.
231  bool IsOptimizing() const { return mode_ == OPTIMIZE; }
232  bool IsOptimizable() const { return mode_ == BASE; }
233  bool IsStub() const { return mode_ == STUB; }
235  ASSERT(!shared_info_.is_null());
236  SetMode(OPTIMIZE);
237  osr_ast_id_ = osr_ast_id;
238  unoptimized_code_ = unoptimized;
239  optimization_id_ = isolate()->NextOptimizationId();
240  }
241  void DisableOptimization();
242 
243  // Deoptimization support.
245  return SupportsDeoptimization::decode(flags_);
246  }
249  flags_ |= SupportsDeoptimization::encode(true);
250  }
251 
252  // Determines whether or not to insert a self-optimization header.
253  bool ShouldSelfOptimize();
254 
255  void set_deferred_handles(DeferredHandles* deferred_handles) {
256  ASSERT(deferred_handles_ == NULL);
257  deferred_handles_ = deferred_handles;
258  }
259 
262  if (dependencies_[group] == NULL) {
263  dependencies_[group] = new(zone_) ZoneList<Handle<HeapObject> >(2, zone_);
264  }
265  return dependencies_[group];
266  }
267 
269 
270  void RollbackDependencies();
271 
272  void SaveHandles() {
273  SaveHandle(&closure_);
274  SaveHandle(&shared_info_);
275  SaveHandle(&context_);
276  SaveHandle(&script_);
277  SaveHandle(&unoptimized_code_);
278  }
279 
280  BailoutReason bailout_reason() const { return bailout_reason_; }
281  void set_bailout_reason(BailoutReason reason) { bailout_reason_ = reason; }
282 
283  int prologue_offset() const {
284  ASSERT_NE(Code::kPrologueOffsetNotSet, prologue_offset_);
285  return prologue_offset_;
286  }
287 
289  ASSERT_EQ(Code::kPrologueOffsetNotSet, prologue_offset_);
290  prologue_offset_ = prologue_offset;
291  }
292 
293  // Adds offset range [from, to) where fp register does not point
294  // to the current frame base. Used in CPU profiler to detect stack
295  // samples where top frame is not set up.
296  inline void AddNoFrameRange(int from, int to) {
297  if (no_frame_ranges_) no_frame_ranges_->Add(OffsetRange(from, to));
298  }
299 
301  List<OffsetRange>* result = no_frame_ranges_;
302  no_frame_ranges_ = NULL;
303  return result;
304  }
305 
307  if (object_wrapper_.is_null()) {
308  object_wrapper_ =
309  isolate()->factory()->NewForeign(reinterpret_cast<Address>(this));
310  }
311  return object_wrapper_;
312  }
313 
315  ASSERT(!OptimizingCompilerThread::IsOptimizerThread(isolate()));
316  abort_due_to_dependency_ = true;
317  }
318 
320  ASSERT(!OptimizingCompilerThread::IsOptimizerThread(isolate()));
321  return abort_due_to_dependency_;
322  }
323 
325  return osr_ast_id_ == osr_ast_id && function.is_identical_to(closure_);
326  }
327 
328  int optimization_id() const { return optimization_id_; }
329 
330  protected:
332  Zone* zone);
334  Zone* zone);
336  Isolate* isolate,
337  Zone* zone);
338 
339  private:
340  Isolate* isolate_;
341 
342  // Compilation mode.
343  // BASE is generated by the full codegen, optionally prepared for bailouts.
344  // OPTIMIZE is optimized code generated by the Hydrogen-based backend.
345  // NONOPT is generated by the full codegen and is not prepared for
346  // recompilation/bailouts. These functions are never recompiled.
347  enum Mode {
348  BASE,
349  OPTIMIZE,
350  NONOPT,
351  STUB
352  };
353 
354  void Initialize(Isolate* isolate, Mode mode, Zone* zone);
355 
356  void SetMode(Mode mode) {
357  ASSERT(isolate()->use_crankshaft());
358  mode_ = mode;
359  }
360 
361  // Flags using template class BitField<type, start, length>. All are
362  // false by default.
363  //
364  // Compilation is either eager or lazy.
365  class IsLazy: public BitField<bool, 0, 1> {};
366  // Flags that can be set for eager compilation.
367  class IsEval: public BitField<bool, 1, 1> {};
368  class IsGlobal: public BitField<bool, 2, 1> {};
369  // Flags that can be set for lazy compilation.
370  class IsInLoop: public BitField<bool, 3, 1> {};
371  // Strict mode - used in eager compilation.
372  class StrictModeField: public BitField<StrictMode, 4, 1> {};
373  // Is this a function from our natives.
374  class IsNative: public BitField<bool, 5, 1> {};
375  // Is this code being compiled with support for deoptimization..
376  class SupportsDeoptimization: public BitField<bool, 6, 1> {};
377  // If compiling for debugging produce just full code matching the
378  // initial mode setting.
379  class IsCompilingForDebugging: public BitField<bool, 7, 1> {};
380  // If the compiled code contains calls that require building a frame
381  class IsCalling: public BitField<bool, 8, 1> {};
382  // If the compiled code contains calls that require building a frame
383  class IsDeferredCalling: public BitField<bool, 9, 1> {};
384  // If the compiled code contains calls that require building a frame
385  class IsNonDeferredCalling: public BitField<bool, 10, 1> {};
386  // If the compiled code saves double caller registers that it clobbers.
387  class SavesCallerDoubles: public BitField<bool, 11, 1> {};
388  // If the set of valid statements is restricted.
389  class ParseRestricitonField: public BitField<ParseRestriction, 12, 1> {};
390  // If the function requires a frame (for unspecified reasons)
391  class RequiresFrame: public BitField<bool, 13, 1> {};
392 
393  unsigned flags_;
394 
395  // Fields filled in by the compilation pipeline.
396  // AST filled in by the parser.
397  FunctionLiteral* function_;
398  // The scope of the function literal as a convenience. Set to indicate
399  // that scopes have been analyzed.
400  Scope* scope_;
401  // The global scope provided as a convenience.
402  Scope* global_scope_;
403  // For compiled stubs, the stub object
404  HydrogenCodeStub* code_stub_;
405  // The compiled code.
406  Handle<Code> code_;
407 
408  // Possible initial inputs to the compilation process.
409  Handle<JSFunction> closure_;
410  Handle<SharedFunctionInfo> shared_info_;
411  Handle<Script> script_;
412 
413  // Fields possibly needed for eager compilation, NULL by default.
414  v8::Extension* extension_;
415  ScriptDataImpl** cached_data_;
416  CachedDataMode cached_data_mode_;
417 
418  // The context of the caller for eval code, and the global context for a
419  // global script. Will be a null handle otherwise.
420  Handle<Context> context_;
421 
422  // Compilation mode flag and whether deoptimization is allowed.
423  Mode mode_;
424  BailoutId osr_ast_id_;
425  // The unoptimized code we patched for OSR may not be the shared code
426  // afterwards, since we may need to compile it again to include deoptimization
427  // data. Keep track which code we patched.
428  Handle<Code> unoptimized_code_;
429 
430  // Flag whether compilation needs to be aborted due to dependency change.
431  bool abort_due_to_dependency_;
432 
433  // The zone from which the compilation pipeline working on this
434  // CompilationInfo allocates.
435  Zone* zone_;
436 
437  DeferredHandles* deferred_handles_;
438 
439  ZoneList<Handle<HeapObject> >* dependencies_[DependentCode::kGroupCount];
440 
441  template<typename T>
442  void SaveHandle(Handle<T> *object) {
443  if (!object->is_null()) {
444  Handle<T> handle(*(*object));
445  *object = handle;
446  }
447  }
448 
449  BailoutReason bailout_reason_;
450 
451  int prologue_offset_;
452 
453  List<OffsetRange>* no_frame_ranges_;
454 
455  // A copy of shared_info()->opt_count() to avoid handle deref
456  // during graph optimization.
457  int opt_count_;
458 
459  // Number of parameters used for compilation of stubs that require arguments.
460  int parameter_count_;
461 
462  bool this_has_uses_;
463 
464  Handle<Foreign> object_wrapper_;
465 
466  int optimization_id_;
467 
468  DISALLOW_COPY_AND_ASSIGN(CompilationInfo);
469 };
470 
471 
472 // Exactly like a CompilationInfo, except also creates and enters a
473 // Zone on construction and deallocates it on exit.
475  public:
477  : CompilationInfo(script, &zone_),
478  zone_(script->GetIsolate()) {}
480  : CompilationInfo(shared_info, &zone_),
481  zone_(shared_info->GetIsolate()) {}
483  : CompilationInfo(closure, &zone_),
484  zone_(closure->GetIsolate()) {}
486  : CompilationInfo(stub, isolate, &zone_),
487  zone_(isolate) {}
488 
489  // Virtual destructor because a CompilationInfoWithZone has to exit the
490  // zone scope and get rid of dependent maps even when the destructor is
491  // called when cast as a CompilationInfo.
494  }
495 
496  private:
497  Zone zone_;
498 };
499 
500 
501 // A wrapper around a CompilationInfo that detaches the Handles from
502 // the underlying DeferredHandleScope and stores them in info_ on
503 // destruction.
504 class CompilationHandleScope BASE_EMBEDDED {
505  public:
507  : deferred_(info->isolate()), info_(info) {}
509  info_->set_deferred_handles(deferred_.Detach());
510  }
511 
512  private:
513  DeferredHandleScope deferred_;
514  CompilationInfo* info_;
515 };
516 
517 
518 class HGraph;
519 class HOptimizedGraphBuilder;
520 class LChunk;
521 
522 // A helper class that calls the three compilation phases in
523 // Crankshaft and keeps track of its state. The three phases
524 // CreateGraph, OptimizeGraph and GenerateAndInstallCode can either
525 // fail, bail-out to the full code generator or succeed. Apart from
526 // their return value, the status of the phase last run can be checked
527 // using last_status().
529  public:
531  : info_(info),
532  graph_builder_(NULL),
533  graph_(NULL),
534  chunk_(NULL),
535  last_status_(FAILED),
536  awaiting_install_(false) { }
537 
538  enum Status {
540  };
541 
545 
546  Status last_status() const { return last_status_; }
547  CompilationInfo* info() const { return info_; }
548  Isolate* isolate() const { return info()->isolate(); }
549 
551  BailoutReason reason = kNoReason) {
552  if (reason != kNoReason) info_->set_bailout_reason(reason);
553  return SetLastStatus(BAILED_OUT);
554  }
555 
557  BailoutReason reason = kNoReason) {
558  if (reason != kNoReason) info_->set_bailout_reason(reason);
559  info_->shared_info()->DisableOptimization(info_->bailout_reason());
560  return SetLastStatus(BAILED_OUT);
561  }
562 
563  void WaitForInstall() {
564  ASSERT(info_->is_osr());
565  awaiting_install_ = true;
566  }
567 
568  bool IsWaitingForInstall() { return awaiting_install_; }
569 
570  private:
571  CompilationInfo* info_;
572  HOptimizedGraphBuilder* graph_builder_;
573  HGraph* graph_;
574  LChunk* chunk_;
575  TimeDelta time_taken_to_create_graph_;
576  TimeDelta time_taken_to_optimize_;
577  TimeDelta time_taken_to_codegen_;
578  Status last_status_;
579  bool awaiting_install_;
580 
581  MUST_USE_RESULT Status SetLastStatus(Status status) {
582  last_status_ = status;
583  return last_status_;
584  }
585  void RecordOptimizationStats();
586 
587  struct Timer {
588  Timer(OptimizedCompileJob* job, TimeDelta* location)
589  : job_(job), location_(location) {
590  ASSERT(location_ != NULL);
591  timer_.Start();
592  }
593 
594  ~Timer() {
595  *location_ += timer_.Elapsed();
596  }
597 
598  OptimizedCompileJob* job_;
599  ElapsedTimer timer_;
600  TimeDelta* location_;
601  };
602 };
603 
604 
605 // The V8 compiler
606 //
607 // General strategy: Source code is translated into an anonymous function w/o
608 // parameters which then can be executed. If the source code contains other
609 // functions, they will be compiled and allocated as part of the compilation
610 // of the source code.
611 
612 // Please note this interface returns shared function infos. This means you
613 // need to call Factory::NewFunctionFromSharedFunctionInfo before you have a
614 // real function with a context.
615 
616 class Compiler : public AllStatic {
617  public:
620  static bool EnsureCompiled(Handle<JSFunction> function,
623 
624 #ifdef ENABLE_DEBUGGER_SUPPORT
625  static void CompileForLiveEdit(Handle<Script> script);
626 #endif
627 
628  // Compile a String source within a context for eval.
630  Handle<Context> context,
631  StrictMode strict_mode,
632  ParseRestriction restriction,
633  int scope_position);
634 
635  // Compile a String source within a context.
637  Handle<String> source,
638  Handle<Object> script_name,
639  int line_offset,
640  int column_offset,
641  bool is_shared_cross_origin,
642  Handle<Context> context,
643  v8::Extension* extension,
644  ScriptDataImpl** cached_data,
645  CachedDataMode cached_data_mode,
646  NativesFlag is_natives_code);
647 
648  // Create a shared function info object (the code may be lazily compiled).
649  static Handle<SharedFunctionInfo> BuildFunctionInfo(FunctionLiteral* node,
650  Handle<Script> script);
651 
653 
654  // Generate and return optimized code or start a concurrent optimization job.
655  // In the latter case, return the InOptimizationQueue builtin. On failure,
656  // return the empty handle.
658  Handle<JSFunction> function,
659  Handle<Code> current_code,
660  ConcurrencyMode mode,
661  BailoutId osr_ast_id = BailoutId::None());
662 
663  // Generate and return code from previously queued optimization job.
664  // On failure, return the empty handle.
666 
670 };
671 
672 
673 class CompilationPhase BASE_EMBEDDED {
674  public:
675  CompilationPhase(const char* name, CompilationInfo* info);
676  ~CompilationPhase();
677 
678  protected:
679  bool ShouldProduceTraceOutput() const;
680 
681  const char* name() const { return name_; }
682  CompilationInfo* info() const { return info_; }
683  Isolate* isolate() const { return info()->isolate(); }
684  Zone* zone() { return &zone_; }
685 
686  private:
687  const char* name_;
688  CompilationInfo* info_;
689  Zone zone_;
690  unsigned info_zone_start_allocation_size_;
691  ElapsedTimer timer_;
692 
693  DISALLOW_COPY_AND_ASSIGN(CompilationPhase);
694 };
695 
696 
697 } } // namespace v8::internal
698 
699 #endif // V8_COMPILER_H_
enable upcoming ES6 features enable harmony block scoping enable harmony enable harmony proxies enable harmony generators enable harmony numeric enable harmony string enable harmony math functions harmony_scoping harmony_symbols harmony_collections harmony_iteration harmony_strings harmony_scoping harmony_maths tracks arrays with only smi values Optimize object Array DOM strings and string pretenure call new trace pretenuring decisions of HAllocate instructions track fields with only smi values track fields with heap values track_fields track_fields Enables optimizations which favor memory size over execution speed use string slices optimization filter maximum number of GVN fix point iterations use function inlining use allocation folding eliminate write barriers targeting allocations in optimized code maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining crankshaft harvests type feedback from stub cache trace check elimination phase hydrogen tracing filter NULL
Definition: flags.cc:269
CompilationInfoWithZone(Handle< SharedFunctionInfo > shared_info)
Definition: compiler.h:479
BailoutReason bailout_reason() const
Definition: compiler.h:280
static Handle< SharedFunctionInfo > CompileScript(Handle< String > source, Handle< Object > script_name, int line_offset, int column_offset, bool is_shared_cross_origin, Handle< Context > context, v8::Extension *extension, ScriptDataImpl **cached_data, CachedDataMode cached_data_mode, NativesFlag is_natives_code)
Definition: compiler.cc:917
static Handle< Code > GetCodeForDebugging(Handle< JSFunction > function)
Definition: compiler.cc:712
void PrepareForCompilation(Scope *scope)
Definition: compiler.cc:249
void SetParseRestriction(ParseRestriction restriction)
Definition: compiler.h:169
bool HasDeoptimizationSupport() const
Definition: compiler.h:244
void SetCode(Handle< Code > code)
Definition: compiler.h:187
static Handle< Code > GetUnoptimizedCode(Handle< JSFunction > function)
Definition: compiler.cc:651
CompilationInfoWithZone(Handle< JSFunction > closure)
Definition: compiler.h:482
static Handle< JSFunction > GetFunctionFromEval(Handle< String > source, Handle< Context > context, StrictMode strict_mode, ParseRestriction restriction, int scope_position)
Definition: compiler.cc:865
Handle< Script > script() const
Definition: compiler.h:83
MUST_USE_RESULT Status AbortOptimization(BailoutReason reason=kNoReason)
Definition: compiler.h:550
bool HasSameOsrEntry(Handle< JSFunction > function, BailoutId osr_ast_id)
Definition: compiler.h:324
void set_this_has_uses(bool has_no_uses)
Definition: compiler.h:111
void set_bailout_reason(BailoutReason reason)
Definition: compiler.h:281
void SetOptimizing(BailoutId osr_ast_id, Handle< Code > unoptimized)
Definition: compiler.h:234
uint32_t Flags
Definition: objects.h:5184
Isolate * isolate() const
Definition: compiler.h:67
static bool EnsureCompiled(Handle< JSFunction > function, ClearExceptionFlag flag)
Definition: compiler.cc:687
const char * name() const
Definition: compiler.h:681
#define ASSERT(condition)
Definition: checks.h:329
void SetExtension(v8::Extension *extension)
Definition: compiler.h:188
bool IsOptimizing() const
Definition: compiler.h:231
Factory * factory()
Definition: isolate.h:995
bool IsOptimizable() const
Definition: compiler.h:232
CompilationInfoWithZone(HydrogenCodeStub *stub, Isolate *isolate)
Definition: compiler.h:485
kInstanceClassNameOffset flag
Definition: objects-inl.h:5115
static Handle< Code > GetConcurrentlyOptimizedCode(OptimizedCompileJob *job)
Definition: compiler.cc:1204
CompilationInfoWithZone(Handle< Script > script)
Definition: compiler.h:476
enable upcoming ES6 features enable harmony block scoping enable harmony enable harmony proxies enable harmony generators enable harmony numeric enable harmony string enable harmony math functions harmony_scoping harmony_symbols harmony_collections harmony_iteration harmony_strings harmony_scoping harmony_maths tracks arrays with only smi values Optimize object Array DOM strings and string pretenure call new trace pretenuring decisions of HAllocate instructions track fields with only smi values track fields with heap values track_fields track_fields Enables optimizations which favor memory size over execution speed use string slices optimization filter maximum number of GVN fix point iterations use function inlining use allocation folding eliminate write barriers targeting allocations in optimized code maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining crankshaft harvests type feedback from stub cache trace check elimination phase hydrogen tracing filter trace hydrogen to given file name trace inlining decisions trace store elimination trace all use positions trace global value numbering trace hydrogen escape analysis trace the tracking of allocation sites trace map generalization environment for every instruction deoptimize every n garbage collections put a break point before deoptimizing deoptimize uncommon cases use on stack replacement trace array bounds check elimination perform array index dehoisting use load elimination use store elimination use constant folding eliminate unreachable code number of stress runs when picking a function to watch for shared function not JSFunction itself flushes the cache of optimized code for closures on every GC functions with arguments object maximum number of escape analysis fix point iterations allow uint32 values on optimize frames if they are used only in safe operations track concurrent recompilation artificial compilation delay in ms concurrent on stack replacement do not emit check maps for constant values that have a leaf deoptimize the optimized code if the layout of the maps changes number of stack frames inspected by the profiler percentage of ICs that must have type info to allow optimization extra verbose compilation tracing generate extra emit comments in code disassembly enable use of SSE3 instructions if available enable use of CMOV instruction if available enable use of VFP3 instructions if available enable use of NEON instructions if enable use of SDIV and UDIV instructions if enable loading bit constant by means of movw movt instruction enable unaligned accesses for enable use of d16 d31 registers on ARM this requires VFP3 force all emitted branches to be in long mode(MIPS only)") DEFINE_string(expose_natives_as
v8::Extension * extension() const
Definition: compiler.h:85
BailoutId osr_ast_id() const
Definition: compiler.h:91
#define MUST_USE_RESULT
Definition: globals.h:381
CachedDataMode cached_data_mode() const
Definition: compiler.h:87
CompilationHandleScope(CompilationInfo *info)
Definition: compiler.h:506
Handle< Code > code() const
Definition: compiler.h:80
bool saves_caller_doubles() const
Definition: compiler.h:157
static Handle< Code > GetOptimizedCode(Handle< JSFunction > function, Handle< Code > current_code, ConcurrencyMode mode, BailoutId osr_ast_id=BailoutId::None())
Definition: compiler.cc:1162
Code::Flags flags() const
Definition: compiler.cc:213
bool IsNone() const
Definition: utils.h:1170
#define DISALLOW_COPY_AND_ASSIGN(TypeName)
Definition: globals.h:359
Handle< Code > unoptimized_code() const
Definition: compiler.h:92
Scope * global_scope() const
Definition: compiler.h:79
Handle< Foreign > object_wrapper()
Definition: compiler.h:306
void set_prologue_offset(int prologue_offset)
Definition: compiler.h:288
CompilationInfo * info() const
Definition: compiler.h:547
#define BASE_EMBEDDED
Definition: allocation.h:68
void set_parameter_count(int parameter_count)
Definition: compiler.h:106
Handle< JSFunction > closure() const
Definition: compiler.h:81
bool ShouldTrapOnDeopt() const
Definition: compiler.h:216
static BailoutId None()
Definition: utils.h:1164
bool is_deferred_calling() const
Definition: compiler.h:141
Isolate * isolate() const
Definition: compiler.h:683
void SetContext(Handle< Context > context)
Definition: compiler.h:202
HydrogenCodeStub * code_stub() const
Definition: compiler.h:84
Isolate * isolate() const
Definition: compiler.h:548
Handle< T > handle(T *t, Isolate *isolate)
Definition: handles.h:103
enable upcoming ES6 features enable harmony block scoping enable harmony enable harmony proxies enable harmony generators enable harmony numeric enable harmony string enable harmony math functions harmony_scoping harmony_symbols harmony_collections harmony_iteration harmony_strings harmony_scoping harmony_maths tracks arrays with only smi values Optimize object Array DOM strings and string pretenure call new trace pretenuring decisions of HAllocate instructions track fields with only smi values track fields with heap values track_fields track_fields Enables optimizations which favor memory size over execution speed use string slices optimization filter maximum number of GVN fix point iterations use function inlining use allocation folding eliminate write barriers targeting allocations in optimized code maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining crankshaft harvests type feedback from stub cache trace check elimination phase hydrogen tracing filter trace hydrogen to given file name trace inlining decisions trace store elimination trace all use positions trace global value numbering trace hydrogen escape analysis trace the tracking of allocation sites trace map generalization environment for every instruction deoptimize every n garbage collections put a break point before deoptimizing deoptimize uncommon cases use on stack replacement trace array bounds check elimination perform array index dehoisting use load elimination use store elimination use constant folding eliminate unreachable code number of stress runs when picking a function to watch for shared function info
Definition: flags.cc:317
Handle< Context > context() const
Definition: compiler.h:90
void CommitDependencies(Handle< Code > code)
Definition: compiler.cc:160
void SetStrictMode(StrictMode strict_mode)
Definition: compiler.h:117
ParseRestriction parse_restriction() const
Definition: compiler.h:173
bool requires_frame() const
Definition: compiler.h:165
Handle< SharedFunctionInfo > shared_info() const
Definition: compiler.h:82
static const int kPrologueOffsetNotSet
Definition: objects.h:5227
OptimizedCompileJob(CompilationInfo *info)
Definition: compiler.h:530
MUST_USE_RESULT Status GenerateCode()
Definition: compiler.cc:465
Handle< Foreign > NewForeign(Address addr, PretenureFlag pretenure=NOT_TENURED)
Definition: factory.cc:726
MUST_USE_RESULT Status CreateGraph()
Definition: compiler.cc:311
#define ASSERT_EQ(v1, v2)
Definition: checks.h:330
static Handle< SharedFunctionInfo > BuildFunctionInfo(FunctionLiteral *node, Handle< Script > script)
Definition: compiler.cc:996
OffsetRange(int from, int to)
Definition: compiler.h:55
CompilationInfo * info() const
Definition: compiler.h:682
#define ASSERT_NE(v1, v2)
Definition: checks.h:331
ZoneList< Handle< HeapObject > > * dependencies(DependentCode::DependencyGroup group)
Definition: compiler.h:260
GlobalObject * global_object() const
Definition: compiler.h:226
bool is_non_deferred_calling() const
Definition: compiler.h:149
bool has_global_object() const
Definition: compiler.h:221
List< OffsetRange > * ReleaseNoFrameRanges()
Definition: compiler.h:300
void SetCachedData(ScriptDataImpl **cached_data, CachedDataMode cached_data_mode)
Definition: compiler.h:192
ScriptDataImpl ** cached_data() const
Definition: compiler.h:86
int optimization_id() const
Definition: compiler.h:328
void AddNoFrameRange(int from, int to)
Definition: compiler.h:296
bool is_in_loop() const
Definition: compiler.h:76
static void RecordFunctionCompilation(Logger::LogEventsAndTags tag, CompilationInfo *info, Handle< SharedFunctionInfo > shared)
Definition: compiler.cc:1251
CompilationInfo(Handle< JSFunction > closure, Zone *zone)
Definition: compiler.cc:82
void SetGlobalScope(Scope *global_scope)
Definition: compiler.h:183
enable upcoming ES6 features enable harmony block scoping enable harmony enable harmony proxies enable harmony generators enable harmony numeric enable harmony string enable harmony math functions harmony_scoping harmony_symbols harmony_collections harmony_iteration harmony_strings harmony_scoping harmony_maths tracks arrays with only smi values Optimize object Array DOM strings and string pretenure call new trace pretenuring decisions of HAllocate instructions track fields with only smi values track fields with heap values track_fields track_fields Enables optimizations which favor memory size over execution speed use string slices optimization filter maximum number of GVN fix point iterations use function inlining use allocation folding eliminate write barriers targeting allocations in optimized code maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining crankshaft harvests type feedback from stub cache trace check elimination phase hydrogen tracing filter trace hydrogen to given file name trace inlining decisions trace store elimination trace all use positions trace global value numbering trace hydrogen escape analysis trace the tracking of allocation sites trace map generalization environment for every instruction deoptimize every n garbage collections put a break point before deoptimizing deoptimize uncommon cases use on stack replacement trace array bounds check elimination perform array index dehoisting use load elimination use store elimination use constant folding eliminate unreachable code number of stress runs when picking a function to watch for shared function not JSFunction itself flushes the cache of optimized code for closures on every GC functions with arguments object maximum number of escape analysis fix point iterations allow uint32 values on optimize frames if they are used only in safe operations track concurrent recompilation artificial compilation delay in ms concurrent on stack replacement do not emit check maps for constant values that have a leaf deoptimize the optimized code if the layout of the maps changes number of stack frames inspected by the profiler percentage of ICs that must have type info to allow optimization extra verbose compilation tracing generate extra emit comments in code disassembly enable use of SSE3 instructions if available enable use of CMOV instruction if available enable use of VFP3 instructions if available enable use of NEON instructions if enable use of SDIV and UDIV instructions if enable loading bit constant by means of movw movt instruction enable unaligned accesses for enable use of d16 d31 registers on ARM this requires VFP3 force all emitted branches to be in long expose natives in global object expose freeBuffer extension expose gc extension under the specified name expose externalize string extension number of stack frames to capture disable builtin natives files print name of functions for which code is generated use random jit cookie to mask large constants trace lazy optimization use adaptive optimizations always try to OSR functions trace optimize function deoptimization minimum length for automatic enable preparsing maximum number of optimization attempts before giving up cache prototype transitions trace debugging JSON request response trace out of bounds accesses to external arrays trace_js_array_abuse automatically set the debug break flag when debugger commands are in the queue abort by crashing maximum length of function source code printed in a stack trace max size of the new max size of the old max size of executable always perform global GCs print one trace line following each garbage collection do not print trace line after scavenger collection print statistics of the maximum memory committed for the heap in name
Definition: flags.cc:505
StrictMode strict_mode() const
Definition: compiler.h:75
void SetFunction(FunctionLiteral *literal)
Definition: compiler.h:177
int prologue_offset() const
Definition: compiler.h:283
MUST_USE_RESULT Status AbortAndDisableOptimization(BailoutReason reason=kNoReason)
Definition: compiler.h:556
MUST_USE_RESULT Status OptimizeGraph()
Definition: compiler.cc:443
void set_deferred_handles(DeferredHandles *deferred_handles)
Definition: compiler.h:255
Scope * scope() const
Definition: compiler.h:78