| 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 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 307 bool IsStub() const { return mode_ == STUB; } | 307 bool IsStub() const { return mode_ == STUB; } |
| 308 void SetOptimizing(BailoutId osr_ast_id, Handle<Code> unoptimized) { | 308 void SetOptimizing(BailoutId osr_ast_id, Handle<Code> unoptimized) { |
| 309 DCHECK(has_shared_info()); | 309 DCHECK(has_shared_info()); |
| 310 SetMode(OPTIMIZE); | 310 SetMode(OPTIMIZE); |
| 311 osr_ast_id_ = osr_ast_id; | 311 osr_ast_id_ = osr_ast_id; |
| 312 unoptimized_code_ = unoptimized; | 312 unoptimized_code_ = unoptimized; |
| 313 optimization_id_ = isolate()->NextOptimizationId(); | 313 optimization_id_ = isolate()->NextOptimizationId(); |
| 314 set_output_code_kind(Code::OPTIMIZED_FUNCTION); | 314 set_output_code_kind(Code::OPTIMIZED_FUNCTION); |
| 315 } | 315 } |
| 316 | 316 |
| 317 void SetFunctionType(Type::FunctionType* function_type) { | |
| 318 function_type_ = function_type; | |
| 319 } | |
| 320 Type::FunctionType* function_type() const { return function_type_; } | |
| 321 | |
| 322 void SetStub(CodeStub* code_stub); | |
| 323 | |
| 324 // Deoptimization support. | 317 // Deoptimization support. |
| 325 bool HasDeoptimizationSupport() const { | 318 bool HasDeoptimizationSupport() const { |
| 326 return GetFlag(kDeoptimizationSupport); | 319 return GetFlag(kDeoptimizationSupport); |
| 327 } | 320 } |
| 328 void EnableDeoptimizationSupport() { | 321 void EnableDeoptimizationSupport() { |
| 329 DCHECK_EQ(BASE, mode_); | 322 DCHECK_EQ(BASE, mode_); |
| 330 SetFlag(kDeoptimizationSupport); | 323 SetFlag(kDeoptimizationSupport); |
| 331 } | 324 } |
| 332 bool ShouldEnsureSpaceForLazyDeopt() { return !IsStub(); } | 325 bool ShouldEnsureSpaceForLazyDeopt() { return !IsStub(); } |
| 333 | 326 |
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 518 // Number of parameters used for compilation of stubs that require arguments. | 511 // Number of parameters used for compilation of stubs that require arguments. |
| 519 int parameter_count_; | 512 int parameter_count_; |
| 520 | 513 |
| 521 int optimization_id_; | 514 int optimization_id_; |
| 522 | 515 |
| 523 int osr_expr_stack_height_; | 516 int osr_expr_stack_height_; |
| 524 | 517 |
| 525 // The current OSR frame for specialization or {nullptr}. | 518 // The current OSR frame for specialization or {nullptr}. |
| 526 JavaScriptFrame* osr_frame_ = nullptr; | 519 JavaScriptFrame* osr_frame_ = nullptr; |
| 527 | 520 |
| 528 Type::FunctionType* function_type_; | |
| 529 | |
| 530 const char* debug_name_; | 521 const char* debug_name_; |
| 531 | 522 |
| 532 DISALLOW_COPY_AND_ASSIGN(CompilationInfo); | 523 DISALLOW_COPY_AND_ASSIGN(CompilationInfo); |
| 533 }; | 524 }; |
| 534 | 525 |
| 535 | 526 |
| 536 // A wrapper around a CompilationInfo that detaches the Handles from | 527 // A wrapper around a CompilationInfo that detaches the Handles from |
| 537 // the underlying DeferredHandleScope and stores them in info_ on | 528 // the underlying DeferredHandleScope and stores them in info_ on |
| 538 // destruction. | 529 // destruction. |
| 539 class CompilationHandleScope BASE_EMBEDDED { | 530 class CompilationHandleScope BASE_EMBEDDED { |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 644 // Please note this interface returns shared function infos. This means you | 635 // Please note this interface returns shared function infos. This means you |
| 645 // need to call Factory::NewFunctionFromSharedFunctionInfo before you have a | 636 // need to call Factory::NewFunctionFromSharedFunctionInfo before you have a |
| 646 // real function with a context. | 637 // real function with a context. |
| 647 | 638 |
| 648 class Compiler : public AllStatic { | 639 class Compiler : public AllStatic { |
| 649 public: | 640 public: |
| 650 MUST_USE_RESULT static MaybeHandle<Code> GetUnoptimizedCode( | 641 MUST_USE_RESULT static MaybeHandle<Code> GetUnoptimizedCode( |
| 651 Handle<JSFunction> function); | 642 Handle<JSFunction> function); |
| 652 MUST_USE_RESULT static MaybeHandle<Code> GetLazyCode( | 643 MUST_USE_RESULT static MaybeHandle<Code> GetLazyCode( |
| 653 Handle<JSFunction> function); | 644 Handle<JSFunction> function); |
| 654 MUST_USE_RESULT static MaybeHandle<Code> GetStubCode( | |
| 655 Handle<JSFunction> function, CodeStub* stub); | |
| 656 | 645 |
| 657 static bool Compile(Handle<JSFunction> function, ClearExceptionFlag flag); | 646 static bool Compile(Handle<JSFunction> function, ClearExceptionFlag flag); |
| 658 static bool CompileDebugCode(Handle<JSFunction> function); | 647 static bool CompileDebugCode(Handle<JSFunction> function); |
| 659 static bool CompileDebugCode(Handle<SharedFunctionInfo> shared); | 648 static bool CompileDebugCode(Handle<SharedFunctionInfo> shared); |
| 660 static void CompileForLiveEdit(Handle<Script> script); | 649 static void CompileForLiveEdit(Handle<Script> script); |
| 661 | 650 |
| 662 // Parser::Parse, then Compiler::Analyze. | 651 // Parser::Parse, then Compiler::Analyze. |
| 663 static bool ParseAndAnalyze(ParseInfo* info); | 652 static bool ParseAndAnalyze(ParseInfo* info); |
| 664 // Rewrite, analyze scopes, and renumber. | 653 // Rewrite, analyze scopes, and renumber. |
| 665 static bool Analyze(ParseInfo* info); | 654 static bool Analyze(ParseInfo* info); |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 727 size_t info_zone_start_allocation_size_; | 716 size_t info_zone_start_allocation_size_; |
| 728 base::ElapsedTimer timer_; | 717 base::ElapsedTimer timer_; |
| 729 | 718 |
| 730 DISALLOW_COPY_AND_ASSIGN(CompilationPhase); | 719 DISALLOW_COPY_AND_ASSIGN(CompilationPhase); |
| 731 }; | 720 }; |
| 732 | 721 |
| 733 } // namespace internal | 722 } // namespace internal |
| 734 } // namespace v8 | 723 } // namespace v8 |
| 735 | 724 |
| 736 #endif // V8_COMPILER_H_ | 725 #endif // V8_COMPILER_H_ |
| OLD | NEW |