1 // Copyright 2016 the V8 project authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifndef V8_DEOPTIMIZE_REASON_H_ 6 #define V8_DEOPTIMIZE_REASON_H_ 7 8 #include "src/globals.h" 9 10 namespace v8 { 11 namespace internal { 12 13 #define DEOPTIMIZE_REASON_LIST(V) \ 14 V(ArrayBufferWasNeutered, "array buffer was neutered") \ 15 V(CowArrayElementsChanged, "copy-on-write array's elements changed") \ 16 V(CouldNotGrowElements, "failed to grow elements store") \ 17 V(DeoptimizeNow, "%_DeoptimizeNow") \ 18 V(DivisionByZero, "division by zero") \ 19 V(Hole, "hole") \ 20 V(InstanceMigrationFailed, "instance migration failed") \ 21 V(InsufficientTypeFeedbackForCall, "Insufficient type feedback for call") \ 22 V(InsufficientTypeFeedbackForConstruct, \ 23 "Insufficient type feedback for construct") \ 24 V(InsufficientTypeFeedbackForForIn, "Insufficient type feedback for for-in") \ 25 V(InsufficientTypeFeedbackForBinaryOperation, \ 26 "Insufficient type feedback for binary operation") \ 27 V(InsufficientTypeFeedbackForCompareOperation, \ 28 "Insufficient type feedback for compare operation") \ 29 V(InsufficientTypeFeedbackForGenericNamedAccess, \ 30 "Insufficient type feedback for generic named access") \ 31 V(InsufficientTypeFeedbackForGenericKeyedAccess, \ 32 "Insufficient type feedback for generic keyed access") \ 33 V(InsufficientTypeFeedbackForUnaryOperation, \ 34 "Insufficient type feedback for unary operation") \ 35 V(LostPrecision, "lost precision") \ 36 V(LostPrecisionOrNaN, "lost precision or NaN") \ 37 V(MinusZero, "minus zero") \ 38 V(NaN, "NaN") \ 39 V(NoCache, "no cache") \ 40 V(NotAHeapNumber, "not a heap number") \ 41 V(NotAJavaScriptObject, "not a JavaScript object") \ 42 V(NotANumberOrOddball, "not a Number or Oddball") \ 43 V(NotASmi, "not a Smi") \ 44 V(NotAString, "not a String") \ 45 V(NotASymbol, "not a Symbol") \ 46 V(OutOfBounds, "out of bounds") \ 47 V(Overflow, "overflow") \ 48 V(ReceiverNotAGlobalProxy, "receiver was not a global proxy") \ 49 V(Smi, "Smi") \ 50 V(Unknown, "(unknown)") \ 51 V(ValueMismatch, "value mismatch") \ 52 V(WrongCallTarget, "wrong call target") \ 53 V(WrongEnumIndices, "wrong enum indices") \ 54 V(WrongInstanceType, "wrong instance type") \ 55 V(WrongMap, "wrong map") \ 56 V(WrongName, "wrong name") \ 57 V(WrongValue, "wrong value") \ 58 V(NoInitialElement, "no initial element") 59 60 enum class DeoptimizeReason : uint8_t { 61 #define DEOPTIMIZE_REASON(Name, message) k##Name, 62 DEOPTIMIZE_REASON_LIST(DEOPTIMIZE_REASON) 63 #undef DEOPTIMIZE_REASON 64 }; 65 66 std::ostream& operator<<(std::ostream&, DeoptimizeReason); 67 68 size_t hash_value(DeoptimizeReason reason); 69 70 char const* DeoptimizeReasonToString(DeoptimizeReason reason); 71 72 } // namespace internal 73 } // namespace v8 74 75 #endif // V8_DEOPTIMIZE_REASON_H_ 76