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.h" | 9 #include "src/ast.h" |
10 #include "src/bailout-reason.h" | 10 #include "src/bailout-reason.h" |
(...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
397 } | 397 } |
398 JavaScriptFrame* osr_frame() const { return osr_frame_; } | 398 JavaScriptFrame* osr_frame() const { return osr_frame_; } |
399 void set_osr_frame(JavaScriptFrame* osr_frame) { osr_frame_ = osr_frame; } | 399 void set_osr_frame(JavaScriptFrame* osr_frame) { osr_frame_ = osr_frame; } |
400 | 400 |
401 #if DEBUG | 401 #if DEBUG |
402 void PrintAstForTesting(); | 402 void PrintAstForTesting(); |
403 #endif | 403 #endif |
404 | 404 |
405 bool has_simple_parameters(); | 405 bool has_simple_parameters(); |
406 | 406 |
407 typedef std::vector<Handle<SharedFunctionInfo>> InlinedFunctionList; | 407 struct InlinedFunctionHolder { |
| 408 Handle<SharedFunctionInfo> shared_info; |
| 409 |
| 410 // Root that holds the unoptimized code of the inlined function alive |
| 411 // (and out of reach of code flushing) until we finish compilation. |
| 412 // Do not remove. |
| 413 Handle<Code> inlined_code_object_root; |
| 414 |
| 415 explicit InlinedFunctionHolder( |
| 416 Handle<SharedFunctionInfo> inlined_shared_info) |
| 417 : shared_info(inlined_shared_info), |
| 418 inlined_code_object_root(inlined_shared_info->code()) {} |
| 419 }; |
| 420 |
| 421 typedef std::vector<InlinedFunctionHolder> InlinedFunctionList; |
408 InlinedFunctionList const& inlined_functions() const { | 422 InlinedFunctionList const& inlined_functions() const { |
409 return inlined_functions_; | 423 return inlined_functions_; |
410 } | 424 } |
| 425 |
411 void AddInlinedFunction(Handle<SharedFunctionInfo> inlined_function) { | 426 void AddInlinedFunction(Handle<SharedFunctionInfo> inlined_function) { |
412 inlined_functions_.push_back(inlined_function); | 427 inlined_functions_.push_back(InlinedFunctionHolder(inlined_function)); |
413 } | 428 } |
414 | 429 |
415 base::SmartArrayPointer<char> GetDebugName() const; | 430 base::SmartArrayPointer<char> GetDebugName() const; |
416 | 431 |
417 Code::Kind output_code_kind() const { return output_code_kind_; } | 432 Code::Kind output_code_kind() const { return output_code_kind_; } |
418 | 433 |
419 void set_output_code_kind(Code::Kind kind) { output_code_kind_ = kind; } | 434 void set_output_code_kind(Code::Kind kind) { output_code_kind_ = kind; } |
420 | 435 |
421 protected: | 436 protected: |
422 ParseInfo* parse_info_; | 437 ParseInfo* parse_info_; |
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
714 size_t info_zone_start_allocation_size_; | 729 size_t info_zone_start_allocation_size_; |
715 base::ElapsedTimer timer_; | 730 base::ElapsedTimer timer_; |
716 | 731 |
717 DISALLOW_COPY_AND_ASSIGN(CompilationPhase); | 732 DISALLOW_COPY_AND_ASSIGN(CompilationPhase); |
718 }; | 733 }; |
719 | 734 |
720 } // namespace internal | 735 } // namespace internal |
721 } // namespace v8 | 736 } // namespace v8 |
722 | 737 |
723 #endif // V8_COMPILER_H_ | 738 #endif // V8_COMPILER_H_ |
OLD | NEW |