Chromium Code Reviews| 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 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 132 int script_id; | 132 int script_id; |
| 133 int start_position; | 133 int start_position; |
| 134 std::vector<size_t> deopt_pc_offsets; | 134 std::vector<size_t> deopt_pc_offsets; |
| 135 | 135 |
| 136 static const int kNoParentId = -1; | 136 static const int kNoParentId = -1; |
| 137 }; | 137 }; |
| 138 | 138 |
| 139 | 139 |
| 140 // CompilationInfo encapsulates some information known at compile time. It | 140 // CompilationInfo encapsulates some information known at compile time. It |
| 141 // is constructed based on the resources available at compile-time. | 141 // is constructed based on the resources available at compile-time. |
| 142 class CompilationInfo { | 142 class CompilationInfo final BASE_EMBEDDED { |
|
Benedikt Meurer
2016/04/28 10:23:02
Please don't use the BASE_EMBEDDED macro.
Michael Starzinger
2016/05/02 12:35:05
Done.
| |
| 143 public: | 143 public: |
| 144 // Various configuration flags for a compilation, as well as some properties | 144 // Various configuration flags for a compilation, as well as some properties |
| 145 // of the compiled code produced by a compilation. | 145 // of the compiled code produced by a compilation. |
| 146 enum Flag { | 146 enum Flag { |
| 147 kDeferredCalling = 1 << 0, | 147 kDeferredCalling = 1 << 0, |
| 148 kNonDeferredCalling = 1 << 1, | 148 kNonDeferredCalling = 1 << 1, |
| 149 kSavesCallerDoubles = 1 << 2, | 149 kSavesCallerDoubles = 1 << 2, |
| 150 kRequiresFrame = 1 << 3, | 150 kRequiresFrame = 1 << 3, |
| 151 kMustNotHaveEagerFrame = 1 << 4, | 151 kMustNotHaveEagerFrame = 1 << 4, |
| 152 kDeoptimizationSupport = 1 << 5, | 152 kDeoptimizationSupport = 1 << 5, |
| 153 kDebug = 1 << 6, | 153 kDebug = 1 << 6, |
| 154 kSerializing = 1 << 7, | 154 kSerializing = 1 << 7, |
| 155 kFunctionContextSpecializing = 1 << 8, | 155 kFunctionContextSpecializing = 1 << 8, |
| 156 kFrameSpecializing = 1 << 9, | 156 kFrameSpecializing = 1 << 9, |
| 157 kNativeContextSpecializing = 1 << 10, | 157 kNativeContextSpecializing = 1 << 10, |
| 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(Vector<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 ~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; |
| 179 bool is_native() const; | 179 bool is_native() const; |
| 180 bool is_module() const; | 180 bool is_module() const; |
| (...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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. |
| 570 // | 570 // |
| 571 // Each of the three phases can either fail or succeed. Apart from their return | 571 // Each of the three phases can either fail or succeed. Apart from their return |
| 572 // value, the status of the phase last run can be checked using {last_status()} | 572 // value, the status of the phase last run can be checked using {last_status()} |
| 573 // as well. When failing we distinguish between the following levels: | 573 // as well. When failing we distinguish between the following levels: |
| 574 // a) AbortOptimization: Persistent failure, disable future optimization. | 574 // a) AbortOptimization: Persistent failure, disable future optimization. |
| 575 // b) RetryOptimzation: Transient failure, try again next time. | 575 // b) RetryOptimzation: Transient failure, try again next time. |
| 576 // TODO(mstarzinger): Make CompilationInfo base embedded. | |
| 577 class CompilationJob { | 576 class CompilationJob { |
| 578 public: | 577 public: |
| 579 explicit CompilationJob(CompilationInfo* info, const char* compiler_name) | 578 explicit CompilationJob(CompilationInfo* info, const char* compiler_name) |
| 580 : info_(info), compiler_name_(compiler_name), last_status_(SUCCEEDED) {} | 579 : info_(info), compiler_name_(compiler_name), last_status_(SUCCEEDED) {} |
| 581 virtual ~CompilationJob() {} | 580 virtual ~CompilationJob() {} |
| 582 | 581 |
| 583 enum Status { FAILED, SUCCEEDED }; | 582 enum Status { FAILED, SUCCEEDED }; |
| 584 | 583 |
| 585 MUST_USE_RESULT Status CreateGraph(); | 584 MUST_USE_RESULT Status CreateGraph(); |
| 586 MUST_USE_RESULT Status OptimizeGraph(); | 585 MUST_USE_RESULT Status OptimizeGraph(); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 621 MUST_USE_RESULT Status SetLastStatus(Status status) { | 620 MUST_USE_RESULT Status SetLastStatus(Status status) { |
| 622 last_status_ = status; | 621 last_status_ = status; |
| 623 return last_status_; | 622 return last_status_; |
| 624 } | 623 } |
| 625 }; | 624 }; |
| 626 | 625 |
| 627 } // namespace internal | 626 } // namespace internal |
| 628 } // namespace v8 | 627 } // namespace v8 |
| 629 | 628 |
| 630 #endif // V8_COMPILER_H_ | 629 #endif // V8_COMPILER_H_ |
| OLD | NEW |