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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 kMustNotHaveEagerFrame = 1 << 10, | 82 kMustNotHaveEagerFrame = 1 << 10, |
83 kDeoptimizationSupport = 1 << 11, | 83 kDeoptimizationSupport = 1 << 11, |
84 kDebug = 1 << 12, | 84 kDebug = 1 << 12, |
85 kCompilingForDebugging = 1 << 13, | 85 kCompilingForDebugging = 1 << 13, |
86 kParseRestriction = 1 << 14, | 86 kParseRestriction = 1 << 14, |
87 kSerializing = 1 << 15, | 87 kSerializing = 1 << 15, |
88 kContextSpecializing = 1 << 16, | 88 kContextSpecializing = 1 << 16, |
89 kInliningEnabled = 1 << 17, | 89 kInliningEnabled = 1 << 17, |
90 kTypingEnabled = 1 << 18, | 90 kTypingEnabled = 1 << 18, |
91 kDisableFutureOptimization = 1 << 19, | 91 kDisableFutureOptimization = 1 << 19, |
92 kToplevel = 1 << 20 | 92 kModule = 1 << 20, |
| 93 kToplevel = 1 << 21 |
93 }; | 94 }; |
94 | 95 |
95 CompilationInfo(Handle<JSFunction> closure, Zone* zone); | 96 CompilationInfo(Handle<JSFunction> closure, Zone* zone); |
96 CompilationInfo(Handle<Script> script, Zone* zone); | 97 CompilationInfo(Handle<Script> script, Zone* zone); |
97 CompilationInfo(Isolate* isolate, Zone* zone); | 98 CompilationInfo(Isolate* isolate, Zone* zone); |
98 virtual ~CompilationInfo(); | 99 virtual ~CompilationInfo(); |
99 | 100 |
100 Isolate* isolate() const { | 101 Isolate* isolate() const { |
101 return isolate_; | 102 return isolate_; |
102 } | 103 } |
103 Zone* zone() { return zone_; } | 104 Zone* zone() { return zone_; } |
104 bool is_osr() const { return !osr_ast_id_.IsNone(); } | 105 bool is_osr() const { return !osr_ast_id_.IsNone(); } |
105 bool is_lazy() const { return GetFlag(kLazy); } | 106 bool is_lazy() const { return GetFlag(kLazy); } |
106 bool is_eval() const { return GetFlag(kEval); } | 107 bool is_eval() const { return GetFlag(kEval); } |
107 bool is_global() const { return GetFlag(kGlobal); } | 108 bool is_global() const { return GetFlag(kGlobal); } |
| 109 bool is_module() const { return GetFlag(kModule); } |
108 StrictMode strict_mode() const { | 110 StrictMode strict_mode() const { |
109 return GetFlag(kStrictMode) ? STRICT : SLOPPY; | 111 return GetFlag(kStrictMode) ? STRICT : SLOPPY; |
110 } | 112 } |
111 FunctionLiteral* function() const { return function_; } | 113 FunctionLiteral* function() const { return function_; } |
112 Scope* scope() const { return scope_; } | 114 Scope* scope() const { return scope_; } |
113 Scope* script_scope() const { return script_scope_; } | 115 Scope* script_scope() const { return script_scope_; } |
114 Handle<Code> code() const { return code_; } | 116 Handle<Code> code() const { return code_; } |
115 Handle<JSFunction> closure() const { return closure_; } | 117 Handle<JSFunction> closure() const { return closure_; } |
116 Handle<SharedFunctionInfo> shared_info() const { return shared_info_; } | 118 Handle<SharedFunctionInfo> shared_info() const { return shared_info_; } |
117 Handle<Script> script() const { return script_; } | 119 Handle<Script> script() const { return script_; } |
(...skipping 21 matching lines...) Expand all Loading... |
139 void MarkAsEval() { | 141 void MarkAsEval() { |
140 DCHECK(!is_lazy()); | 142 DCHECK(!is_lazy()); |
141 SetFlag(kEval); | 143 SetFlag(kEval); |
142 } | 144 } |
143 | 145 |
144 void MarkAsGlobal() { | 146 void MarkAsGlobal() { |
145 DCHECK(!is_lazy()); | 147 DCHECK(!is_lazy()); |
146 SetFlag(kGlobal); | 148 SetFlag(kGlobal); |
147 } | 149 } |
148 | 150 |
| 151 void MarkAsModule() { |
| 152 DCHECK(!is_lazy()); |
| 153 SetFlag(kModule); |
| 154 } |
| 155 |
149 void set_parameter_count(int parameter_count) { | 156 void set_parameter_count(int parameter_count) { |
150 DCHECK(IsStub()); | 157 DCHECK(IsStub()); |
151 parameter_count_ = parameter_count; | 158 parameter_count_ = parameter_count; |
152 } | 159 } |
153 | 160 |
154 void set_this_has_uses(bool has_no_uses) { | 161 void set_this_has_uses(bool has_no_uses) { |
155 SetFlag(kThisHasUses, has_no_uses); | 162 SetFlag(kThisHasUses, has_no_uses); |
156 } | 163 } |
157 | 164 |
158 bool this_has_uses() { return GetFlag(kThisHasUses); } | 165 bool this_has_uses() { return GetFlag(kThisHasUses); } |
(...skipping 590 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
749 Zone zone_; | 756 Zone zone_; |
750 unsigned info_zone_start_allocation_size_; | 757 unsigned info_zone_start_allocation_size_; |
751 base::ElapsedTimer timer_; | 758 base::ElapsedTimer timer_; |
752 | 759 |
753 DISALLOW_COPY_AND_ASSIGN(CompilationPhase); | 760 DISALLOW_COPY_AND_ASSIGN(CompilationPhase); |
754 }; | 761 }; |
755 | 762 |
756 } } // namespace v8::internal | 763 } } // namespace v8::internal |
757 | 764 |
758 #endif // V8_COMPILER_H_ | 765 #endif // V8_COMPILER_H_ |
OLD | NEW |