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 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 bool requires_frame() const { return GetFlag(kRequiresFrame); } | 201 bool requires_frame() const { return GetFlag(kRequiresFrame); } |
202 | 202 |
203 void MarkMustNotHaveEagerFrame() { SetFlag(kMustNotHaveEagerFrame); } | 203 void MarkMustNotHaveEagerFrame() { SetFlag(kMustNotHaveEagerFrame); } |
204 | 204 |
205 bool GetMustNotHaveEagerFrame() const { | 205 bool GetMustNotHaveEagerFrame() const { |
206 return GetFlag(kMustNotHaveEagerFrame); | 206 return GetFlag(kMustNotHaveEagerFrame); |
207 } | 207 } |
208 | 208 |
209 // Compiles marked as debug produce unoptimized code with debug break slots. | 209 // Compiles marked as debug produce unoptimized code with debug break slots. |
210 // Inner functions that cannot be compiled w/o context are compiled eagerly. | 210 // Inner functions that cannot be compiled w/o context are compiled eagerly. |
211 void MarkAsDebug() { SetFlag(kDebug); } | 211 // Always include deoptimization support to avoid having to recompile again. |
| 212 void MarkAsDebug() { |
| 213 SetFlag(kDebug); |
| 214 SetFlag(kDeoptimizationSupport); |
| 215 } |
212 | 216 |
213 bool is_debug() const { return GetFlag(kDebug); } | 217 bool is_debug() const { return GetFlag(kDebug); } |
214 | 218 |
215 void PrepareForSerializing() { SetFlag(kSerializing); } | 219 void PrepareForSerializing() { SetFlag(kSerializing); } |
216 | 220 |
217 bool will_serialize() const { return GetFlag(kSerializing); } | 221 bool will_serialize() const { return GetFlag(kSerializing); } |
218 | 222 |
219 void MarkAsContextSpecializing() { SetFlag(kContextSpecializing); } | 223 void MarkAsContextSpecializing() { SetFlag(kContextSpecializing); } |
220 | 224 |
221 bool is_context_specializing() const { return GetFlag(kContextSpecializing); } | 225 bool is_context_specializing() const { return GetFlag(kContextSpecializing); } |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
264 return FLAG_optimize_for_size && FLAG_age_code && !will_serialize() && | 268 return FLAG_optimize_for_size && FLAG_age_code && !will_serialize() && |
265 !is_debug(); | 269 !is_debug(); |
266 } | 270 } |
267 | 271 |
268 void EnsureFeedbackVector(); | 272 void EnsureFeedbackVector(); |
269 Handle<TypeFeedbackVector> feedback_vector() const { | 273 Handle<TypeFeedbackVector> feedback_vector() const { |
270 return feedback_vector_; | 274 return feedback_vector_; |
271 } | 275 } |
272 void SetCode(Handle<Code> code) { code_ = code; } | 276 void SetCode(Handle<Code> code) { code_ = code; } |
273 | 277 |
274 void MarkNonOptimizable() { | |
275 SetMode(CompilationInfo::NONOPT); | |
276 } | |
277 | |
278 bool ShouldTrapOnDeopt() const { | 278 bool ShouldTrapOnDeopt() const { |
279 return (FLAG_trap_on_deopt && IsOptimizing()) || | 279 return (FLAG_trap_on_deopt && IsOptimizing()) || |
280 (FLAG_trap_on_stub_deopt && IsStub()); | 280 (FLAG_trap_on_stub_deopt && IsStub()); |
281 } | 281 } |
282 | 282 |
283 bool has_global_object() const { | 283 bool has_global_object() const { |
284 return !closure().is_null() && | 284 return !closure().is_null() && |
285 (closure()->context()->global_object() != NULL); | 285 (closure()->context()->global_object() != NULL); |
286 } | 286 } |
287 | 287 |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
418 void DisableFutureOptimization() { | 418 void DisableFutureOptimization() { |
419 if (GetFlag(kDisableFutureOptimization) && has_shared_info()) { | 419 if (GetFlag(kDisableFutureOptimization) && has_shared_info()) { |
420 shared_info()->DisableOptimization(bailout_reason()); | 420 shared_info()->DisableOptimization(bailout_reason()); |
421 } | 421 } |
422 } | 422 } |
423 | 423 |
424 private: | 424 private: |
425 // Compilation mode. | 425 // Compilation mode. |
426 // BASE is generated by the full codegen, optionally prepared for bailouts. | 426 // BASE is generated by the full codegen, optionally prepared for bailouts. |
427 // OPTIMIZE is optimized code generated by the Hydrogen-based backend. | 427 // OPTIMIZE is optimized code generated by the Hydrogen-based backend. |
428 // NONOPT is generated by the full codegen and is not prepared for | |
429 // recompilation/bailouts. These functions are never recompiled. | |
430 enum Mode { | 428 enum Mode { |
431 BASE, | 429 BASE, |
432 OPTIMIZE, | 430 OPTIMIZE, |
433 NONOPT, | |
434 STUB | 431 STUB |
435 }; | 432 }; |
436 | 433 |
437 CompilationInfo(ParseInfo* parse_info, CodeStub* code_stub, Mode mode, | 434 CompilationInfo(ParseInfo* parse_info, CodeStub* code_stub, Mode mode, |
438 Isolate* isolate, Zone* zone); | 435 Isolate* isolate, Zone* zone); |
439 | 436 |
440 Isolate* isolate_; | 437 Isolate* isolate_; |
441 | 438 |
442 void SetMode(Mode mode) { | 439 void SetMode(Mode mode) { |
443 mode_ = mode; | 440 mode_ = mode; |
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
704 Zone zone_; | 701 Zone zone_; |
705 size_t info_zone_start_allocation_size_; | 702 size_t info_zone_start_allocation_size_; |
706 base::ElapsedTimer timer_; | 703 base::ElapsedTimer timer_; |
707 | 704 |
708 DISALLOW_COPY_AND_ASSIGN(CompilationPhase); | 705 DISALLOW_COPY_AND_ASSIGN(CompilationPhase); |
709 }; | 706 }; |
710 | 707 |
711 } } // namespace v8::internal | 708 } } // namespace v8::internal |
712 | 709 |
713 #endif // V8_COMPILER_H_ | 710 #endif // V8_COMPILER_H_ |
OLD | NEW |