OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 bool is_in_loop() const { return IsInLoop::decode(flags_); } | 65 bool is_in_loop() const { return IsInLoop::decode(flags_); } |
66 FunctionLiteral* function() const { return function_; } | 66 FunctionLiteral* function() const { return function_; } |
67 Scope* scope() const { return scope_; } | 67 Scope* scope() const { return scope_; } |
68 Scope* global_scope() const { return global_scope_; } | 68 Scope* global_scope() const { return global_scope_; } |
69 Handle<Code> code() const { return code_; } | 69 Handle<Code> code() const { return code_; } |
70 Handle<JSFunction> closure() const { return closure_; } | 70 Handle<JSFunction> closure() const { return closure_; } |
71 Handle<SharedFunctionInfo> shared_info() const { return shared_info_; } | 71 Handle<SharedFunctionInfo> shared_info() const { return shared_info_; } |
72 Handle<Script> script() const { return script_; } | 72 Handle<Script> script() const { return script_; } |
73 v8::Extension* extension() const { return extension_; } | 73 v8::Extension* extension() const { return extension_; } |
74 ScriptDataImpl* pre_parse_data() const { return pre_parse_data_; } | 74 ScriptDataImpl* pre_parse_data() const { return pre_parse_data_; } |
75 Handle<Context> calling_context() const { return calling_context_; } | 75 Handle<Context> context() const { return context_; } |
76 BailoutId osr_ast_id() const { return osr_ast_id_; } | 76 BailoutId osr_ast_id() const { return osr_ast_id_; } |
77 | 77 |
78 void MarkAsEval() { | 78 void MarkAsEval() { |
79 ASSERT(!is_lazy()); | 79 ASSERT(!is_lazy()); |
80 flags_ |= IsEval::encode(true); | 80 flags_ |= IsEval::encode(true); |
81 } | 81 } |
82 void MarkAsGlobal() { | 82 void MarkAsGlobal() { |
83 ASSERT(!is_lazy()); | 83 ASSERT(!is_lazy()); |
84 flags_ |= IsGlobal::encode(true); | 84 flags_ |= IsGlobal::encode(true); |
85 } | 85 } |
(...skipping 27 matching lines...) Expand all Loading... |
113 } | 113 } |
114 void SetCode(Handle<Code> code) { code_ = code; } | 114 void SetCode(Handle<Code> code) { code_ = code; } |
115 void SetExtension(v8::Extension* extension) { | 115 void SetExtension(v8::Extension* extension) { |
116 ASSERT(!is_lazy()); | 116 ASSERT(!is_lazy()); |
117 extension_ = extension; | 117 extension_ = extension; |
118 } | 118 } |
119 void SetPreParseData(ScriptDataImpl* pre_parse_data) { | 119 void SetPreParseData(ScriptDataImpl* pre_parse_data) { |
120 ASSERT(!is_lazy()); | 120 ASSERT(!is_lazy()); |
121 pre_parse_data_ = pre_parse_data; | 121 pre_parse_data_ = pre_parse_data; |
122 } | 122 } |
123 void SetCallingContext(Handle<Context> context) { | 123 void SetContext(Handle<Context> context) { |
124 ASSERT(is_eval()); | 124 context_ = context; |
125 calling_context_ = context; | |
126 } | 125 } |
127 void MarkCompilingForDebugging(Handle<Code> current_code) { | 126 void MarkCompilingForDebugging(Handle<Code> current_code) { |
128 ASSERT(mode_ != OPTIMIZE); | 127 ASSERT(mode_ != OPTIMIZE); |
129 ASSERT(current_code->kind() == Code::FUNCTION); | 128 ASSERT(current_code->kind() == Code::FUNCTION); |
130 flags_ |= IsCompilingForDebugging::encode(true); | 129 flags_ |= IsCompilingForDebugging::encode(true); |
131 if (current_code->is_compiled_optimizable()) { | 130 if (current_code->is_compiled_optimizable()) { |
132 EnableDeoptimizationSupport(); | 131 EnableDeoptimizationSupport(); |
133 } else { | 132 } else { |
134 mode_ = CompilationInfo::NONOPT; | 133 mode_ = CompilationInfo::NONOPT; |
135 } | 134 } |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 void AbortOptimization(); | 172 void AbortOptimization(); |
174 | 173 |
175 void set_deferred_handles(DeferredHandles* deferred_handles) { | 174 void set_deferred_handles(DeferredHandles* deferred_handles) { |
176 ASSERT(deferred_handles_ == NULL); | 175 ASSERT(deferred_handles_ == NULL); |
177 deferred_handles_ = deferred_handles; | 176 deferred_handles_ = deferred_handles; |
178 } | 177 } |
179 | 178 |
180 void SaveHandles() { | 179 void SaveHandles() { |
181 SaveHandle(&closure_); | 180 SaveHandle(&closure_); |
182 SaveHandle(&shared_info_); | 181 SaveHandle(&shared_info_); |
183 SaveHandle(&calling_context_); | 182 SaveHandle(&context_); |
184 SaveHandle(&script_); | 183 SaveHandle(&script_); |
185 } | 184 } |
186 | 185 |
187 private: | 186 private: |
188 Isolate* isolate_; | 187 Isolate* isolate_; |
189 | 188 |
190 // Compilation mode. | 189 // Compilation mode. |
191 // BASE is generated by the full codegen, optionally prepared for bailouts. | 190 // BASE is generated by the full codegen, optionally prepared for bailouts. |
192 // OPTIMIZE is optimized code generated by the Hydrogen-based backend. | 191 // OPTIMIZE is optimized code generated by the Hydrogen-based backend. |
193 // NONOPT is generated by the full codegen and is not prepared for | 192 // NONOPT is generated by the full codegen and is not prepared for |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
251 | 250 |
252 // Possible initial inputs to the compilation process. | 251 // Possible initial inputs to the compilation process. |
253 Handle<JSFunction> closure_; | 252 Handle<JSFunction> closure_; |
254 Handle<SharedFunctionInfo> shared_info_; | 253 Handle<SharedFunctionInfo> shared_info_; |
255 Handle<Script> script_; | 254 Handle<Script> script_; |
256 | 255 |
257 // Fields possibly needed for eager compilation, NULL by default. | 256 // Fields possibly needed for eager compilation, NULL by default. |
258 v8::Extension* extension_; | 257 v8::Extension* extension_; |
259 ScriptDataImpl* pre_parse_data_; | 258 ScriptDataImpl* pre_parse_data_; |
260 | 259 |
261 // The context of the caller is needed for eval code, and will be a null | 260 // The context of the caller for eval code, and the global context for a |
262 // handle otherwise. | 261 // global script. Will be a null handle otherwise. |
263 Handle<Context> calling_context_; | 262 Handle<Context> context_; |
264 | 263 |
265 // Compilation mode flag and whether deoptimization is allowed. | 264 // Compilation mode flag and whether deoptimization is allowed. |
266 Mode mode_; | 265 Mode mode_; |
267 BailoutId osr_ast_id_; | 266 BailoutId osr_ast_id_; |
268 | 267 |
269 // The zone from which the compilation pipeline working on this | 268 // The zone from which the compilation pipeline working on this |
270 // CompilationInfo allocates. | 269 // CompilationInfo allocates. |
271 Zone* zone_; | 270 Zone* zone_; |
272 | 271 |
273 DeferredHandles* deferred_handles_; | 272 DeferredHandles* deferred_handles_; |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
463 | 462 |
464 static void RecordFunctionCompilation(Logger::LogEventsAndTags tag, | 463 static void RecordFunctionCompilation(Logger::LogEventsAndTags tag, |
465 CompilationInfo* info, | 464 CompilationInfo* info, |
466 Handle<SharedFunctionInfo> shared); | 465 Handle<SharedFunctionInfo> shared); |
467 }; | 466 }; |
468 | 467 |
469 | 468 |
470 } } // namespace v8::internal | 469 } } // namespace v8::internal |
471 | 470 |
472 #endif // V8_COMPILER_H_ | 471 #endif // V8_COMPILER_H_ |
OLD | NEW |