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