OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef V8_COMPILER_H_ | 5 #ifndef V8_COMPILER_H_ |
6 #define V8_COMPILER_H_ | 6 #define V8_COMPILER_H_ |
7 | 7 |
8 #include "src/allocation.h" | 8 #include "src/allocation.h" |
9 #include "src/ast/ast.h" | 9 #include "src/ast/ast.h" |
10 #include "src/bailout-reason.h" | 10 #include "src/bailout-reason.h" |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 kInliningEnabled = 1 << 11, | 158 kInliningEnabled = 1 << 11, |
159 kDisableFutureOptimization = 1 << 12, | 159 kDisableFutureOptimization = 1 << 12, |
160 kSplittingEnabled = 1 << 13, | 160 kSplittingEnabled = 1 << 13, |
161 kDeoptimizationEnabled = 1 << 14, | 161 kDeoptimizationEnabled = 1 << 14, |
162 kSourcePositionsEnabled = 1 << 15, | 162 kSourcePositionsEnabled = 1 << 15, |
163 kBailoutOnUninitialized = 1 << 16, | 163 kBailoutOnUninitialized = 1 << 16, |
164 kOptimizeFromBytecode = 1 << 17, | 164 kOptimizeFromBytecode = 1 << 17, |
165 }; | 165 }; |
166 | 166 |
167 CompilationInfo(ParseInfo* parse_info, Handle<JSFunction> closure); | 167 CompilationInfo(ParseInfo* parse_info, Handle<JSFunction> closure); |
168 CompilationInfo(const char* debug_name, Isolate* isolate, Zone* zone, | 168 CompilationInfo(Vector<const char> debug_name, Isolate* isolate, Zone* zone, |
169 Code::Flags code_flags = Code::ComputeFlags(Code::STUB)); | 169 Code::Flags code_flags = Code::ComputeFlags(Code::STUB)); |
170 virtual ~CompilationInfo(); | 170 virtual ~CompilationInfo(); |
171 | 171 |
172 ParseInfo* parse_info() const { return parse_info_; } | 172 ParseInfo* parse_info() const { return parse_info_; } |
173 | 173 |
174 // ----------------------------------------------------------- | 174 // ----------------------------------------------------------- |
175 // TODO(titzer): inline and delete accessors of ParseInfo | 175 // TODO(titzer): inline and delete accessors of ParseInfo |
176 // ----------------------------------------------------------- | 176 // ----------------------------------------------------------- |
177 Handle<Script> script() const; | 177 Handle<Script> script() const; |
178 bool is_eval() const; | 178 bool is_eval() const; |
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
485 private: | 485 private: |
486 // Compilation mode. | 486 // Compilation mode. |
487 // BASE is generated by the full codegen, optionally prepared for bailouts. | 487 // BASE is generated by the full codegen, optionally prepared for bailouts. |
488 // OPTIMIZE is optimized code generated by the Hydrogen-based backend. | 488 // OPTIMIZE is optimized code generated by the Hydrogen-based backend. |
489 enum Mode { | 489 enum Mode { |
490 BASE, | 490 BASE, |
491 OPTIMIZE, | 491 OPTIMIZE, |
492 STUB | 492 STUB |
493 }; | 493 }; |
494 | 494 |
495 CompilationInfo(ParseInfo* parse_info, const char* debug_name, | 495 CompilationInfo(ParseInfo* parse_info, Vector<const char> debug_name, |
496 Code::Flags code_flags, Mode mode, Isolate* isolate, | 496 Code::Flags code_flags, Mode mode, Isolate* isolate, |
497 Zone* zone); | 497 Zone* zone); |
498 | 498 |
499 Isolate* isolate_; | 499 Isolate* isolate_; |
500 | 500 |
501 void SetMode(Mode mode) { | 501 void SetMode(Mode mode) { |
502 mode_ = mode; | 502 mode_ = mode; |
503 } | 503 } |
504 | 504 |
505 void SetFlag(Flag flag) { flags_ |= flag; } | 505 void SetFlag(Flag flag) { flags_ |= flag; } |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
549 // Number of parameters used for compilation of stubs that require arguments. | 549 // Number of parameters used for compilation of stubs that require arguments. |
550 int parameter_count_; | 550 int parameter_count_; |
551 | 551 |
552 int optimization_id_; | 552 int optimization_id_; |
553 | 553 |
554 int osr_expr_stack_height_; | 554 int osr_expr_stack_height_; |
555 | 555 |
556 // The current OSR frame for specialization or {nullptr}. | 556 // The current OSR frame for specialization or {nullptr}. |
557 JavaScriptFrame* osr_frame_ = nullptr; | 557 JavaScriptFrame* osr_frame_ = nullptr; |
558 | 558 |
559 const char* debug_name_; | 559 Vector<const char> debug_name_; |
560 | 560 |
561 DISALLOW_COPY_AND_ASSIGN(CompilationInfo); | 561 DISALLOW_COPY_AND_ASSIGN(CompilationInfo); |
562 }; | 562 }; |
563 | 563 |
564 // A base class for compilation jobs intended to run concurrent to the main | 564 // A base class for compilation jobs intended to run concurrent to the main |
565 // thread. The job is split into three phases which are called in sequence on | 565 // thread. The job is split into three phases which are called in sequence on |
566 // different threads and with different limitations: | 566 // different threads and with different limitations: |
567 // 1) CreateGraph: Runs on main thread. No major limitations. | 567 // 1) CreateGraph: Runs on main thread. No major limitations. |
568 // 2) OptimizeGraph: Runs concurrently. No heap allocation or handle derefs. | 568 // 2) OptimizeGraph: Runs concurrently. No heap allocation or handle derefs. |
569 // 3) GenerateCode: Runs on main thread. No dependency changes. | 569 // 3) GenerateCode: Runs on main thread. No dependency changes. |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
620 MUST_USE_RESULT Status SetLastStatus(Status status) { | 620 MUST_USE_RESULT Status SetLastStatus(Status status) { |
621 last_status_ = status; | 621 last_status_ = status; |
622 return last_status_; | 622 return last_status_; |
623 } | 623 } |
624 }; | 624 }; |
625 | 625 |
626 } // namespace internal | 626 } // namespace internal |
627 } // namespace v8 | 627 } // namespace v8 |
628 | 628 |
629 #endif // V8_COMPILER_H_ | 629 #endif // V8_COMPILER_H_ |
OLD | NEW |