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 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 158 kDisableFutureOptimization = 1 << 12, | 158 kDisableFutureOptimization = 1 << 12, |
| 159 kSplittingEnabled = 1 << 13, | 159 kSplittingEnabled = 1 << 13, |
| 160 kDeoptimizationEnabled = 1 << 14, | 160 kDeoptimizationEnabled = 1 << 14, |
| 161 kSourcePositionsEnabled = 1 << 15, | 161 kSourcePositionsEnabled = 1 << 15, |
| 162 kEffectSchedulingEnabled = 1 << 16, | 162 kEffectSchedulingEnabled = 1 << 16, |
| 163 kBailoutOnUninitialized = 1 << 17, | 163 kBailoutOnUninitialized = 1 << 17, |
| 164 kOptimizeFromBytecode = 1 << 18, | 164 kOptimizeFromBytecode = 1 << 18, |
| 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> function_name, Isolate* isolate, |
| 169 Zone* zone, | |
| 169 Code::Flags code_flags = Code::ComputeFlags(Code::STUB)); | 170 Code::Flags code_flags = Code::ComputeFlags(Code::STUB)); |
| 170 virtual ~CompilationInfo(); | 171 virtual ~CompilationInfo(); |
| 171 | 172 |
| 172 ParseInfo* parse_info() const { return parse_info_; } | 173 ParseInfo* parse_info() const { return parse_info_; } |
| 173 | 174 |
| 174 // ----------------------------------------------------------- | 175 // ----------------------------------------------------------- |
| 175 // TODO(titzer): inline and delete accessors of ParseInfo | 176 // TODO(titzer): inline and delete accessors of ParseInfo |
| 176 // ----------------------------------------------------------- | 177 // ----------------------------------------------------------- |
| 177 Handle<Script> script() const; | 178 Handle<Script> script() const; |
| 178 bool is_eval() const; | 179 bool is_eval() const; |
| (...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 454 InlinedFunctionList const& inlined_functions() const { | 455 InlinedFunctionList const& inlined_functions() const { |
| 455 return inlined_functions_; | 456 return inlined_functions_; |
| 456 } | 457 } |
| 457 | 458 |
| 458 void AddInlinedFunction(Handle<SharedFunctionInfo> inlined_function) { | 459 void AddInlinedFunction(Handle<SharedFunctionInfo> inlined_function) { |
| 459 inlined_functions_.push_back(InlinedFunctionHolder(inlined_function)); | 460 inlined_functions_.push_back(InlinedFunctionHolder(inlined_function)); |
| 460 } | 461 } |
| 461 | 462 |
| 462 base::SmartArrayPointer<char> GetDebugName() const; | 463 base::SmartArrayPointer<char> GetDebugName() const; |
| 463 | 464 |
| 465 Vector<const char> GetFunctionName() const { return function_name_; } | |
|
titzer
2016/04/22 11:46:30
If this is only called internally, I would recomme
Clemens Hammacher
2016/04/22 13:47:54
OK, dropped it.
| |
| 466 | |
| 464 Code::Kind output_code_kind() const { | 467 Code::Kind output_code_kind() const { |
| 465 return Code::ExtractKindFromFlags(code_flags_); | 468 return Code::ExtractKindFromFlags(code_flags_); |
| 466 } | 469 } |
| 467 | 470 |
| 468 StackFrame::Type GetOutputStackFrameType() const; | 471 StackFrame::Type GetOutputStackFrameType() const; |
| 469 | 472 |
| 470 protected: | 473 protected: |
| 471 ParseInfo* parse_info_; | 474 ParseInfo* parse_info_; |
| 472 | 475 |
| 473 void DisableFutureOptimization() { | 476 void DisableFutureOptimization() { |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 491 private: | 494 private: |
| 492 // Compilation mode. | 495 // Compilation mode. |
| 493 // BASE is generated by the full codegen, optionally prepared for bailouts. | 496 // BASE is generated by the full codegen, optionally prepared for bailouts. |
| 494 // OPTIMIZE is optimized code generated by the Hydrogen-based backend. | 497 // OPTIMIZE is optimized code generated by the Hydrogen-based backend. |
| 495 enum Mode { | 498 enum Mode { |
| 496 BASE, | 499 BASE, |
| 497 OPTIMIZE, | 500 OPTIMIZE, |
| 498 STUB | 501 STUB |
| 499 }; | 502 }; |
| 500 | 503 |
| 501 CompilationInfo(ParseInfo* parse_info, const char* debug_name, | 504 CompilationInfo(ParseInfo* parse_info, Vector<const char> function_name, |
| 502 Code::Flags code_flags, Mode mode, Isolate* isolate, | 505 Code::Flags code_flags, Mode mode, Isolate* isolate, |
| 503 Zone* zone); | 506 Zone* zone); |
| 504 | 507 |
| 505 Isolate* isolate_; | 508 Isolate* isolate_; |
| 506 | 509 |
| 507 void SetMode(Mode mode) { | 510 void SetMode(Mode mode) { |
| 508 mode_ = mode; | 511 mode_ = mode; |
| 509 } | 512 } |
| 510 | 513 |
| 511 void SetFlag(Flag flag) { flags_ |= flag; } | 514 void SetFlag(Flag flag) { flags_ |= flag; } |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 555 // Number of parameters used for compilation of stubs that require arguments. | 558 // Number of parameters used for compilation of stubs that require arguments. |
| 556 int parameter_count_; | 559 int parameter_count_; |
| 557 | 560 |
| 558 int optimization_id_; | 561 int optimization_id_; |
| 559 | 562 |
| 560 int osr_expr_stack_height_; | 563 int osr_expr_stack_height_; |
| 561 | 564 |
| 562 // The current OSR frame for specialization or {nullptr}. | 565 // The current OSR frame for specialization or {nullptr}. |
| 563 JavaScriptFrame* osr_frame_ = nullptr; | 566 JavaScriptFrame* osr_frame_ = nullptr; |
| 564 | 567 |
| 565 const char* debug_name_; | 568 Vector<const char> function_name_; |
| 566 | 569 |
| 567 DISALLOW_COPY_AND_ASSIGN(CompilationInfo); | 570 DISALLOW_COPY_AND_ASSIGN(CompilationInfo); |
| 568 }; | 571 }; |
| 569 | 572 |
| 570 // A base class for compilation jobs intended to run concurrent to the main | 573 // A base class for compilation jobs intended to run concurrent to the main |
| 571 // thread. The job is split into three phases which are called in sequence on | 574 // thread. The job is split into three phases which are called in sequence on |
| 572 // different threads and with different limitations: | 575 // different threads and with different limitations: |
| 573 // 1) CreateGraph: Runs on main thread. No major limitations. | 576 // 1) CreateGraph: Runs on main thread. No major limitations. |
| 574 // 2) OptimizeGraph: Runs concurrently. No heap allocation or handle derefs. | 577 // 2) OptimizeGraph: Runs concurrently. No heap allocation or handle derefs. |
| 575 // 3) GenerateCode: Runs on main thread. No dependency changes. | 578 // 3) GenerateCode: Runs on main thread. No dependency changes. |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 626 MUST_USE_RESULT Status SetLastStatus(Status status) { | 629 MUST_USE_RESULT Status SetLastStatus(Status status) { |
| 627 last_status_ = status; | 630 last_status_ = status; |
| 628 return last_status_; | 631 return last_status_; |
| 629 } | 632 } |
| 630 }; | 633 }; |
| 631 | 634 |
| 632 } // namespace internal | 635 } // namespace internal |
| 633 } // namespace v8 | 636 } // namespace v8 |
| 634 | 637 |
| 635 #endif // V8_COMPILER_H_ | 638 #endif // V8_COMPILER_H_ |
| OLD | NEW |