11cb0ef41Sopenharmony_ci// Copyright 2014 the V8 project authors. All rights reserved. 21cb0ef41Sopenharmony_ci// Use of this source code is governed by a BSD-style license that can be 31cb0ef41Sopenharmony_ci// found in the LICENSE file. 41cb0ef41Sopenharmony_ci 51cb0ef41Sopenharmony_ci#ifndef V8_CODEGEN_BAILOUT_REASON_H_ 61cb0ef41Sopenharmony_ci#define V8_CODEGEN_BAILOUT_REASON_H_ 71cb0ef41Sopenharmony_ci 81cb0ef41Sopenharmony_ci#include <cstdint> 91cb0ef41Sopenharmony_ci 101cb0ef41Sopenharmony_cinamespace v8 { 111cb0ef41Sopenharmony_cinamespace internal { 121cb0ef41Sopenharmony_ci 131cb0ef41Sopenharmony_ci#define ABORT_MESSAGES_LIST(V) \ 141cb0ef41Sopenharmony_ci V(kNoReason, "no reason") \ 151cb0ef41Sopenharmony_ci \ 161cb0ef41Sopenharmony_ci V(k32BitValueInRegisterIsNotZeroExtended, \ 171cb0ef41Sopenharmony_ci "32 bit value in register is not zero-extended") \ 181cb0ef41Sopenharmony_ci V(kAPICallReturnedInvalidObject, "API call returned invalid object") \ 191cb0ef41Sopenharmony_ci V(kAllocatingNonEmptyPackedArray, "Allocating non-empty packed array") \ 201cb0ef41Sopenharmony_ci V(kAllocationIsNotDoubleAligned, "Allocation is not double aligned") \ 211cb0ef41Sopenharmony_ci V(kExpectedOptimizationSentinel, \ 221cb0ef41Sopenharmony_ci "Expected optimized code cell or optimization sentinel") \ 231cb0ef41Sopenharmony_ci V(kExpectedUndefinedOrCell, "Expected undefined or cell in register") \ 241cb0ef41Sopenharmony_ci V(kExpectedFeedbackVector, "Expected feedback vector") \ 251cb0ef41Sopenharmony_ci V(kExpectedBaselineData, "Expected baseline data") \ 261cb0ef41Sopenharmony_ci V(kFunctionDataShouldBeBytecodeArrayOnInterpreterEntry, \ 271cb0ef41Sopenharmony_ci "The function_data field should be a BytecodeArray on interpreter entry") \ 281cb0ef41Sopenharmony_ci V(kInputStringTooLong, "Input string too long") \ 291cb0ef41Sopenharmony_ci V(kInvalidBytecode, "Invalid bytecode") \ 301cb0ef41Sopenharmony_ci V(kInvalidBytecodeAdvance, "Cannot advance current bytecode, ") \ 311cb0ef41Sopenharmony_ci V(kInvalidHandleScopeLevel, "Invalid HandleScope level") \ 321cb0ef41Sopenharmony_ci V(kInvalidJumpTableIndex, "Invalid jump table index") \ 331cb0ef41Sopenharmony_ci V(kInvalidParametersAndRegistersInGenerator, \ 341cb0ef41Sopenharmony_ci "invalid parameters and registers in generator") \ 351cb0ef41Sopenharmony_ci V(kMissingBytecodeArray, "Missing bytecode array from function") \ 361cb0ef41Sopenharmony_ci V(kObjectNotTagged, "The object is not tagged") \ 371cb0ef41Sopenharmony_ci V(kObjectTagged, "The object is tagged") \ 381cb0ef41Sopenharmony_ci V(kOffsetOutOfRange, "Offset out of range") \ 391cb0ef41Sopenharmony_ci V(kOperandIsASmi, "Operand is a smi") \ 401cb0ef41Sopenharmony_ci V(kOperandIsASmiAndNotABoundFunction, \ 411cb0ef41Sopenharmony_ci "Operand is a smi and not a bound function") \ 421cb0ef41Sopenharmony_ci V(kOperandIsASmiAndNotAConstructor, \ 431cb0ef41Sopenharmony_ci "Operand is a smi and not a constructor") \ 441cb0ef41Sopenharmony_ci V(kOperandIsASmiAndNotAFunction, "Operand is a smi and not a function") \ 451cb0ef41Sopenharmony_ci V(kOperandIsASmiAndNotAGeneratorObject, \ 461cb0ef41Sopenharmony_ci "Operand is a smi and not a generator object") \ 471cb0ef41Sopenharmony_ci V(kOperandIsCleared, "Operand is cleared") \ 481cb0ef41Sopenharmony_ci V(kOperandIsNotABoundFunction, "Operand is not a bound function") \ 491cb0ef41Sopenharmony_ci V(kOperandIsNotAConstructor, "Operand is not a constructor") \ 501cb0ef41Sopenharmony_ci V(kOperandIsNotAFixedArray, "Operand is not a fixed array") \ 511cb0ef41Sopenharmony_ci V(kOperandIsNotAFunction, "Operand is not a function") \ 521cb0ef41Sopenharmony_ci V(kOperandIsNotACallableFunction, "Operand is not a callable function") \ 531cb0ef41Sopenharmony_ci V(kOperandIsNotAGeneratorObject, "Operand is not a generator object") \ 541cb0ef41Sopenharmony_ci V(kOperandIsNotACodeT, "Operand is not a CodeT") \ 551cb0ef41Sopenharmony_ci V(kOperandIsNotASmi, "Operand is not a smi") \ 561cb0ef41Sopenharmony_ci V(kPromiseAlreadySettled, "Promise already settled") \ 571cb0ef41Sopenharmony_ci V(kReceivedInvalidReturnAddress, "Received invalid return address") \ 581cb0ef41Sopenharmony_ci V(kRegisterDidNotMatchExpectedRoot, "Register did not match expected root") \ 591cb0ef41Sopenharmony_ci V(kReturnAddressNotFoundInFrame, "Return address not found in frame") \ 601cb0ef41Sopenharmony_ci V(kShouldNotDirectlyEnterOsrFunction, \ 611cb0ef41Sopenharmony_ci "Should not directly enter OSR-compiled function") \ 621cb0ef41Sopenharmony_ci V(kStackAccessBelowStackPointer, "Stack access below stack pointer") \ 631cb0ef41Sopenharmony_ci V(kStackFrameTypesMustMatch, "Stack frame types must match") \ 641cb0ef41Sopenharmony_ci V(kUnalignedCellInWriteBarrier, "Unaligned cell in write barrier") \ 651cb0ef41Sopenharmony_ci V(kUnexpectedAdditionalPopValue, "Unexpected additional pop value") \ 661cb0ef41Sopenharmony_ci V(kUnexpectedElementsKindInArrayConstructor, \ 671cb0ef41Sopenharmony_ci "Unexpected ElementsKind in array constructor") \ 681cb0ef41Sopenharmony_ci V(kUnexpectedFPCRMode, "Unexpected FPCR mode.") \ 691cb0ef41Sopenharmony_ci V(kUnexpectedFunctionIDForInvokeIntrinsic, \ 701cb0ef41Sopenharmony_ci "Unexpected runtime function id for the InvokeIntrinsic bytecode") \ 711cb0ef41Sopenharmony_ci V(kUnexpectedInitialMapForArrayFunction, \ 721cb0ef41Sopenharmony_ci "Unexpected initial map for Array function") \ 731cb0ef41Sopenharmony_ci V(kUnexpectedLevelAfterReturnFromApiCall, \ 741cb0ef41Sopenharmony_ci "Unexpected level after return from api call") \ 751cb0ef41Sopenharmony_ci V(kUnexpectedNegativeValue, "Unexpected negative value") \ 761cb0ef41Sopenharmony_ci V(kUnexpectedReturnFromFrameDropper, \ 771cb0ef41Sopenharmony_ci "Unexpectedly returned from dropping frames") \ 781cb0ef41Sopenharmony_ci V(kUnexpectedReturnFromThrow, "Unexpectedly returned from a throw") \ 791cb0ef41Sopenharmony_ci V(kUnexpectedReturnFromWasmTrap, \ 801cb0ef41Sopenharmony_ci "Should not return after throwing a wasm trap") \ 811cb0ef41Sopenharmony_ci V(kUnexpectedStackPointer, "The stack pointer is not the expected value") \ 821cb0ef41Sopenharmony_ci V(kUnexpectedValue, "Unexpected value") \ 831cb0ef41Sopenharmony_ci V(kUnsupportedModuleOperation, "Unsupported module operation") \ 841cb0ef41Sopenharmony_ci V(kUnsupportedNonPrimitiveCompare, "Unsupported non-primitive compare") \ 851cb0ef41Sopenharmony_ci V(kWrongAddressOrValuePassedToRecordWrite, \ 861cb0ef41Sopenharmony_ci "Wrong address or value passed to RecordWrite") \ 871cb0ef41Sopenharmony_ci V(kWrongArgumentCountForInvokeIntrinsic, \ 881cb0ef41Sopenharmony_ci "Wrong number of arguments for intrinsic") \ 891cb0ef41Sopenharmony_ci V(kWrongFunctionCodeStart, "Wrong value in code start register passed") \ 901cb0ef41Sopenharmony_ci V(kWrongFunctionContext, "Wrong context passed to function") \ 911cb0ef41Sopenharmony_ci V(kUnexpectedThreadInWasmSet, "thread_in_wasm flag was already set") \ 921cb0ef41Sopenharmony_ci V(kUnexpectedThreadInWasmUnset, "thread_in_wasm flag was not set") 931cb0ef41Sopenharmony_ci 941cb0ef41Sopenharmony_ci#define BAILOUT_MESSAGES_LIST(V) \ 951cb0ef41Sopenharmony_ci V(kNoReason, "no reason") \ 961cb0ef41Sopenharmony_ci \ 971cb0ef41Sopenharmony_ci V(kBailedOutDueToDependencyChange, "Bailed out due to dependency change") \ 981cb0ef41Sopenharmony_ci V(kCodeGenerationFailed, "Code generation failed") \ 991cb0ef41Sopenharmony_ci V(kCyclicObjectStateDetectedInEscapeAnalysis, \ 1001cb0ef41Sopenharmony_ci "Cyclic object state detected by escape analysis") \ 1011cb0ef41Sopenharmony_ci V(kFunctionBeingDebugged, "Function is being debugged") \ 1021cb0ef41Sopenharmony_ci V(kGraphBuildingFailed, "Optimized graph construction failed") \ 1031cb0ef41Sopenharmony_ci V(kFunctionTooBig, "Function is too big to be optimized") \ 1041cb0ef41Sopenharmony_ci V(kLiveEdit, "LiveEdit") \ 1051cb0ef41Sopenharmony_ci V(kNativeFunctionLiteral, "Native function literal") \ 1061cb0ef41Sopenharmony_ci V(kNotEnoughVirtualRegistersRegalloc, \ 1071cb0ef41Sopenharmony_ci "Not enough virtual registers (regalloc)") \ 1081cb0ef41Sopenharmony_ci V(kOptimizationDisabled, "Optimization disabled") \ 1091cb0ef41Sopenharmony_ci V(kNeverOptimize, "Optimization is always disabled") 1101cb0ef41Sopenharmony_ci 1111cb0ef41Sopenharmony_ci#define ERROR_MESSAGES_CONSTANTS(C, T) C, 1121cb0ef41Sopenharmony_cienum class BailoutReason : uint8_t { 1131cb0ef41Sopenharmony_ci BAILOUT_MESSAGES_LIST(ERROR_MESSAGES_CONSTANTS) kLastErrorMessage 1141cb0ef41Sopenharmony_ci}; 1151cb0ef41Sopenharmony_ci 1161cb0ef41Sopenharmony_cienum class AbortReason : uint8_t { 1171cb0ef41Sopenharmony_ci ABORT_MESSAGES_LIST(ERROR_MESSAGES_CONSTANTS) kLastErrorMessage 1181cb0ef41Sopenharmony_ci}; 1191cb0ef41Sopenharmony_ci#undef ERROR_MESSAGES_CONSTANTS 1201cb0ef41Sopenharmony_ci 1211cb0ef41Sopenharmony_ciconst char* GetBailoutReason(BailoutReason reason); 1221cb0ef41Sopenharmony_ciconst char* GetAbortReason(AbortReason reason); 1231cb0ef41Sopenharmony_cibool IsValidAbortReason(int reason_id); 1241cb0ef41Sopenharmony_ci 1251cb0ef41Sopenharmony_ci} // namespace internal 1261cb0ef41Sopenharmony_ci} // namespace v8 1271cb0ef41Sopenharmony_ci 1281cb0ef41Sopenharmony_ci#endif // V8_CODEGEN_BAILOUT_REASON_H_ 129