OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 597 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
608 // parameters which then can be executed. If the source code contains other | 608 // parameters which then can be executed. If the source code contains other |
609 // functions, they will be compiled and allocated as part of the compilation | 609 // functions, they will be compiled and allocated as part of the compilation |
610 // of the source code. | 610 // of the source code. |
611 | 611 |
612 // Please note this interface returns shared function infos. This means you | 612 // Please note this interface returns shared function infos. This means you |
613 // need to call Factory::NewFunctionFromSharedFunctionInfo before you have a | 613 // need to call Factory::NewFunctionFromSharedFunctionInfo before you have a |
614 // real function with a context. | 614 // real function with a context. |
615 | 615 |
616 class Compiler : public AllStatic { | 616 class Compiler : public AllStatic { |
617 public: | 617 public: |
618 static Handle<Code> GetUnoptimizedCode(Handle<JSFunction> function); | 618 MUST_USE_RESULT static MaybeHandle<Code> GetUnoptimizedCode( |
619 static Handle<Code> GetUnoptimizedCode(Handle<SharedFunctionInfo> shared); | 619 Handle<JSFunction> function); |
| 620 MUST_USE_RESULT static MaybeHandle<Code> GetUnoptimizedCode( |
| 621 Handle<SharedFunctionInfo> shared); |
620 static bool EnsureCompiled(Handle<JSFunction> function, | 622 static bool EnsureCompiled(Handle<JSFunction> function, |
621 ClearExceptionFlag flag); | 623 ClearExceptionFlag flag); |
622 static Handle<Code> GetCodeForDebugging(Handle<JSFunction> function); | 624 MUST_USE_RESULT static MaybeHandle<Code> GetCodeForDebugging( |
| 625 Handle<JSFunction> function); |
623 | 626 |
624 #ifdef ENABLE_DEBUGGER_SUPPORT | 627 #ifdef ENABLE_DEBUGGER_SUPPORT |
625 static void CompileForLiveEdit(Handle<Script> script); | 628 static void CompileForLiveEdit(Handle<Script> script); |
626 #endif | 629 #endif |
627 | 630 |
628 // Compile a String source within a context for eval. | 631 // Compile a String source within a context for eval. |
629 MUST_USE_RESULT static MaybeHandle<JSFunction> GetFunctionFromEval( | 632 MUST_USE_RESULT static MaybeHandle<JSFunction> GetFunctionFromEval( |
630 Handle<String> source, | 633 Handle<String> source, |
631 Handle<Context> context, | 634 Handle<Context> context, |
632 StrictMode strict_mode, | 635 StrictMode strict_mode, |
(...skipping 15 matching lines...) Expand all Loading... |
648 | 651 |
649 // Create a shared function info object (the code may be lazily compiled). | 652 // Create a shared function info object (the code may be lazily compiled). |
650 static Handle<SharedFunctionInfo> BuildFunctionInfo(FunctionLiteral* node, | 653 static Handle<SharedFunctionInfo> BuildFunctionInfo(FunctionLiteral* node, |
651 Handle<Script> script); | 654 Handle<Script> script); |
652 | 655 |
653 enum ConcurrencyMode { NOT_CONCURRENT, CONCURRENT }; | 656 enum ConcurrencyMode { NOT_CONCURRENT, CONCURRENT }; |
654 | 657 |
655 // Generate and return optimized code or start a concurrent optimization job. | 658 // Generate and return optimized code or start a concurrent optimization job. |
656 // In the latter case, return the InOptimizationQueue builtin. On failure, | 659 // In the latter case, return the InOptimizationQueue builtin. On failure, |
657 // return the empty handle. | 660 // return the empty handle. |
658 static Handle<Code> GetOptimizedCode( | 661 MUST_USE_RESULT static MaybeHandle<Code> GetOptimizedCode( |
659 Handle<JSFunction> function, | 662 Handle<JSFunction> function, |
660 Handle<Code> current_code, | 663 Handle<Code> current_code, |
661 ConcurrencyMode mode, | 664 ConcurrencyMode mode, |
662 BailoutId osr_ast_id = BailoutId::None()); | 665 BailoutId osr_ast_id = BailoutId::None()); |
663 | 666 |
664 // Generate and return code from previously queued optimization job. | 667 // Generate and return code from previously queued optimization job. |
665 // On failure, return the empty handle. | 668 // On failure, return the empty handle. |
666 static Handle<Code> GetConcurrentlyOptimizedCode(OptimizedCompileJob* job); | 669 static Handle<Code> GetConcurrentlyOptimizedCode(OptimizedCompileJob* job); |
667 | 670 |
668 static void RecordFunctionCompilation(Logger::LogEventsAndTags tag, | 671 static void RecordFunctionCompilation(Logger::LogEventsAndTags tag, |
(...skipping 22 matching lines...) Expand all Loading... |
691 unsigned info_zone_start_allocation_size_; | 694 unsigned info_zone_start_allocation_size_; |
692 ElapsedTimer timer_; | 695 ElapsedTimer timer_; |
693 | 696 |
694 DISALLOW_COPY_AND_ASSIGN(CompilationPhase); | 697 DISALLOW_COPY_AND_ASSIGN(CompilationPhase); |
695 }; | 698 }; |
696 | 699 |
697 | 700 |
698 } } // namespace v8::internal | 701 } } // namespace v8::internal |
699 | 702 |
700 #endif // V8_COMPILER_H_ | 703 #endif // V8_COMPILER_H_ |
OLD | NEW |