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