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 27 matching lines...) Expand all Loading... |
38 class ScriptDataImpl; | 38 class ScriptDataImpl; |
39 | 39 |
40 // CompilationInfo encapsulates some information known at compile time. It | 40 // CompilationInfo encapsulates some information known at compile time. It |
41 // is constructed based on the resources available at compile-time. | 41 // is constructed based on the resources available at compile-time. |
42 class CompilationInfo BASE_EMBEDDED { | 42 class CompilationInfo BASE_EMBEDDED { |
43 public: | 43 public: |
44 CompilationInfo(Handle<Script> script, Zone* zone); | 44 CompilationInfo(Handle<Script> script, Zone* zone); |
45 CompilationInfo(Handle<SharedFunctionInfo> shared_info, Zone* zone); | 45 CompilationInfo(Handle<SharedFunctionInfo> shared_info, Zone* zone); |
46 CompilationInfo(Handle<JSFunction> closure, Zone* zone); | 46 CompilationInfo(Handle<JSFunction> closure, Zone* zone); |
47 | 47 |
| 48 ~CompilationInfo(); |
| 49 |
48 Isolate* isolate() { | 50 Isolate* isolate() { |
49 ASSERT(Isolate::Current() == isolate_); | 51 ASSERT(Isolate::Current() == isolate_); |
50 return isolate_; | 52 return isolate_; |
51 } | 53 } |
52 Zone* zone() { | 54 Zone* zone() { |
53 return zone_; | 55 return zone_; |
54 } | 56 } |
55 bool is_lazy() const { return IsLazy::decode(flags_); } | 57 bool is_lazy() const { return IsLazy::decode(flags_); } |
56 bool is_eval() const { return IsEval::decode(flags_); } | 58 bool is_eval() const { return IsEval::decode(flags_); } |
57 bool is_global() const { return IsGlobal::decode(flags_); } | 59 bool is_global() const { return IsGlobal::decode(flags_); } |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 flags_ |= SupportsDeoptimization::encode(true); | 168 flags_ |= SupportsDeoptimization::encode(true); |
167 } | 169 } |
168 | 170 |
169 // Determines whether or not to insert a self-optimization header. | 171 // Determines whether or not to insert a self-optimization header. |
170 bool ShouldSelfOptimize(); | 172 bool ShouldSelfOptimize(); |
171 | 173 |
172 // Disable all optimization attempts of this info for the rest of the | 174 // Disable all optimization attempts of this info for the rest of the |
173 // current compilation pipeline. | 175 // current compilation pipeline. |
174 void AbortOptimization(); | 176 void AbortOptimization(); |
175 | 177 |
| 178 void set_deferred_handles(DeferredHandles* deferred_handles) { |
| 179 ASSERT(deferred_handles_ == NULL); |
| 180 deferred_handles_ = deferred_handles; |
| 181 } |
| 182 |
176 private: | 183 private: |
177 Isolate* isolate_; | 184 Isolate* isolate_; |
178 | 185 |
179 // Compilation mode. | 186 // Compilation mode. |
180 // BASE is generated by the full codegen, optionally prepared for bailouts. | 187 // BASE is generated by the full codegen, optionally prepared for bailouts. |
181 // OPTIMIZE is optimized code generated by the Hydrogen-based backend. | 188 // OPTIMIZE is optimized code generated by the Hydrogen-based backend. |
182 // NONOPT is generated by the full codegen and is not prepared for | 189 // NONOPT is generated by the full codegen and is not prepared for |
183 // recompilation/bailouts. These functions are never recompiled. | 190 // recompilation/bailouts. These functions are never recompiled. |
184 enum Mode { | 191 enum Mode { |
185 BASE, | 192 BASE, |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
252 Handle<Context> calling_context_; | 259 Handle<Context> calling_context_; |
253 | 260 |
254 // Compilation mode flag and whether deoptimization is allowed. | 261 // Compilation mode flag and whether deoptimization is allowed. |
255 Mode mode_; | 262 Mode mode_; |
256 int osr_ast_id_; | 263 int osr_ast_id_; |
257 | 264 |
258 // The zone from which the compilation pipeline working on this | 265 // The zone from which the compilation pipeline working on this |
259 // CompilationInfo allocates. | 266 // CompilationInfo allocates. |
260 Zone* zone_; | 267 Zone* zone_; |
261 | 268 |
| 269 DeferredHandles* deferred_handles_; |
| 270 |
262 DISALLOW_COPY_AND_ASSIGN(CompilationInfo); | 271 DISALLOW_COPY_AND_ASSIGN(CompilationInfo); |
263 }; | 272 }; |
264 | 273 |
265 | 274 |
266 // Exactly like a CompilationInfo, except also creates and enters a | 275 // Exactly like a CompilationInfo, except also creates and enters a |
267 // Zone on construction and deallocates it on exit. | 276 // Zone on construction and deallocates it on exit. |
268 class CompilationInfoWithZone: public CompilationInfo { | 277 class CompilationInfoWithZone: public CompilationInfo { |
269 public: | 278 public: |
270 explicit CompilationInfoWithZone(Handle<Script> script) | 279 explicit CompilationInfoWithZone(Handle<Script> script) |
271 : CompilationInfo(script, &zone_), | 280 : CompilationInfo(script, &zone_), |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
350 | 359 |
351 static void RecordFunctionCompilation(Logger::LogEventsAndTags tag, | 360 static void RecordFunctionCompilation(Logger::LogEventsAndTags tag, |
352 CompilationInfo* info, | 361 CompilationInfo* info, |
353 Handle<SharedFunctionInfo> shared); | 362 Handle<SharedFunctionInfo> shared); |
354 }; | 363 }; |
355 | 364 |
356 | 365 |
357 } } // namespace v8::internal | 366 } } // namespace v8::internal |
358 | 367 |
359 #endif // V8_COMPILER_H_ | 368 #endif // V8_COMPILER_H_ |
OLD | NEW |