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_DEOPTIMIZER_H_ | 5 #ifndef V8_DEOPTIMIZER_H_ |
6 #define V8_DEOPTIMIZER_H_ | 6 #define V8_DEOPTIMIZER_H_ |
7 | 7 |
8 #include "src/allocation.h" | 8 #include "src/allocation.h" |
9 #include "src/macro-assembler.h" | 9 #include "src/macro-assembler.h" |
10 | 10 |
(...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
392 V(kUnknownMap, "Unknown map") \ | 392 V(kUnknownMap, "Unknown map") \ |
393 V(kValueMismatch, "value mismatch") \ | 393 V(kValueMismatch, "value mismatch") \ |
394 V(kWrongInstanceType, "wrong instance type") \ | 394 V(kWrongInstanceType, "wrong instance type") \ |
395 V(kWrongMap, "wrong map") \ | 395 V(kWrongMap, "wrong map") \ |
396 V(kUndefinedOrNullInForIn, "null or undefined in for-in") \ | 396 V(kUndefinedOrNullInForIn, "null or undefined in for-in") \ |
397 V(kUndefinedOrNullInToObject, "null or undefined in ToObject") | 397 V(kUndefinedOrNullInToObject, "null or undefined in ToObject") |
398 | 398 |
399 | 399 |
400 class Deoptimizer : public Malloced { | 400 class Deoptimizer : public Malloced { |
401 public: | 401 public: |
402 enum BailoutType { | 402 enum BailoutType { EAGER, LAZY, SOFT, kLastBailoutType = SOFT }; |
403 EAGER, | |
404 LAZY, | |
405 SOFT, | |
406 // This last bailout type is not really a bailout, but used by the | |
407 // debugger to deoptimize stack frames to allow inspection. | |
408 DEBUGGER, | |
409 kBailoutTypesWithCodeEntry = SOFT + 1 | |
410 }; | |
411 | 403 |
412 #define DEOPT_MESSAGES_CONSTANTS(C, T) C, | 404 #define DEOPT_MESSAGES_CONSTANTS(C, T) C, |
413 enum DeoptReason { | 405 enum DeoptReason { |
414 DEOPT_MESSAGES_LIST(DEOPT_MESSAGES_CONSTANTS) kLastDeoptReason | 406 DEOPT_MESSAGES_LIST(DEOPT_MESSAGES_CONSTANTS) kLastDeoptReason |
415 }; | 407 }; |
416 #undef DEOPT_MESSAGES_CONSTANTS | 408 #undef DEOPT_MESSAGES_CONSTANTS |
417 static const char* GetDeoptReason(DeoptReason deopt_reason); | 409 static const char* GetDeoptReason(DeoptReason deopt_reason); |
418 | 410 |
419 struct DeoptInfo { | 411 struct DeoptInfo { |
420 DeoptInfo(SourcePosition position, const char* m, DeoptReason d) | 412 DeoptInfo(SourcePosition position, const char* m, DeoptReason d) |
(...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
875 }; | 867 }; |
876 | 868 |
877 | 869 |
878 class DeoptimizerData { | 870 class DeoptimizerData { |
879 public: | 871 public: |
880 explicit DeoptimizerData(MemoryAllocator* allocator); | 872 explicit DeoptimizerData(MemoryAllocator* allocator); |
881 ~DeoptimizerData(); | 873 ~DeoptimizerData(); |
882 | 874 |
883 private: | 875 private: |
884 MemoryAllocator* allocator_; | 876 MemoryAllocator* allocator_; |
885 int deopt_entry_code_entries_[Deoptimizer::kBailoutTypesWithCodeEntry]; | 877 int deopt_entry_code_entries_[Deoptimizer::kLastBailoutType + 1]; |
886 MemoryChunk* deopt_entry_code_[Deoptimizer::kBailoutTypesWithCodeEntry]; | 878 MemoryChunk* deopt_entry_code_[Deoptimizer::kLastBailoutType + 1]; |
887 | 879 |
888 Deoptimizer* current_; | 880 Deoptimizer* current_; |
889 | 881 |
890 friend class Deoptimizer; | 882 friend class Deoptimizer; |
891 | 883 |
892 DISALLOW_COPY_AND_ASSIGN(DeoptimizerData); | 884 DISALLOW_COPY_AND_ASSIGN(DeoptimizerData); |
893 }; | 885 }; |
894 | 886 |
895 | 887 |
896 class TranslationBuffer BASE_EMBEDDED { | 888 class TranslationBuffer BASE_EMBEDDED { |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1099 std::vector<Handle<Object> > expression_stack_; | 1091 std::vector<Handle<Object> > expression_stack_; |
1100 int source_position_; | 1092 int source_position_; |
1101 | 1093 |
1102 friend class Deoptimizer; | 1094 friend class Deoptimizer; |
1103 }; | 1095 }; |
1104 | 1096 |
1105 } // namespace internal | 1097 } // namespace internal |
1106 } // namespace v8 | 1098 } // namespace v8 |
1107 | 1099 |
1108 #endif // V8_DEOPTIMIZER_H_ | 1100 #endif // V8_DEOPTIMIZER_H_ |
OLD | NEW |