| 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/ast.h" | 9 #include "src/ast/ast.h" |
| 10 #include "src/bailout-reason.h" | 10 #include "src/bailout-reason.h" |
| (...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 431 Code::Kind output_code_kind() const { | 431 Code::Kind output_code_kind() const { |
| 432 return Code::ExtractKindFromFlags(code_flags_); | 432 return Code::ExtractKindFromFlags(code_flags_); |
| 433 } | 433 } |
| 434 | 434 |
| 435 StackFrame::Type GetOutputStackFrameType() const; | 435 StackFrame::Type GetOutputStackFrameType() const; |
| 436 | 436 |
| 437 int GetDeclareGlobalsFlags() const; | 437 int GetDeclareGlobalsFlags() const; |
| 438 | 438 |
| 439 SourcePositionTableBuilder::RecordingMode SourcePositionRecordingMode() const; | 439 SourcePositionTableBuilder::RecordingMode SourcePositionRecordingMode() const; |
| 440 | 440 |
| 441 protected: | |
| 442 ParseInfo* parse_info_; | |
| 443 | |
| 444 void DisableFutureOptimization() { | |
| 445 if (GetFlag(kDisableFutureOptimization) && has_shared_info()) { | |
| 446 // If Crankshaft tried to optimize this function, bailed out, and | |
| 447 // doesn't want to try again, then use TurboFan next time. | |
| 448 if (!shared_info()->dont_crankshaft() && | |
| 449 bailout_reason() != kOptimizedTooManyTimes) { | |
| 450 shared_info()->set_dont_crankshaft(true); | |
| 451 if (FLAG_trace_opt) { | |
| 452 PrintF("[disabled Crankshaft for "); | |
| 453 shared_info()->ShortPrint(); | |
| 454 PrintF(", reason: %s]\n", GetBailoutReason(bailout_reason())); | |
| 455 } | |
| 456 } else { | |
| 457 shared_info()->DisableOptimization(bailout_reason()); | |
| 458 } | |
| 459 } | |
| 460 } | |
| 461 | |
| 462 private: | 441 private: |
| 463 // Compilation mode. | 442 // Compilation mode. |
| 464 // BASE is generated by the full codegen, optionally prepared for bailouts. | 443 // BASE is generated by the full codegen, optionally prepared for bailouts. |
| 465 // OPTIMIZE is optimized code generated by the Hydrogen-based backend. | 444 // OPTIMIZE is optimized code generated by the Hydrogen-based backend. |
| 466 enum Mode { | 445 enum Mode { |
| 467 BASE, | 446 BASE, |
| 468 OPTIMIZE, | 447 OPTIMIZE, |
| 469 STUB | 448 STUB |
| 470 }; | 449 }; |
| 471 | 450 |
| 472 CompilationInfo(ParseInfo* parse_info, Vector<const char> debug_name, | 451 CompilationInfo(ParseInfo* parse_info, Vector<const char> debug_name, |
| 473 Code::Flags code_flags, Mode mode, Isolate* isolate, | 452 Code::Flags code_flags, Mode mode, Isolate* isolate, |
| 474 Zone* zone); | 453 Zone* zone); |
| 475 | 454 |
| 455 ParseInfo* parse_info_; |
| 476 Isolate* isolate_; | 456 Isolate* isolate_; |
| 477 | 457 |
| 478 void SetMode(Mode mode) { | 458 void SetMode(Mode mode) { |
| 479 mode_ = mode; | 459 mode_ = mode; |
| 480 } | 460 } |
| 481 | 461 |
| 482 void SetFlag(Flag flag) { flags_ |= flag; } | 462 void SetFlag(Flag flag) { flags_ |= flag; } |
| 483 | 463 |
| 484 void SetFlag(Flag flag, bool value) { | 464 void SetFlag(Flag flag, bool value) { |
| 485 flags_ = value ? flags_ | flag : flags_ & ~flag; | 465 flags_ = value ? flags_ | flag : flags_ & ~flag; |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 596 MUST_USE_RESULT Status SetLastStatus(Status status) { | 576 MUST_USE_RESULT Status SetLastStatus(Status status) { |
| 597 last_status_ = status; | 577 last_status_ = status; |
| 598 return last_status_; | 578 return last_status_; |
| 599 } | 579 } |
| 600 }; | 580 }; |
| 601 | 581 |
| 602 } // namespace internal | 582 } // namespace internal |
| 603 } // namespace v8 | 583 } // namespace v8 |
| 604 | 584 |
| 605 #endif // V8_COMPILER_H_ | 585 #endif // V8_COMPILER_H_ |
| OLD | NEW |