V8 Project
compiler.h
Go to the documentation of this file.
1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef V8_COMPILER_H_
6 #define V8_COMPILER_H_
7 
8 #include "src/allocation.h"
9 #include "src/ast.h"
10 #include "src/bailout-reason.h"
11 #include "src/zone.h"
12 
13 namespace v8 {
14 namespace internal {
15 
16 class AstValueFactory;
17 class HydrogenCodeStub;
18 
19 // ParseRestriction is used to restrict the set of valid statements in a
20 // unit of compilation. Restriction violations cause a syntax error.
22  NO_PARSE_RESTRICTION, // All expressions are allowed.
23  ONLY_SINGLE_FUNCTION_LITERAL // Only a single FunctionLiteral expression.
24 };
25 
26 struct OffsetRange {
27  OffsetRange(int from, int to) : from(from), to(to) {}
28  int from;
29  int to;
30 };
31 
32 
33 class ScriptData {
34  public:
35  ScriptData(const byte* data, int length);
38  }
39 
40  const byte* data() const { return data_; }
41  int length() const { return length_; }
42 
45  owns_data_ = true;
46  }
47 
50  owns_data_ = false;
51  }
52 
53  private:
54  bool owns_data_;
55  const byte* data_;
56  int length_;
57 
59 };
60 
61 // CompilationInfo encapsulates some information known at compile time. It
62 // is constructed based on the resources available at compile-time.
64  public:
65  // Various configuration flags for a compilation, as well as some properties
66  // of the compiled code produced by a compilation.
67  enum Flag {
68  kLazy = 1 << 0,
69  kEval = 1 << 1,
70  kGlobal = 1 << 2,
71  kStrictMode = 1 << 3,
72  kThisHasUses = 1 << 4,
73  kNative = 1 << 5,
74  kDeferredCalling = 1 << 6,
77  kRequiresFrame = 1 << 9,
80  kDebug = 1 << 12,
82  kParseRestriction = 1 << 14,
83  kSerializing = 1 << 15,
85  kInliningEnabled = 1 << 17,
86  kTypingEnabled = 1 << 18,
89  kToplevel = 1 << 21
90  };
91 
94  virtual ~CompilationInfo();
95 
96  Isolate* isolate() const {
97  return isolate_;
98  }
99  Zone* zone() { return zone_; }
100  bool is_osr() const { return !osr_ast_id_.IsNone(); }
101  bool is_lazy() const { return GetFlag(kLazy); }
102  bool is_eval() const { return GetFlag(kEval); }
103  bool is_global() const { return GetFlag(kGlobal); }
105  return GetFlag(kStrictMode) ? STRICT : SLOPPY;
106  }
107  FunctionLiteral* function() const { return function_; }
108  Scope* scope() const { return scope_; }
109  Scope* global_scope() const { return global_scope_; }
110  Handle<Code> code() const { return code_; }
111  Handle<JSFunction> closure() const { return closure_; }
113  Handle<Script> script() const { return script_; }
116  v8::Extension* extension() const { return extension_; }
117  ScriptData** cached_data() const { return cached_data_; }
119  return compile_options_;
120  }
122  return source_stream_;
123  }
126  }
127  Handle<Context> context() const { return context_; }
128  BailoutId osr_ast_id() const { return osr_ast_id_; }
130  int opt_count() const { return opt_count_; }
131  int num_parameters() const;
132  int num_heap_slots() const;
133  Code::Flags flags() const;
134 
135  void MarkAsEval() {
136  DCHECK(!is_lazy());
137  SetFlag(kEval);
138  }
139 
140  void MarkAsGlobal() {
141  DCHECK(!is_lazy());
142  SetFlag(kGlobal);
143  }
144 
145  void set_parameter_count(int parameter_count) {
146  DCHECK(IsStub());
147  parameter_count_ = parameter_count;
148  }
149 
150  void set_this_has_uses(bool has_no_uses) {
151  SetFlag(kThisHasUses, has_no_uses);
152  }
153 
154  bool this_has_uses() { return GetFlag(kThisHasUses); }
155 
158  }
159 
161 
162  bool is_native() const { return GetFlag(kNative); }
163 
164  bool is_calling() const {
166  }
167 
169 
170  bool is_deferred_calling() const { return GetFlag(kDeferredCalling); }
171 
173 
175 
177 
179 
181 
182  bool requires_frame() const { return GetFlag(kRequiresFrame); }
183 
185 
188  }
189 
191 
192  bool is_debug() const { return GetFlag(kDebug); }
193 
195 
196  bool will_serialize() const { return GetFlag(kSerializing); }
197 
199 
201 
203 
205 
206  bool is_inlining_enabled() const { return GetFlag(kInliningEnabled); }
207 
209 
210  bool is_typing_enabled() const { return GetFlag(kTypingEnabled); }
211 
213 
214  bool is_toplevel() const { return GetFlag(kToplevel); }
215 
216  bool IsCodePreAgingActive() const {
217  return FLAG_optimize_for_size && FLAG_age_code && !will_serialize() &&
218  !is_debug();
219  }
220 
223  }
224 
228  }
229 
230  void SetFunction(FunctionLiteral* literal) {
231  DCHECK(function_ == NULL);
232  function_ = literal;
233  }
238  }
240  return feedback_vector_;
241  }
244  DCHECK(!is_lazy());
246  }
251  cached_data_ = NULL;
252  } else {
253  DCHECK(!is_lazy());
255  }
256  }
258  context_ = context;
259  }
260 
265  }
266 
267  bool ShouldTrapOnDeopt() const {
268  return (FLAG_trap_on_deopt && IsOptimizing()) ||
269  (FLAG_trap_on_stub_deopt && IsStub());
270  }
271 
272  bool has_global_object() const {
273  return !closure().is_null() &&
274  (closure()->context()->global_object() != NULL);
275  }
276 
278  return has_global_object() ? closure()->context()->global_object() : NULL;
279  }
280 
281  // Accessors for the different compilation modes.
282  bool IsOptimizing() const { return mode_ == OPTIMIZE; }
283  bool IsOptimizable() const { return mode_ == BASE; }
284  bool IsStub() const { return mode_ == STUB; }
286  DCHECK(!shared_info_.is_null());
287  SetMode(OPTIMIZE);
289  unoptimized_code_ = unoptimized;
291  }
292 
293  // Deoptimization support.
296  }
300  }
301 
302  // Determines whether or not to insert a self-optimization header.
303  bool ShouldSelfOptimize();
304 
305  void set_deferred_handles(DeferredHandles* deferred_handles) {
307  deferred_handles_ = deferred_handles;
308  }
309 
312  if (dependencies_[group] == NULL) {
314  }
315  return dependencies_[group];
316  }
317 
319 
320  void RollbackDependencies();
321 
322  void SaveHandles() {
328  }
329 
331  if (bailout_reason_ != kNoReason) bailout_reason_ = reason;
333  }
334 
336  if (bailout_reason_ != kNoReason) bailout_reason_ = reason;
337  }
338 
340 
341  int prologue_offset() const {
343  return prologue_offset_;
344  }
345 
349  }
350 
351  // Adds offset range [from, to) where fp register does not point
352  // to the current frame base. Used in CPU profiler to detect stack
353  // samples where top frame is not set up.
354  inline void AddNoFrameRange(int from, int to) {
356  }
357 
361  return result;
362  }
363 
365  if (object_wrapper_.is_null()) {
367  isolate()->factory()->NewForeign(reinterpret_cast<Address>(this));
368  }
369  return object_wrapper_;
370  }
371 
373  DCHECK(!OptimizingCompilerThread::IsOptimizerThread(isolate()));
375  }
376 
378  DCHECK(!OptimizingCompilerThread::IsOptimizerThread(isolate()));
380  }
381 
383  return osr_ast_id_ == osr_ast_id && function.is_identical_to(closure_);
384  }
385 
386  int optimization_id() const { return optimization_id_; }
387 
390  bool owned = true) {
392  ast_value_factory_owned_ = owned;
393  }
394 
396 
397  protected:
399  Zone* zone);
401  Zone* zone);
403  Isolate* isolate,
404  Zone* zone);
407  Isolate* isolate, Zone* zone);
408 
409 
410  private:
412 
413  // Compilation mode.
414  // BASE is generated by the full codegen, optionally prepared for bailouts.
415  // OPTIMIZE is optimized code generated by the Hydrogen-based backend.
416  // NONOPT is generated by the full codegen and is not prepared for
417  // recompilation/bailouts. These functions are never recompiled.
418  enum Mode {
422  STUB
423  };
424 
426 
427  void SetMode(Mode mode) {
428  mode_ = mode;
429  }
430 
431  void SetFlag(Flag flag) { flags_ |= flag; }
432 
433  void SetFlag(Flag flag, bool value) {
434  flags_ = value ? flags_ | flag : flags_ & ~flag;
435  }
436 
437  bool GetFlag(Flag flag) const { return (flags_ & flag) != 0; }
438 
439  unsigned flags_;
440 
441  // Fields filled in by the compilation pipeline.
442  // AST filled in by the parser.
443  FunctionLiteral* function_;
444  // The scope of the function literal as a convenience. Set to indicate
445  // that scopes have been analyzed.
447  // The global scope provided as a convenience.
449  // For compiled stubs, the stub object
451  // The compiled code.
453 
454  // Possible initial inputs to the compilation process.
460 
461  // Fields possibly needed for eager compilation, NULL by default.
465 
466  // The context of the caller for eval code, and the global context for a
467  // global script. Will be a null handle otherwise.
469 
470  // Used by codegen, ultimately kept rooted by the SharedFunctionInfo.
472 
473  // Compilation mode flag and whether deoptimization is allowed.
476  // The unoptimized code we patched for OSR may not be the shared code
477  // afterwards, since we may need to compile it again to include deoptimization
478  // data. Keep track which code we patched.
480 
481  // The zone from which the compilation pipeline working on this
482  // CompilationInfo allocates.
484 
486 
488 
489  template<typename T>
490  void SaveHandle(Handle<T> *object) {
491  if (!object->is_null()) {
492  Handle<T> handle(*(*object));
493  *object = handle;
494  }
495  }
496 
498 
500 
502 
503  // A copy of shared_info()->opt_count() to avoid handle deref
504  // during graph optimization.
506 
507  // Number of parameters used for compilation of stubs that require arguments.
509 
511 
513 
517 
519 };
520 
521 
522 // Exactly like a CompilationInfo, except also creates and enters a
523 // Zone on construction and deallocates it on exit.
525  public:
528  zone_(script->GetIsolate()) {}
531  zone_(shared_info->GetIsolate()) {}
534  zone_(closure->GetIsolate()) {}
536  : CompilationInfo(stub, isolate, &zone_),
537  zone_(isolate) {}
540  Isolate* isolate)
541  : CompilationInfo(stream, encoding, isolate, &zone_), zone_(isolate) {}
542 
543  // Virtual destructor because a CompilationInfoWithZone has to exit the
544  // zone scope and get rid of dependent maps even when the destructor is
545  // called when cast as a CompilationInfo.
548  }
549 
550  private:
552 };
553 
554 
555 // A wrapper around a CompilationInfo that detaches the Handles from
556 // the underlying DeferredHandleScope and stores them in info_ on
557 // destruction.
558 class CompilationHandleScope BASE_EMBEDDED {
559  public:
561  : deferred_(info->isolate()), info_(info) {}
563  info_->set_deferred_handles(deferred_.Detach());
564  }
565 
566  private:
569 };
570 
571 
572 class HGraph;
574 class LChunk;
575 
576 // A helper class that calls the three compilation phases in
577 // Crankshaft and keeps track of its state. The three phases
578 // CreateGraph, OptimizeGraph and GenerateAndInstallCode can either
579 // fail, bail-out to the full code generator or succeed. Apart from
580 // their return value, the status of the phase last run can be checked
581 // using last_status().
583  public:
585  : info_(info),
587  graph_(NULL),
588  chunk_(NULL),
591 
592  enum Status {
594  };
595 
599 
600  Status last_status() const { return last_status_; }
601  CompilationInfo* info() const { return info_; }
602  Isolate* isolate() const { return info()->isolate(); }
603 
605  info_->RetryOptimization(reason);
606  return SetLastStatus(BAILED_OUT);
607  }
608 
610  info_->AbortOptimization(reason);
611  return SetLastStatus(BAILED_OUT);
612  }
613 
614  void WaitForInstall() {
615  DCHECK(info_->is_osr());
616  awaiting_install_ = true;
617  }
618 
620 
621  private:
624  HGraph* graph_;
627  base::TimeDelta time_taken_to_optimize_;
628  base::TimeDelta time_taken_to_codegen_;
631 
633  last_status_ = status;
634  return last_status_;
635  }
637 
638  struct Timer {
639  Timer(OptimizedCompileJob* job, base::TimeDelta* location)
640  : job_(job), location_(location) {
641  DCHECK(location_ != NULL);
642  timer_.Start();
643  }
644 
645  ~Timer() {
646  *location_ += timer_.Elapsed();
647  }
648 
650  base::ElapsedTimer timer_;
651  base::TimeDelta* location_;
652  };
653 };
654 
655 
656 // The V8 compiler
657 //
658 // General strategy: Source code is translated into an anonymous function w/o
659 // parameters which then can be executed. If the source code contains other
660 // functions, they will be compiled and allocated as part of the compilation
661 // of the source code.
662 
663 // Please note this interface returns shared function infos. This means you
664 // need to call Factory::NewFunctionFromSharedFunctionInfo before you have a
665 // real function with a context.
666 
667 class Compiler : public AllStatic {
668  public:
670  Handle<JSFunction> function);
672  Handle<JSFunction> function);
676  Handle<JSFunction> function);
677 
678  static bool EnsureCompiled(Handle<JSFunction> function,
680 
681  static bool EnsureDeoptimizationSupport(CompilationInfo* info);
682 
683  static void CompileForLiveEdit(Handle<Script> script);
684 
685  // Compile a String source within a context for eval.
687  Handle<String> source,
688  Handle<Context> context,
689  StrictMode strict_mode,
690  ParseRestriction restriction,
691  int scope_position);
692 
693  // Compile a String source within a context.
695  Handle<String> source, Handle<Object> script_name, int line_offset,
696  int column_offset, bool is_shared_cross_origin, Handle<Context> context,
697  v8::Extension* extension, ScriptData** cached_data,
698  ScriptCompiler::CompileOptions compile_options,
699  NativesFlag is_natives_code);
700 
702  int source_length);
703 
704  // Create a shared function info object (the code may be lazily compiled).
705  static Handle<SharedFunctionInfo> BuildFunctionInfo(FunctionLiteral* node,
706  Handle<Script> script,
707  CompilationInfo* outer);
708 
710 
711  // Generate and return optimized code or start a concurrent optimization job.
712  // In the latter case, return the InOptimizationQueue builtin. On failure,
713  // return the empty handle.
715  Handle<JSFunction> function,
716  Handle<Code> current_code,
718  BailoutId osr_ast_id = BailoutId::None());
719 
720  // Generate and return code from previously queued optimization job.
721  // On failure, return the empty handle.
723 
724  static bool DebuggerWantsEagerCompilation(
725  CompilationInfo* info, bool allow_lazy_without_ctx = false);
726 };
727 
728 
730  public:
731  CompilationPhase(const char* name, CompilationInfo* info);
733 
734  protected:
736 
737  const char* name() const { return name_; }
738  CompilationInfo* info() const { return info_; }
739  Isolate* isolate() const { return info()->isolate(); }
740  Zone* zone() { return &zone_; }
741 
742  private:
743  const char* name_;
744  CompilationInfo* info_;
747  base::ElapsedTimer timer_;
748 
750 };
751 
752 } } // namespace v8::internal
753 
754 #endif // V8_COMPILER_H_
#define BASE_EMBEDDED
Definition: allocation.h:45
Ignore.
Definition: v8.h:4008
For streaming incomplete script data to V8.
Definition: v8.h:1096
@ kNoCompileOptions
Definition: v8.h:1160
DISALLOW_COPY_AND_ASSIGN(CompilationPhase)
bool ShouldProduceTraceOutput() const
Isolate * isolate() const
Definition: compiler.h:739
DeferredHandleScope deferred_
Definition: compiler.h:567
CompilationInfo * info() const
Definition: compiler.h:738
CompilationHandleScope(CompilationInfo *info)
Definition: compiler.h:560
base::ElapsedTimer timer_
Definition: compiler.h:747
CompilationPhase(const char *name, CompilationInfo *info)
const char * name() const
Definition: compiler.h:737
CompilationInfo * info_
Definition: compiler.h:568
unsigned info_zone_start_allocation_size_
Definition: compiler.h:746
bool IsNone() const
Definition: utils.h:966
static BailoutId None()
Definition: utils.h:960
uint32_t Flags
Definition: objects.h:4929
static const int kPrologueOffsetNotSet
Definition: objects.h:4973
CompilationInfoWithZone(Handle< Script > script)
Definition: compiler.h:526
CompilationInfoWithZone(Handle< JSFunction > closure)
Definition: compiler.h:532
CompilationInfoWithZone(ScriptCompiler::ExternalSourceStream *stream, ScriptCompiler::StreamedSource::Encoding encoding, Isolate *isolate)
Definition: compiler.h:538
CompilationInfoWithZone(HydrogenCodeStub *stub, Isolate *isolate)
Definition: compiler.h:535
CompilationInfoWithZone(Handle< SharedFunctionInfo > shared_info)
Definition: compiler.h:529
v8::Extension * extension_
Definition: compiler.h:462
bool GetMustNotHaveEagerFrame() const
Definition: compiler.h:186
Handle< JSFunction > closure_
Definition: compiler.h:455
Handle< Foreign > object_wrapper_
Definition: compiler.h:510
bool is_context_specializing() const
Definition: compiler.h:200
AstNode::IdGen * ast_node_id_gen()
Definition: compiler.h:395
void SetCode(Handle< Code > code)
Definition: compiler.h:242
List< OffsetRange > * no_frame_ranges_
Definition: compiler.h:501
bool ShouldTrapOnDeopt() const
Definition: compiler.h:267
void AbortOptimization(BailoutReason reason)
Definition: compiler.h:330
BailoutId osr_ast_id() const
Definition: compiler.h:128
void SetMode(Mode mode)
Definition: compiler.h:427
ScriptCompiler::ExternalSourceStream * source_stream() const
Definition: compiler.h:121
GlobalObject * global_object() const
Definition: compiler.h:277
void SetCachedData(ScriptData **cached_data, ScriptCompiler::CompileOptions compile_options)
Definition: compiler.h:247
BailoutReason bailout_reason() const
Definition: compiler.h:339
bool GetFlag(Flag flag) const
Definition: compiler.h:437
ScriptCompiler::CompileOptions compile_options_
Definition: compiler.h:464
void RetryOptimization(BailoutReason reason)
Definition: compiler.h:335
ZoneList< Handle< HeapObject > > * dependencies_[DependentCode::kGroupCount]
Definition: compiler.h:487
bool is_typing_enabled() const
Definition: compiler.h:210
Handle< Script > script_
Definition: compiler.h:457
HydrogenCodeStub * code_stub() const
Definition: compiler.h:115
Handle< Code > code() const
Definition: compiler.h:110
void SetFlag(Flag flag, bool value)
Definition: compiler.h:433
ScriptCompiler::StreamedSource::Encoding source_stream_encoding() const
Definition: compiler.h:124
void PrepareForCompilation(Scope *scope)
Definition: compiler.cc:276
List< OffsetRange > * ReleaseNoFrameRanges()
Definition: compiler.h:358
ScriptCompiler::CompileOptions compile_options() const
Definition: compiler.h:118
Scope * global_scope() const
Definition: compiler.h:109
Code::Flags flags() const
Definition: compiler.cc:252
AstNode::IdGen ast_node_id_gen_
Definition: compiler.h:516
void set_prologue_offset(int prologue_offset)
Definition: compiler.h:346
ScriptData ** cached_data() const
Definition: compiler.h:117
bool has_global_object() const
Definition: compiler.h:272
BailoutReason bailout_reason_
Definition: compiler.h:497
ZoneList< Handle< HeapObject > > * dependencies(DependentCode::DependencyGroup group)
Definition: compiler.h:310
bool HasAbortedDueToDependencyChange() const
Definition: compiler.h:377
void SetExtension(v8::Extension *extension)
Definition: compiler.h:243
Handle< Script > script() const
Definition: compiler.h:113
void SetGlobalScope(Scope *global_scope)
Definition: compiler.h:235
bool is_non_deferred_calling() const
Definition: compiler.h:174
Handle< Context > context() const
Definition: compiler.h:127
ScriptCompiler::StreamedSource::Encoding source_stream_encoding_
Definition: compiler.h:459
HydrogenCodeStub * code_stub_
Definition: compiler.h:450
void AddNoFrameRange(int from, int to)
Definition: compiler.h:354
Handle< TypeFeedbackVector > feedback_vector_
Definition: compiler.h:471
bool HasDeoptimizationSupport() const
Definition: compiler.h:294
v8::Extension * extension() const
Definition: compiler.h:116
Handle< SharedFunctionInfo > shared_info_
Definition: compiler.h:456
void SetFunction(FunctionLiteral *literal)
Definition: compiler.h:230
Handle< Code > unoptimized_code() const
Definition: compiler.h:129
void SetOptimizing(BailoutId osr_ast_id, Handle< Code > unoptimized)
Definition: compiler.h:285
void SaveHandle(Handle< T > *object)
Definition: compiler.h:490
Handle< Context > context_
Definition: compiler.h:468
DeferredHandles * deferred_handles_
Definition: compiler.h:485
AstValueFactory * ast_value_factory() const
Definition: compiler.h:388
void SetStrictMode(StrictMode strict_mode)
Definition: compiler.h:156
void set_this_has_uses(bool has_no_uses)
Definition: compiler.h:150
void SetContext(Handle< Context > context)
Definition: compiler.h:257
void SetFlag(Flag flag)
Definition: compiler.h:431
Handle< Foreign > object_wrapper()
Definition: compiler.h:364
ScriptCompiler::ExternalSourceStream * source_stream_
Definition: compiler.h:458
void CommitDependencies(Handle< Code > code)
Definition: compiler.cc:199
bool HasSameOsrEntry(Handle< JSFunction > function, BailoutId osr_ast_id)
Definition: compiler.h:382
void SetAstValueFactory(AstValueFactory *ast_value_factory, bool owned=true)
Definition: compiler.h:389
ScriptData ** cached_data_
Definition: compiler.h:463
Handle< JSFunction > closure() const
Definition: compiler.h:111
StrictMode strict_mode() const
Definition: compiler.h:104
void SetParseRestriction(ParseRestriction restriction)
Definition: compiler.h:221
bool saves_caller_doubles() const
Definition: compiler.h:178
bool is_deferred_calling() const
Definition: compiler.h:170
Isolate * isolate() const
Definition: compiler.h:96
Handle< TypeFeedbackVector > feedback_vector() const
Definition: compiler.h:239
Handle< Code > unoptimized_code_
Definition: compiler.h:479
ParseRestriction parse_restriction() const
Definition: compiler.h:225
Handle< SharedFunctionInfo > shared_info() const
Definition: compiler.h:112
void Initialize(Isolate *isolate, Mode mode, Zone *zone)
Definition: compiler.cc:134
AstValueFactory * ast_value_factory_
Definition: compiler.h:514
void set_parameter_count(int parameter_count)
Definition: compiler.h:145
DISALLOW_COPY_AND_ASSIGN(CompilationInfo)
FunctionLiteral * function_
Definition: compiler.h:443
void set_deferred_handles(DeferredHandles *deferred_handles)
Definition: compiler.h:305
void set_script(Handle< Script > script)
Definition: compiler.h:114
bool IsCodePreAgingActive() const
Definition: compiler.h:216
CompilationInfo(Handle< JSFunction > closure, Zone *zone)
Definition: compiler.cc:88
bool is_inlining_enabled() const
Definition: compiler.h:206
static MUST_USE_RESULT MaybeHandle< JSFunction > GetFunctionFromEval(Handle< String > source, Handle< Context > context, StrictMode strict_mode, ParseRestriction restriction, int scope_position)
Definition: compiler.cc:1081
static Handle< SharedFunctionInfo > CompileStreamedScript(CompilationInfo *info, int source_length)
Definition: compiler.cc:1230
static bool EnsureDeoptimizationSupport(CompilationInfo *info)
Definition: compiler.cc:895
static MUST_USE_RESULT MaybeHandle< Code > GetDebugCode(Handle< JSFunction > function)
Definition: compiler.cc:934
static MUST_USE_RESULT MaybeHandle< Code > GetOptimizedCode(Handle< JSFunction > function, Handle< Code > current_code, ConcurrencyMode mode, BailoutId osr_ast_id=BailoutId::None())
Definition: compiler.cc:1307
static MUST_USE_RESULT MaybeHandle< Code > GetLazyCode(Handle< JSFunction > function)
Definition: compiler.cc:821
static bool DebuggerWantsEagerCompilation(CompilationInfo *info, bool allow_lazy_without_ctx=false)
Definition: compiler.cc:1404
static Handle< Code > GetConcurrentlyOptimizedCode(OptimizedCompileJob *job)
Definition: compiler.cc:1354
static bool EnsureCompiled(Handle< JSFunction > function, ClearExceptionFlag flag)
Definition: compiler.cc:876
static MUST_USE_RESULT MaybeHandle< Code > GetUnoptimizedCode(Handle< JSFunction > function)
Definition: compiler.cc:805
static void CompileForLiveEdit(Handle< Script > script)
Definition: compiler.cc:964
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, ScriptData **cached_data, ScriptCompiler::CompileOptions compile_options, NativesFlag is_natives_code)
Definition: compiler.cc:1134
static Handle< SharedFunctionInfo > BuildFunctionInfo(FunctionLiteral *node, Handle< Script > script, CompilationInfo *outer)
Definition: compiler.cc:1243
static const int kGroupCount
Definition: objects.h:5534
bool is_null() const
Definition: handles.h:124
Factory * factory()
Definition: isolate.h:982
MUST_USE_RESULT Status OptimizeGraph()
Definition: compiler.cc:441
MUST_USE_RESULT Status GenerateCode()
Definition: compiler.cc:468
Status AbortOptimization(BailoutReason reason)
Definition: compiler.h:609
OptimizedCompileJob(CompilationInfo *info)
Definition: compiler.h:584
HOptimizedGraphBuilder * graph_builder_
Definition: compiler.h:623
CompilationInfo * info() const
Definition: compiler.h:601
base::TimeDelta time_taken_to_create_graph_
Definition: compiler.h:626
Status RetryOptimization(BailoutReason reason)
Definition: compiler.h:604
MUST_USE_RESULT Status SetLastStatus(Status status)
Definition: compiler.h:632
base::TimeDelta time_taken_to_optimize_
Definition: compiler.h:627
MUST_USE_RESULT Status CreateGraph()
Definition: compiler.cc:325
base::TimeDelta time_taken_to_codegen_
Definition: compiler.h:628
const byte * data_
Definition: compiler.h:55
const byte * data() const
Definition: compiler.h:40
DISALLOW_COPY_AND_ASSIGN(ScriptData)
int length() const
Definition: compiler.h:41
ScriptData(const byte *data, int length)
Definition: compiler.cc:35
enable harmony numeric enable harmony object literal extensions Optimize object Array DOM strings and string trace pretenuring decisions of HAllocate instructions Enables optimizations which favor memory size over execution speed maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining trace the tracking of allocation sites deoptimize every n garbage collections perform array bounds checks elimination analyze liveness of environment slots and zap dead values flushes the cache of optimized code for closures on every GC allow uint32 values on optimize frames if they are used only in safe operations track concurrent recompilation artificial compilation delay in ms do not emit check maps for constant values that have a leaf deoptimize the optimized code if the layout of the maps changes enable context specialization in TurboFan execution budget before interrupt is triggered max percentage of megamorphic generic ICs to allow optimization enable use of SAHF instruction if enable use of VFP3 instructions if available enable use of NEON instructions if enable use of SDIV and UDIV instructions if enable use of MLS 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 enable alignment of csp to bytes on platforms which prefer the register to always be expose gc extension under the specified name show built in functions in stack traces use random jit cookie to mask large constants minimum length for automatic enable preparsing CPU profiler sampling interval in microseconds trace out of bounds accesses to external arrays default size of stack region v8 is allowed to maximum length of function source code printed in a stack trace min size of a semi the new space consists of two semi spaces print one trace line following each garbage collection do not print trace line after scavenger collection print cumulative GC statistics in only print modified registers Trace simulator debug messages Implied by trace sim abort randomize hashes to avoid predictable hash Fixed seed to use to hash property Print the time it takes to deserialize the snapshot A filename with extra code to be included in the A file to write the raw snapshot bytes to(mksnapshot only)") DEFINE_STRING(raw_context_file
enable harmony numeric enable harmony object literal extensions Optimize object Array DOM strings and string trace pretenuring decisions of HAllocate instructions Enables optimizations which favor memory size over execution speed maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining trace the tracking of allocation sites deoptimize every n garbage collections perform array bounds checks elimination analyze liveness of environment slots and zap dead values flushes the cache of optimized code for closures on every GC allow uint32 values on optimize frames if they are used only in safe operations track concurrent recompilation artificial compilation delay in ms do not emit check maps for constant values that have a leaf deoptimize the optimized code if the layout of the maps changes enable context specialization in TurboFan execution budget before interrupt is triggered max percentage of megamorphic generic ICs to allow optimization enable use of SAHF instruction if enable use of VFP3 instructions if available enable use of NEON instructions if enable use of SDIV and UDIV instructions if enable use of MLS 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 enable alignment of csp to bytes on platforms which prefer the register to always be expose gc extension under the specified name show built in functions in stack traces use random jit cookie to mask large constants minimum length for automatic enable preparsing CPU profiler sampling interval in microseconds trace out of bounds accesses to external arrays default size of stack region v8 is allowed to maximum length of function source code printed in a stack trace min size of a semi the new space consists of two semi spaces print one trace line following each garbage collection do not print trace line after scavenger collection print cumulative GC statistics in name
enable harmony numeric enable harmony object literal extensions Optimize object Array DOM strings and string trace pretenuring decisions of HAllocate instructions Enables optimizations which favor memory size over execution speed maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining trace the tracking of allocation sites deoptimize every n garbage collections perform array bounds checks elimination analyze liveness of environment slots and zap dead values flushes the cache of optimized code for closures on every GC allow uint32 values on optimize frames if they are used only in safe operations track concurrent recompilation artificial compilation delay in ms do not emit check maps for constant values that have a leaf deoptimize the optimized code if the layout of the maps changes enable context specialization in TurboFan execution budget before interrupt is triggered max percentage of megamorphic generic ICs to allow optimization enable use of SAHF instruction if enable use of VFP3 instructions if available enable use of NEON instructions if enable use of SDIV and UDIV instructions if enable use of MLS 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_BOOL(enable_always_align_csp
enable harmony numeric enable harmony object literal extensions Optimize object Array DOM strings and string trace pretenuring decisions of HAllocate instructions Enables optimizations which favor memory size over execution speed maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining trace the tracking of allocation sites deoptimize every n garbage collections perform array bounds checks elimination analyze liveness of environment slots and zap dead values flushes the cache of optimized code for closures on every GC allow uint32 values on optimize frames if they are used only in safe operations track concurrent recompilation artificial compilation delay in ms do not emit check maps for constant values that have a leaf deoptimize the optimized code if the layout of the maps changes enable context specialization in TurboFan execution budget before interrupt is triggered max percentage of megamorphic generic ICs to allow optimization enable use of SAHF instruction if enable use of VFP3 instructions if available enable use of NEON instructions if enable use of SDIV and UDIV instructions if enable use of MLS 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 enable alignment of csp to bytes on platforms which prefer the register to always be NULL
#define DCHECK_NE(v1, v2)
Definition: logging.h:207
#define DCHECK(condition)
Definition: logging.h:205
#define DCHECK_EQ(v1, v2)
Definition: logging.h:206
#define MUST_USE_RESULT
Definition: macros.h:266
void DeleteArray(T *array)
Definition: allocation.h:68
ClearExceptionFlag
Definition: globals.h:760
Handle< T > handle(T *t, Isolate *isolate)
Definition: handles.h:146
byte * Address
Definition: globals.h:101
kFeedbackVectorOffset flag
Definition: objects-inl.h:5418
@ ONLY_SINGLE_FUNCTION_LITERAL
Definition: compiler.h:23
@ NO_PARSE_RESTRICTION
Definition: compiler.h:22
Debugger support for the V8 JavaScript engine.
Definition: accessors.cc:20
OffsetRange(int from, int to)
Definition: compiler.h:27
Timer(OptimizedCompileJob *job, base::TimeDelta *location)
Definition: compiler.h:639