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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 // Please note this interface is the only part dealing with {Code} objects | 113 // Please note this interface is the only part dealing with {Code} objects |
114 // directly. Other methods are agnostic to {Code} and can use an interpreter | 114 // directly. Other methods are agnostic to {Code} and can use an interpreter |
115 // instead of generating JIT code for a function at all. | 115 // instead of generating JIT code for a function at all. |
116 | 116 |
117 // Generate and return optimized code for OSR, or empty handle on failure. | 117 // Generate and return optimized code for OSR, or empty handle on failure. |
118 MUST_USE_RESULT static MaybeHandle<Code> GetOptimizedCodeForOSR( | 118 MUST_USE_RESULT static MaybeHandle<Code> GetOptimizedCodeForOSR( |
119 Handle<JSFunction> function, BailoutId osr_ast_id, | 119 Handle<JSFunction> function, BailoutId osr_ast_id, |
120 JavaScriptFrame* osr_frame); | 120 JavaScriptFrame* osr_frame); |
121 }; | 121 }; |
122 | 122 |
123 // TODO(mstarzinger): Move this into the "crankshaft" directory. | |
124 struct InlinedFunctionInfo { | |
125 explicit InlinedFunctionInfo(int start_position) | |
126 : start_position(start_position) {} | |
127 int start_position; | |
128 }; | |
129 | |
130 | 123 |
131 // CompilationInfo encapsulates some information known at compile time. It | 124 // CompilationInfo encapsulates some information known at compile time. It |
132 // is constructed based on the resources available at compile-time. | 125 // is constructed based on the resources available at compile-time. |
133 class CompilationInfo final { | 126 class CompilationInfo final { |
134 public: | 127 public: |
135 // Various configuration flags for a compilation, as well as some properties | 128 // Various configuration flags for a compilation, as well as some properties |
136 // of the compiled code produced by a compilation. | 129 // of the compiled code produced by a compilation. |
137 enum Flag { | 130 enum Flag { |
138 kDeferredCalling = 1 << 0, | 131 kDeferredCalling = 1 << 0, |
139 kNonDeferredCalling = 1 << 1, | 132 kNonDeferredCalling = 1 << 1, |
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
379 int prologue_offset() const { | 372 int prologue_offset() const { |
380 DCHECK_NE(Code::kPrologueOffsetNotSet, prologue_offset_); | 373 DCHECK_NE(Code::kPrologueOffsetNotSet, prologue_offset_); |
381 return prologue_offset_; | 374 return prologue_offset_; |
382 } | 375 } |
383 | 376 |
384 void set_prologue_offset(int prologue_offset) { | 377 void set_prologue_offset(int prologue_offset) { |
385 DCHECK_EQ(Code::kPrologueOffsetNotSet, prologue_offset_); | 378 DCHECK_EQ(Code::kPrologueOffsetNotSet, prologue_offset_); |
386 prologue_offset_ = prologue_offset; | 379 prologue_offset_ = prologue_offset; |
387 } | 380 } |
388 | 381 |
389 std::vector<InlinedFunctionInfo>& inlined_function_infos() { | |
390 return inlined_function_infos_; | |
391 } | |
392 | |
393 CompilationDependencies* dependencies() { return &dependencies_; } | 382 CompilationDependencies* dependencies() { return &dependencies_; } |
394 | 383 |
395 int optimization_id() const { return optimization_id_; } | 384 int optimization_id() const { return optimization_id_; } |
396 | 385 |
397 int osr_expr_stack_height() { return osr_expr_stack_height_; } | 386 int osr_expr_stack_height() { return osr_expr_stack_height_; } |
398 void set_osr_expr_stack_height(int height) { | 387 void set_osr_expr_stack_height(int height) { |
399 DCHECK(height >= 0); | 388 DCHECK(height >= 0); |
400 osr_expr_stack_height_ = height; | 389 osr_expr_stack_height_ = height; |
401 } | 390 } |
402 | 391 |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
512 | 501 |
513 DeferredHandles* deferred_handles_; | 502 DeferredHandles* deferred_handles_; |
514 | 503 |
515 // Dependencies for this compilation, e.g. stable maps. | 504 // Dependencies for this compilation, e.g. stable maps. |
516 CompilationDependencies dependencies_; | 505 CompilationDependencies dependencies_; |
517 | 506 |
518 BailoutReason bailout_reason_; | 507 BailoutReason bailout_reason_; |
519 | 508 |
520 int prologue_offset_; | 509 int prologue_offset_; |
521 | 510 |
522 std::vector<InlinedFunctionInfo> inlined_function_infos_; | |
523 bool track_positions_; | 511 bool track_positions_; |
524 | 512 |
525 InlinedFunctionList inlined_functions_; | 513 InlinedFunctionList inlined_functions_; |
526 | 514 |
527 // Number of parameters used for compilation of stubs that require arguments. | 515 // Number of parameters used for compilation of stubs that require arguments. |
528 int parameter_count_; | 516 int parameter_count_; |
529 | 517 |
530 int optimization_id_; | 518 int optimization_id_; |
531 | 519 |
532 int osr_expr_stack_height_; | 520 int osr_expr_stack_height_; |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
598 MUST_USE_RESULT Status SetLastStatus(Status status) { | 586 MUST_USE_RESULT Status SetLastStatus(Status status) { |
599 last_status_ = status; | 587 last_status_ = status; |
600 return last_status_; | 588 return last_status_; |
601 } | 589 } |
602 }; | 590 }; |
603 | 591 |
604 } // namespace internal | 592 } // namespace internal |
605 } // namespace v8 | 593 } // namespace v8 |
606 | 594 |
607 #endif // V8_COMPILER_H_ | 595 #endif // V8_COMPILER_H_ |
OLD | NEW |