| 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 565 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 576 // This is the central hub for dispatching to the various compilers within V8. | 576 // This is the central hub for dispatching to the various compilers within V8. |
| 577 // Logic for which compiler to choose and how to wire compilation results into | 577 // Logic for which compiler to choose and how to wire compilation results into |
| 578 // the object heap should be kept inside this class. | 578 // the object heap should be kept inside this class. |
| 579 // | 579 // |
| 580 // General strategy: Source code is translated into an anonymous function w/o | 580 // General strategy: Source code is translated into an anonymous function w/o |
| 581 // parameters which then can be executed. If the source code contains other | 581 // parameters which then can be executed. If the source code contains other |
| 582 // functions, they might be compiled and allocated as part of the compilation | 582 // functions, they might be compiled and allocated as part of the compilation |
| 583 // of the source code or deferred for lazy compilation at a later point. | 583 // of the source code or deferred for lazy compilation at a later point. |
| 584 class Compiler : public AllStatic { | 584 class Compiler : public AllStatic { |
| 585 public: | 585 public: |
| 586 enum ClearExceptionFlag { KEEP_EXCEPTION, CLEAR_EXCEPTION }; |
| 586 enum ConcurrencyMode { NOT_CONCURRENT, CONCURRENT }; | 587 enum ConcurrencyMode { NOT_CONCURRENT, CONCURRENT }; |
| 587 | 588 |
| 588 // =========================================================================== | 589 // =========================================================================== |
| 589 // The following family of methods ensures a given function is compiled. The | 590 // The following family of methods ensures a given function is compiled. The |
| 590 // general contract is that failures will be reported by returning {false}, | 591 // general contract is that failures will be reported by returning {false}, |
| 591 // whereas successful compilation ensures the {is_compiled} predicate on the | 592 // whereas successful compilation ensures the {is_compiled} predicate on the |
| 592 // given function holds. | 593 // given function holds. |
| 593 | 594 |
| 594 static bool Compile(Handle<JSFunction> function, ClearExceptionFlag flag); | 595 static bool Compile(Handle<JSFunction> function, ClearExceptionFlag flag); |
| 595 static bool CompileOptimized(Handle<JSFunction> function, ConcurrencyMode); | 596 static bool CompileOptimized(Handle<JSFunction> function, ConcurrencyMode); |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 659 // Generate and return code from previously queued optimization job. | 660 // Generate and return code from previously queued optimization job. |
| 660 // On failure, return the empty handle. | 661 // On failure, return the empty handle. |
| 661 MUST_USE_RESULT static MaybeHandle<Code> GetConcurrentlyOptimizedCode( | 662 MUST_USE_RESULT static MaybeHandle<Code> GetConcurrentlyOptimizedCode( |
| 662 OptimizedCompileJob* job); | 663 OptimizedCompileJob* job); |
| 663 }; | 664 }; |
| 664 | 665 |
| 665 } // namespace internal | 666 } // namespace internal |
| 666 } // namespace v8 | 667 } // namespace v8 |
| 667 | 668 |
| 668 #endif // V8_COMPILER_H_ | 669 #endif // V8_COMPILER_H_ |
| OLD | NEW |