| 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 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 kDebug = 1 << 6, | 121 kDebug = 1 << 6, |
| 122 kCompilingForDebugging = 1 << 7, | 122 kCompilingForDebugging = 1 << 7, |
| 123 kSerializing = 1 << 8, | 123 kSerializing = 1 << 8, |
| 124 kContextSpecializing = 1 << 9, | 124 kContextSpecializing = 1 << 9, |
| 125 kInliningEnabled = 1 << 10, | 125 kInliningEnabled = 1 << 10, |
| 126 kTypingEnabled = 1 << 11, | 126 kTypingEnabled = 1 << 11, |
| 127 kDisableFutureOptimization = 1 << 12, | 127 kDisableFutureOptimization = 1 << 12, |
| 128 kSplittingEnabled = 1 << 13, | 128 kSplittingEnabled = 1 << 13, |
| 129 kTypeFeedbackEnabled = 1 << 14, | 129 kTypeFeedbackEnabled = 1 << 14, |
| 130 kDeoptimizationEnabled = 1 << 15, | 130 kDeoptimizationEnabled = 1 << 15, |
| 131 kSourcePositionsEnabled = 1 << 16 | 131 kSourcePositionsEnabled = 1 << 16, |
| 132 kFirstCompile = 1 << 17, |
| 132 }; | 133 }; |
| 133 | 134 |
| 134 explicit CompilationInfo(ParseInfo* parse_info); | 135 explicit CompilationInfo(ParseInfo* parse_info); |
| 135 CompilationInfo(CodeStub* stub, Isolate* isolate, Zone* zone); | 136 CompilationInfo(CodeStub* stub, Isolate* isolate, Zone* zone); |
| 136 virtual ~CompilationInfo(); | 137 virtual ~CompilationInfo(); |
| 137 | 138 |
| 138 ParseInfo* parse_info() const { return parse_info_; } | 139 ParseInfo* parse_info() const { return parse_info_; } |
| 139 | 140 |
| 140 // ----------------------------------------------------------- | 141 // ----------------------------------------------------------- |
| 141 // TODO(titzer): inline and delete accessors of ParseInfo | 142 // TODO(titzer): inline and delete accessors of ParseInfo |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 239 bool is_inlining_enabled() const { return GetFlag(kInliningEnabled); } | 240 bool is_inlining_enabled() const { return GetFlag(kInliningEnabled); } |
| 240 | 241 |
| 241 void MarkAsTypingEnabled() { SetFlag(kTypingEnabled); } | 242 void MarkAsTypingEnabled() { SetFlag(kTypingEnabled); } |
| 242 | 243 |
| 243 bool is_typing_enabled() const { return GetFlag(kTypingEnabled); } | 244 bool is_typing_enabled() const { return GetFlag(kTypingEnabled); } |
| 244 | 245 |
| 245 void MarkAsSplittingEnabled() { SetFlag(kSplittingEnabled); } | 246 void MarkAsSplittingEnabled() { SetFlag(kSplittingEnabled); } |
| 246 | 247 |
| 247 bool is_splitting_enabled() const { return GetFlag(kSplittingEnabled); } | 248 bool is_splitting_enabled() const { return GetFlag(kSplittingEnabled); } |
| 248 | 249 |
| 250 void MarkAsFirstCompile() { SetFlag(kFirstCompile); } |
| 251 |
| 252 bool is_first_compile() const { return GetFlag(kFirstCompile); } |
| 253 |
| 249 bool IsCodePreAgingActive() const { | 254 bool IsCodePreAgingActive() const { |
| 250 return FLAG_optimize_for_size && FLAG_age_code && !will_serialize() && | 255 return FLAG_optimize_for_size && FLAG_age_code && !will_serialize() && |
| 251 !is_debug(); | 256 !is_debug(); |
| 252 } | 257 } |
| 253 | 258 |
| 254 void EnsureFeedbackVector(); | 259 void EnsureFeedbackVector(); |
| 255 Handle<TypeFeedbackVector> feedback_vector() const { | 260 Handle<TypeFeedbackVector> feedback_vector() const { |
| 256 return feedback_vector_; | 261 return feedback_vector_; |
| 257 } | 262 } |
| 258 void SetCode(Handle<Code> code) { code_ = code; } | 263 void SetCode(Handle<Code> code) { code_ = code; } |
| (...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 639 Handle<Object> source_map_url, Handle<Context> context, | 644 Handle<Object> source_map_url, Handle<Context> context, |
| 640 v8::Extension* extension, ScriptData** cached_data, | 645 v8::Extension* extension, ScriptData** cached_data, |
| 641 ScriptCompiler::CompileOptions compile_options, | 646 ScriptCompiler::CompileOptions compile_options, |
| 642 NativesFlag is_natives_code, bool is_module); | 647 NativesFlag is_natives_code, bool is_module); |
| 643 | 648 |
| 644 static Handle<SharedFunctionInfo> CompileStreamedScript(Handle<Script> script, | 649 static Handle<SharedFunctionInfo> CompileStreamedScript(Handle<Script> script, |
| 645 ParseInfo* info, | 650 ParseInfo* info, |
| 646 int source_length); | 651 int source_length); |
| 647 | 652 |
| 648 // Create a shared function info object (the code may be lazily compiled). | 653 // Create a shared function info object (the code may be lazily compiled). |
| 649 static Handle<SharedFunctionInfo> BuildFunctionInfo(FunctionLiteral* node, | 654 static Handle<SharedFunctionInfo> GetSharedFunctionInfo( |
| 650 Handle<Script> script, | 655 FunctionLiteral* node, Handle<Script> script, CompilationInfo* outer); |
| 651 CompilationInfo* outer); | |
| 652 | 656 |
| 653 enum ConcurrencyMode { NOT_CONCURRENT, CONCURRENT }; | 657 enum ConcurrencyMode { NOT_CONCURRENT, CONCURRENT }; |
| 654 | 658 |
| 655 // Generate and return optimized code or start a concurrent optimization job. | 659 // Generate and return optimized code or start a concurrent optimization job. |
| 656 // In the latter case, return the InOptimizationQueue builtin. On failure, | 660 // In the latter case, return the InOptimizationQueue builtin. On failure, |
| 657 // return the empty handle. | 661 // return the empty handle. |
| 658 MUST_USE_RESULT static MaybeHandle<Code> GetOptimizedCode( | 662 MUST_USE_RESULT static MaybeHandle<Code> GetOptimizedCode( |
| 659 Handle<JSFunction> function, | 663 Handle<JSFunction> function, |
| 660 Handle<Code> current_code, | 664 Handle<Code> current_code, |
| 661 ConcurrencyMode mode, | 665 ConcurrencyMode mode, |
| (...skipping 28 matching lines...) Expand all Loading... |
| 690 Zone zone_; | 694 Zone zone_; |
| 691 size_t info_zone_start_allocation_size_; | 695 size_t info_zone_start_allocation_size_; |
| 692 base::ElapsedTimer timer_; | 696 base::ElapsedTimer timer_; |
| 693 | 697 |
| 694 DISALLOW_COPY_AND_ASSIGN(CompilationPhase); | 698 DISALLOW_COPY_AND_ASSIGN(CompilationPhase); |
| 695 }; | 699 }; |
| 696 | 700 |
| 697 } } // namespace v8::internal | 701 } } // namespace v8::internal |
| 698 | 702 |
| 699 #endif // V8_COMPILER_H_ | 703 #endif // V8_COMPILER_H_ |
| OLD | NEW |