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.h" | 9 #include "src/ast.h" |
| 10 #include "src/bailout-reason.h" | 10 #include "src/bailout-reason.h" |
| (...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 395 } | 395 } |
| 396 JavaScriptFrame* osr_frame() const { return osr_frame_; } | 396 JavaScriptFrame* osr_frame() const { return osr_frame_; } |
| 397 void set_osr_frame(JavaScriptFrame* osr_frame) { osr_frame_ = osr_frame; } | 397 void set_osr_frame(JavaScriptFrame* osr_frame) { osr_frame_ = osr_frame; } |
| 398 | 398 |
| 399 #if DEBUG | 399 #if DEBUG |
| 400 void PrintAstForTesting(); | 400 void PrintAstForTesting(); |
| 401 #endif | 401 #endif |
| 402 | 402 |
| 403 bool has_simple_parameters(); | 403 bool has_simple_parameters(); |
| 404 | 404 |
| 405 Handle<Code> GenerateCodeStub(); | |
|
Michael Starzinger
2015/08/21 16:24:30
Pretty please, with a cherry on top, let's not put
| |
| 406 | |
| 407 typedef std::vector<Handle<SharedFunctionInfo>> InlinedFunctionList; | 405 typedef std::vector<Handle<SharedFunctionInfo>> InlinedFunctionList; |
| 408 InlinedFunctionList const& inlined_functions() const { | 406 InlinedFunctionList const& inlined_functions() const { |
| 409 return inlined_functions_; | 407 return inlined_functions_; |
| 410 } | 408 } |
| 411 void AddInlinedFunction(Handle<SharedFunctionInfo> inlined_function) { | 409 void AddInlinedFunction(Handle<SharedFunctionInfo> inlined_function) { |
| 412 inlined_functions_.push_back(inlined_function); | 410 inlined_functions_.push_back(inlined_function); |
| 413 } | 411 } |
| 414 | 412 |
| 415 protected: | 413 protected: |
| 416 ParseInfo* parse_info_; | 414 ParseInfo* parse_info_; |
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 616 // Please note this interface returns shared function infos. This means you | 614 // Please note this interface returns shared function infos. This means you |
| 617 // need to call Factory::NewFunctionFromSharedFunctionInfo before you have a | 615 // need to call Factory::NewFunctionFromSharedFunctionInfo before you have a |
| 618 // real function with a context. | 616 // real function with a context. |
| 619 | 617 |
| 620 class Compiler : public AllStatic { | 618 class Compiler : public AllStatic { |
| 621 public: | 619 public: |
| 622 MUST_USE_RESULT static MaybeHandle<Code> GetUnoptimizedCode( | 620 MUST_USE_RESULT static MaybeHandle<Code> GetUnoptimizedCode( |
| 623 Handle<JSFunction> function); | 621 Handle<JSFunction> function); |
| 624 MUST_USE_RESULT static MaybeHandle<Code> GetLazyCode( | 622 MUST_USE_RESULT static MaybeHandle<Code> GetLazyCode( |
| 625 Handle<JSFunction> function); | 623 Handle<JSFunction> function); |
| 624 MUST_USE_RESULT static MaybeHandle<Code> GetStubCode( | |
| 625 Handle<JSFunction> function, CodeStub* stub); | |
| 626 | 626 |
| 627 static bool Compile(Handle<JSFunction> function, ClearExceptionFlag flag); | |
| 627 static bool CompileDebugCode(Handle<JSFunction> function); | 628 static bool CompileDebugCode(Handle<JSFunction> function); |
| 628 static bool CompileDebugCode(Handle<SharedFunctionInfo> shared); | 629 static bool CompileDebugCode(Handle<SharedFunctionInfo> shared); |
| 630 static void CompileForLiveEdit(Handle<Script> script); | |
| 629 | 631 |
| 630 // Parser::Parse, then Compiler::Analyze. | 632 // Parser::Parse, then Compiler::Analyze. |
| 631 static bool ParseAndAnalyze(ParseInfo* info); | 633 static bool ParseAndAnalyze(ParseInfo* info); |
| 632 // Rewrite, analyze scopes, and renumber. | 634 // Rewrite, analyze scopes, and renumber. |
| 633 static bool Analyze(ParseInfo* info); | 635 static bool Analyze(ParseInfo* info); |
| 634 // Adds deoptimization support, requires ParseAndAnalyze. | 636 // Adds deoptimization support, requires ParseAndAnalyze. |
| 635 static bool EnsureDeoptimizationSupport(CompilationInfo* info); | 637 static bool EnsureDeoptimizationSupport(CompilationInfo* info); |
| 636 | 638 |
| 637 static bool EnsureCompiled(Handle<JSFunction> function, | |
| 638 ClearExceptionFlag flag); | |
| 639 | |
| 640 static void CompileForLiveEdit(Handle<Script> script); | |
| 641 | |
| 642 // Compile a String source within a context for eval. | 639 // Compile a String source within a context for eval. |
| 643 MUST_USE_RESULT static MaybeHandle<JSFunction> GetFunctionFromEval( | 640 MUST_USE_RESULT static MaybeHandle<JSFunction> GetFunctionFromEval( |
| 644 Handle<String> source, Handle<SharedFunctionInfo> outer_info, | 641 Handle<String> source, Handle<SharedFunctionInfo> outer_info, |
| 645 Handle<Context> context, LanguageMode language_mode, | 642 Handle<Context> context, LanguageMode language_mode, |
| 646 ParseRestriction restriction, int line_offset, int column_offset = 0, | 643 ParseRestriction restriction, int line_offset, int column_offset = 0, |
| 647 Handle<Object> script_name = Handle<Object>(), | 644 Handle<Object> script_name = Handle<Object>(), |
| 648 ScriptOriginOptions options = ScriptOriginOptions()); | 645 ScriptOriginOptions options = ScriptOriginOptions()); |
| 649 | 646 |
| 650 // Compile a String source within a context. | 647 // Compile a String source within a context. |
| 651 static Handle<SharedFunctionInfo> CompileScript( | 648 static Handle<SharedFunctionInfo> CompileScript( |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 699 Zone zone_; | 696 Zone zone_; |
| 700 size_t info_zone_start_allocation_size_; | 697 size_t info_zone_start_allocation_size_; |
| 701 base::ElapsedTimer timer_; | 698 base::ElapsedTimer timer_; |
| 702 | 699 |
| 703 DISALLOW_COPY_AND_ASSIGN(CompilationPhase); | 700 DISALLOW_COPY_AND_ASSIGN(CompilationPhase); |
| 704 }; | 701 }; |
| 705 | 702 |
| 706 } } // namespace v8::internal | 703 } } // namespace v8::internal |
| 707 | 704 |
| 708 #endif // V8_COMPILER_H_ | 705 #endif // V8_COMPILER_H_ |
| OLD | NEW |