2014-09-24 07:08:27 +00:00
|
|
|
// Copyright 2014 the V8 project authors. All rights reserved.
|
|
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
|
|
// found in the LICENSE file.
|
|
|
|
|
|
|
|
#ifndef V8_BAILOUT_REASON_H_
|
|
|
|
#define V8_BAILOUT_REASON_H_
|
|
|
|
|
2018-08-24 07:57:01 +00:00
|
|
|
#include <cstdint>
|
|
|
|
|
2014-09-24 07:08:27 +00:00
|
|
|
namespace v8 {
|
|
|
|
namespace internal {
|
|
|
|
|
2018-12-10 12:57:43 +00:00
|
|
|
#define ABORT_MESSAGES_LIST(V) \
|
|
|
|
V(kNoReason, "no reason") \
|
|
|
|
\
|
|
|
|
V(k32BitValueInRegisterIsNotZeroExtended, \
|
|
|
|
"32 bit value in register is not zero-extended") \
|
|
|
|
V(kAPICallReturnedInvalidObject, "API call returned invalid object") \
|
|
|
|
V(kAllocatingNonEmptyPackedArray, "Allocating non-empty packed array") \
|
|
|
|
V(kAllocationIsNotDoubleAligned, "Allocation is not double aligned") \
|
|
|
|
V(kExpectedOptimizationSentinel, \
|
|
|
|
"Expected optimized code cell or optimization sentinel") \
|
|
|
|
V(kExpectedUndefinedOrCell, "Expected undefined or cell in register") \
|
|
|
|
V(kFunctionDataShouldBeBytecodeArrayOnInterpreterEntry, \
|
|
|
|
"The function_data field should be a BytecodeArray on interpreter entry") \
|
|
|
|
V(kInputStringTooLong, "Input string too long") \
|
|
|
|
V(kInvalidBytecode, "Invalid bytecode") \
|
|
|
|
V(kInvalidBytecodeAdvance, "Cannot advance current bytecode, ") \
|
2018-12-12 15:15:13 +00:00
|
|
|
V(kInvalidElementsKindForInternalPackedArray, \
|
|
|
|
"Invalid ElementsKind for InternalPackedArray") \
|
2018-12-10 12:57:43 +00:00
|
|
|
V(kInvalidHandleScopeLevel, "Invalid HandleScope level") \
|
|
|
|
V(kInvalidJumpTableIndex, "Invalid jump table index") \
|
|
|
|
V(kInvalidParametersAndRegistersInGenerator, \
|
|
|
|
"invalid parameters and registers in generator") \
|
|
|
|
V(kMissingBytecodeArray, "Missing bytecode array from function") \
|
|
|
|
V(kObjectNotTagged, "The object is not tagged") \
|
|
|
|
V(kObjectTagged, "The object is tagged") \
|
|
|
|
V(kOffsetOutOfRange, "Offset out of range") \
|
|
|
|
V(kOperandIsASmi, "Operand is a smi") \
|
|
|
|
V(kOperandIsASmiAndNotABoundFunction, \
|
|
|
|
"Operand is a smi and not a bound function") \
|
|
|
|
V(kOperandIsASmiAndNotAConstructor, \
|
|
|
|
"Operand is a smi and not a constructor") \
|
|
|
|
V(kOperandIsASmiAndNotAFunction, "Operand is a smi and not a function") \
|
|
|
|
V(kOperandIsASmiAndNotAGeneratorObject, \
|
|
|
|
"Operand is a smi and not a generator object") \
|
|
|
|
V(kOperandIsNotABoundFunction, "Operand is not a bound function") \
|
|
|
|
V(kOperandIsNotAConstructor, "Operand is not a constructor") \
|
|
|
|
V(kOperandIsNotAFixedArray, "Operand is not a fixed array") \
|
|
|
|
V(kOperandIsNotAFunction, "Operand is not a function") \
|
|
|
|
V(kOperandIsNotAGeneratorObject, "Operand is not a generator object") \
|
|
|
|
V(kOperandIsNotASmi, "Operand is not a smi") \
|
2019-02-14 08:26:51 +00:00
|
|
|
V(kPromiseAlreadySettled, "Promise already settled") \
|
2018-12-10 12:57:43 +00:00
|
|
|
V(kReceivedInvalidReturnAddress, "Received invalid return address") \
|
|
|
|
V(kRegisterDidNotMatchExpectedRoot, "Register did not match expected root") \
|
|
|
|
V(kRegisterWasClobbered, "Register was clobbered") \
|
|
|
|
V(kReturnAddressNotFoundInFrame, "Return address not found in frame") \
|
|
|
|
V(kShouldNotDirectlyEnterOsrFunction, \
|
|
|
|
"Should not directly enter OSR-compiled function") \
|
|
|
|
V(kStackAccessBelowStackPointer, "Stack access below stack pointer") \
|
|
|
|
V(kStackFrameTypesMustMatch, "Stack frame types must match") \
|
|
|
|
V(kUnalignedCellInWriteBarrier, "Unaligned cell in write barrier") \
|
|
|
|
V(kUnexpectedElementsKindInArrayConstructor, \
|
|
|
|
"Unexpected ElementsKind in array constructor") \
|
|
|
|
V(kUnexpectedFPCRMode, "Unexpected FPCR mode.") \
|
|
|
|
V(kUnexpectedFunctionIDForInvokeIntrinsic, \
|
|
|
|
"Unexpected runtime function id for the InvokeIntrinsic bytecode") \
|
|
|
|
V(kUnexpectedInitialMapForArrayFunction, \
|
|
|
|
"Unexpected initial map for Array function") \
|
|
|
|
V(kUnexpectedInitialMapForInternalArrayFunction, \
|
|
|
|
"Unexpected initial map for InternalArray function") \
|
|
|
|
V(kUnexpectedLevelAfterReturnFromApiCall, \
|
|
|
|
"Unexpected level after return from api call") \
|
|
|
|
V(kUnexpectedNegativeValue, "Unexpected negative value") \
|
|
|
|
V(kUnexpectedReturnFromFrameDropper, \
|
|
|
|
"Unexpectedly returned from dropping frames") \
|
|
|
|
V(kUnexpectedReturnFromThrow, "Unexpectedly returned from a throw") \
|
|
|
|
V(kUnexpectedReturnFromWasmTrap, \
|
|
|
|
"Should not return after throwing a wasm trap") \
|
|
|
|
V(kUnexpectedStackPointer, "The stack pointer is not the expected value") \
|
|
|
|
V(kUnexpectedValue, "Unexpected value") \
|
|
|
|
V(kUnsupportedModuleOperation, "Unsupported module operation") \
|
|
|
|
V(kUnsupportedNonPrimitiveCompare, "Unsupported non-primitive compare") \
|
|
|
|
V(kWrongAddressOrValuePassedToRecordWrite, \
|
|
|
|
"Wrong address or value passed to RecordWrite") \
|
|
|
|
V(kWrongArgumentCountForInvokeIntrinsic, \
|
|
|
|
"Wrong number of arguments for intrinsic") \
|
|
|
|
V(kWrongFunctionCodeStart, "Wrong value in code start register passed") \
|
|
|
|
V(kWrongFunctionContext, "Wrong context passed to function") \
|
2018-12-12 15:15:13 +00:00
|
|
|
V(kWrongNumberOfArgumentsForInternalPackedArray, \
|
|
|
|
"Wrong number of arguments for InternalPackedArray") \
|
2018-12-10 12:57:43 +00:00
|
|
|
V(kUnexpectedThreadInWasmSet, "thread_in_wasm flag was already set") \
|
|
|
|
V(kUnexpectedThreadInWasmUnset, "thread_in_wasm flag was not set")
|
2018-01-03 23:27:03 +00:00
|
|
|
|
|
|
|
#define BAILOUT_MESSAGES_LIST(V) \
|
|
|
|
V(kNoReason, "no reason") \
|
|
|
|
\
|
|
|
|
V(kBailedOutDueToDependencyChange, "Bailed out due to dependency change") \
|
|
|
|
V(kCodeGenerationFailed, "Code generation failed") \
|
|
|
|
V(kCyclicObjectStateDetectedInEscapeAnalysis, \
|
|
|
|
"Cyclic object state detected by escape analysis") \
|
|
|
|
V(kFunctionBeingDebugged, "Function is being debugged") \
|
|
|
|
V(kGraphBuildingFailed, "Optimized graph construction failed") \
|
2018-02-26 21:06:46 +00:00
|
|
|
V(kFunctionTooBig, "Function is too big to be optimized") \
|
2018-01-03 23:27:03 +00:00
|
|
|
V(kLiveEdit, "LiveEdit") \
|
|
|
|
V(kNativeFunctionLiteral, "Native function literal") \
|
|
|
|
V(kNotEnoughVirtualRegistersRegalloc, \
|
|
|
|
"Not enough virtual registers (regalloc)") \
|
|
|
|
V(kOptimizationDisabled, "Optimization disabled") \
|
2018-12-19 13:17:05 +00:00
|
|
|
V(kNeverOptimize, "Optimization is always disabled")
|
2014-09-24 07:08:27 +00:00
|
|
|
|
|
|
|
#define ERROR_MESSAGES_CONSTANTS(C, T) C,
|
2018-08-24 07:57:01 +00:00
|
|
|
enum class BailoutReason : uint8_t {
|
2018-07-20 17:27:24 +00:00
|
|
|
BAILOUT_MESSAGES_LIST(ERROR_MESSAGES_CONSTANTS) kLastErrorMessage
|
2018-01-03 23:27:03 +00:00
|
|
|
};
|
|
|
|
|
2018-08-24 07:57:01 +00:00
|
|
|
enum class AbortReason : uint8_t {
|
2018-07-20 17:27:24 +00:00
|
|
|
ABORT_MESSAGES_LIST(ERROR_MESSAGES_CONSTANTS) kLastErrorMessage
|
2014-09-24 07:08:27 +00:00
|
|
|
};
|
|
|
|
#undef ERROR_MESSAGES_CONSTANTS
|
|
|
|
|
|
|
|
const char* GetBailoutReason(BailoutReason reason);
|
2018-01-03 23:27:03 +00:00
|
|
|
const char* GetAbortReason(AbortReason reason);
|
Reland "[turboassembler] Introduce hard-abort mode"
This is a reland of a462a7854a081f4f34bb4c112ee33f3d69efa309
Original change's description:
> [turboassembler] Introduce hard-abort mode
>
> For checks and assertions (mostly for debug code, like stack alignment
> or zero extension), we had two modes: Emit a call to the {Abort}
> runtime function (the default), and emit a debug break (used for
> testing, enabled via --trap-on-abort).
> In wasm, where we cannot just call a runtime function because code must
> be isolate independent, we always used the trap-on-abort behaviour.
> This causes problems for our fuzzers, which do not catch SIGTRAP, and
> hence do not detect debug code failures.
>
> This CL introduces a third mode ("hard abort"), which calls a C
> function via {ExternalReference}. The C function still outputs the
> abort reason, but does not print the stack trace. It then aborts via
> "OS::Abort", just like the runtime function.
> This will allow fuzzers to detect the crash and even find a nice error
> message.
>
> Even though this looks like a lot of code churn, it is actually not.
> Most added lines are new tests, and other changes are minimal.
>
> R=mstarzinger@chromium.org
>
> Bug: chromium:863799
> Change-Id: I77c58ff72db552d49014614436259ccfb49ba87b
> Reviewed-on: https://chromium-review.googlesource.com/1142163
> Commit-Queue: Clemens Hammacher <clemensh@chromium.org>
> Reviewed-by: Michael Starzinger <mstarzinger@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#54592}
Bug: chromium:863799
Change-Id: I7729a47b4823a982a8e201df36520aa2b6ef5326
Reviewed-on: https://chromium-review.googlesource.com/1146100
Reviewed-by: Michael Starzinger <mstarzinger@chromium.org>
Commit-Queue: Clemens Hammacher <clemensh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#54656}
2018-07-24 14:12:47 +00:00
|
|
|
bool IsValidAbortReason(int reason_id);
|
2015-02-27 08:03:57 +00:00
|
|
|
|
|
|
|
} // namespace internal
|
|
|
|
} // namespace v8
|
2014-09-24 07:08:27 +00:00
|
|
|
|
|
|
|
#endif // V8_BAILOUT_REASON_H_
|