[flags] Make --debug-code a build-time flag

Similar to the recent change to --code-comments, make --debug-code a
build-time enabled flag, enabled by default on debug builds.

This also removes the emit_debug_code() option from the assembler,
instead using the flag directly (there were no cases where this option
didn't match the global flag).

Change-Id: Ic26b0d37b615a055508c9dda099ffbe979eae030
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2843348
Commit-Queue: Leszek Swirski <leszeks@chromium.org>
Reviewed-by: Jakob Gruber <jgruber@chromium.org>
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Reviewed-by: Camillo Bruni <cbruni@chromium.org>
Cr-Commit-Position: refs/heads/master@{#74095}
This commit is contained in:
Leszek Swirski 2021-04-21 10:47:12 +02:00 committed by Commit Bot
parent 615255dd4e
commit 91e192889b
46 changed files with 218 additions and 217 deletions

View File

@ -103,6 +103,11 @@ declare_args() {
# Sets -dV8_CODE_COMMENTS
v8_code_comments = ""
# Allow runtime-enabled debug code (with --debug-code). Enabled by default in
# debug builds.
# Sets -dV8_ENABLE_DEBUG_CODE
v8_enable_debug_code = ""
# Enable native counters from the snapshot (impacts performance, sets
# -dV8_SNAPSHOT_NATIVE_CODE_COUNTERS).
# This option will generate extra code in the snapshot to increment counters,
@ -340,6 +345,9 @@ if (v8_enable_snapshot_code_comments) {
} else if (v8_code_comments == "") {
v8_code_comments = v8_enable_debugging_features
}
if (v8_enable_debug_code == "") {
v8_enable_debug_code = v8_enable_debugging_features
}
if (v8_check_microtasks_scopes_consistency == "") {
v8_check_microtasks_scopes_consistency =
v8_enable_debugging_features || dcheck_always_on
@ -762,6 +770,9 @@ config("features") {
if (v8_code_comments == true) {
defines += [ "V8_CODE_COMMENTS" ]
}
if (v8_enable_debug_code) {
defines += [ "V8_ENABLE_DEBUG_CODE" ]
}
if (v8_enable_snapshot_native_code_counters) {
defines += [ "V8_SNAPSHOT_NATIVE_CODE_COUNTERS" ]
}

View File

@ -151,7 +151,7 @@ void BaselineAssembler::CmpInstanceType(Register map,
InstanceType instance_type) {
ScratchRegisterScope temps(this);
Register type = temps.AcquireScratch();
if (emit_debug_code()) {
if (FLAG_debug_code) {
__ AssertNotSmi(map);
__ CompareObjectType(map, type, type, MAP_TYPE);
__ Assert(eq, AbortReason::kUnexpectedValue);

View File

@ -167,7 +167,7 @@ void BaselineAssembler::CmpInstanceType(Register map,
InstanceType instance_type) {
ScratchRegisterScope temps(this);
Register type = temps.AcquireScratch();
if (emit_debug_code()) {
if (FLAG_debug_code) {
__ AssertNotSmi(map);
__ CompareObjectType(map, type, type, MAP_TYPE);
__ Assert(eq, AbortReason::kUnexpectedValue);

View File

@ -44,7 +44,6 @@ void BaselineAssembler::GetCode(Isolate* isolate, CodeDesc* desc) {
__ GetCode(isolate, desc);
}
int BaselineAssembler::pc_offset() const { return __ pc_offset(); }
bool BaselineAssembler::emit_debug_code() const { return __ emit_debug_code(); }
void BaselineAssembler::CodeEntry() const { __ CodeEntry(); }
void BaselineAssembler::ExceptionHandler() const { __ ExceptionHandler(); }
void BaselineAssembler::RecordComment(const char* string) {

View File

@ -32,7 +32,6 @@ class BaselineAssembler {
inline void GetCode(Isolate* isolate, CodeDesc* desc);
inline int pc_offset() const;
inline bool emit_debug_code() const;
inline void CodeEntry() const;
inline void ExceptionHandler() const;
V8_INLINE void RecordComment(const char* string);

View File

@ -479,7 +479,7 @@ void BaselineCompiler::VisitSingleBytecode() {
}
void BaselineCompiler::VerifyFrame() {
if (__ emit_debug_code()) {
if (FLAG_debug_code) {
__ RecordComment("[ Verify frame");
__ RecordComment(" -- Verify frame size");
VerifyFrameSize();

View File

@ -147,7 +147,7 @@ void BaselineAssembler::CmpObjectType(Register object,
}
void BaselineAssembler::CmpInstanceType(Register map,
InstanceType instance_type) {
if (emit_debug_code()) {
if (FLAG_debug_code) {
__ movd(xmm0, eax);
__ AssertNotSmi(map);
__ CmpObjectType(map, MAP_TYPE, eax);

View File

@ -159,7 +159,7 @@ void BaselineAssembler::CmpObjectType(Register object,
}
void BaselineAssembler::CmpInstanceType(Register map,
InstanceType instance_type) {
if (emit_debug_code()) {
if (FLAG_debug_code) {
__ AssertNotSmi(map);
__ CmpObjectType(map, MAP_TYPE, kScratchRegister);
__ Assert(equal, AbortReason::kUnexpectedValue);

View File

@ -1052,7 +1052,7 @@ void Builtins::Generate_BaselineOutOfLinePrologue(MacroAssembler* masm) {
__ ldr(feedback_vector,
FieldMemOperand(closure, JSFunction::kFeedbackCellOffset));
__ ldr(feedback_vector, FieldMemOperand(feedback_vector, Cell::kValueOffset));
if (__ emit_debug_code()) {
if (FLAG_debug_code) {
UseScratchRegisterScope temps(masm);
Register scratch = temps.Acquire();
__ CompareObjectType(feedback_vector, scratch, scratch,
@ -1125,7 +1125,7 @@ void Builtins::Generate_BaselineOutOfLinePrologue(MacroAssembler* masm) {
// Baseline code frames store the feedback vector where interpreter would
// store the bytecode offset.
if (__ emit_debug_code()) {
if (FLAG_debug_code) {
UseScratchRegisterScope temps(masm);
Register scratch = temps.Acquire();
__ CompareObjectType(feedback_vector, scratch, scratch,
@ -2022,7 +2022,7 @@ void Builtins::Generate_CallOrConstructVarargs(MacroAssembler* masm,
// -----------------------------------
Register scratch = r8;
if (masm->emit_debug_code()) {
if (FLAG_debug_code) {
// Allow r2 to be a FixedArray, or a FixedDoubleArray if r4 == 0.
Label ok, fail;
__ AssertNotSmi(r2);
@ -2848,7 +2848,7 @@ void Builtins::Generate_DoubleToI(MacroAssembler* masm) {
// If we reach this code, 30 <= exponent <= 83.
// `TryInlineTruncateDoubleToI` above will have truncated any double with an
// exponent lower than 30.
if (masm->emit_debug_code()) {
if (FLAG_debug_code) {
// Scratch is exponent - 1.
__ cmp(scratch, Operand(30 - 1));
__ Check(ge, AbortReason::kUnexpectedValue);
@ -2964,7 +2964,7 @@ void CallApiFunctionAndReturn(MacroAssembler* masm, Register function_address,
// No more valid handles (the result handle was the last one). Restore
// previous handle scope.
__ str(r4, MemOperand(r9, kNextOffset));
if (__ emit_debug_code()) {
if (FLAG_debug_code) {
__ ldr(r1, MemOperand(r9, kLevelOffset));
__ cmp(r1, r6);
__ Check(eq, AbortReason::kUnexpectedLevelAfterReturnFromApiCall);

View File

@ -100,7 +100,7 @@ void Generate_JSBuiltinsConstructStubHelper(MacroAssembler* masm) {
Label already_aligned;
Register argc = x0;
if (__ emit_debug_code()) {
if (FLAG_debug_code) {
// Check that FrameScope pushed the context on to the stack already.
__ Peek(x2, 0);
__ Cmp(x2, cp);
@ -220,7 +220,7 @@ void Builtins::Generate_JSConstructStubGeneric(MacroAssembler* masm) {
__ EnterFrame(StackFrame::CONSTRUCT);
Label post_instantiation_deopt_entry, not_create_implicit_receiver;
if (__ emit_debug_code()) {
if (FLAG_debug_code) {
// Check that FrameScope pushed the context on to the stack already.
__ Peek(x2, 0);
__ Cmp(x2, cp);
@ -1000,7 +1000,7 @@ static void LeaveInterpreterFrame(MacroAssembler* masm, Register scratch1,
__ LeaveFrame(StackFrame::INTERPRETED);
// Drop receiver + arguments.
if (__ emit_debug_code()) {
if (FLAG_debug_code) {
__ Tst(params_size, kSystemPointerSize - 1);
__ Check(eq, AbortReason::kUnexpectedValue);
}
@ -1232,7 +1232,7 @@ void Builtins::Generate_BaselineOutOfLinePrologue(MacroAssembler* masm) {
FieldMemOperand(closure, JSFunction::kFeedbackCellOffset));
__ LoadTaggedPointerField(
feedback_vector, FieldMemOperand(feedback_vector, Cell::kValueOffset));
if (__ emit_debug_code()) {
if (FLAG_debug_code) {
__ CompareObjectType(feedback_vector, x4, x4, FEEDBACK_VECTOR_TYPE);
__ Assert(eq, AbortReason::kExpectedFeedbackVector);
}
@ -1290,7 +1290,7 @@ void Builtins::Generate_BaselineOutOfLinePrologue(MacroAssembler* masm) {
// Baseline code frames store the feedback vector where interpreter would
// store the bytecode offset.
if (__ emit_debug_code()) {
if (FLAG_debug_code) {
__ CompareObjectType(feedback_vector, x4, x4, FEEDBACK_VECTOR_TYPE);
__ Assert(eq, AbortReason::kExpectedFeedbackVector);
}
@ -2397,7 +2397,7 @@ void Builtins::Generate_CallOrConstructVarargs(MacroAssembler* masm,
// -- x4 : len (number of elements to push from args)
// -- x3 : new.target (for [[Construct]])
// -----------------------------------
if (masm->emit_debug_code()) {
if (FLAG_debug_code) {
// Allow x2 to be a FixedArray, or a FixedDoubleArray if x4 == 0.
Label ok, fail;
__ AssertNotSmi(x2, AbortReason::kOperandIsNotAFixedArray);
@ -3304,7 +3304,7 @@ void Builtins::Generate_DoubleToI(MacroAssembler* masm) {
// signed overflow in the int64_t target. Since we've already handled
// exponents >= 84, we can guarantee that 63 <= exponent < 84.
if (masm->emit_debug_code()) {
if (FLAG_debug_code) {
__ Cmp(exponent, HeapNumber::kExponentBias + 63);
// Exponents less than this should have been handled by the Fcvt case.
__ Check(ge, AbortReason::kUnexpectedValue);
@ -3420,7 +3420,7 @@ void CallApiFunctionAndReturn(MacroAssembler* masm, Register function_address,
// No more valid handles (the result handle was the last one). Restore
// previous handle scope.
__ Str(next_address_reg, MemOperand(handle_scope_base, kNextOffset));
if (__ emit_debug_code()) {
if (FLAG_debug_code) {
__ Ldr(w1, MemOperand(handle_scope_base, kLevelOffset));
__ Cmp(w1, level_reg);
__ Check(eq, AbortReason::kUnexpectedLevelAfterReturnFromApiCall);

View File

@ -1667,7 +1667,7 @@ void Builtins::Generate_BaselineOutOfLinePrologue(MacroAssembler* masm) {
__ mov(feedback_vector,
FieldOperand(closure, JSFunction::kFeedbackCellOffset));
__ mov(feedback_vector, FieldOperand(feedback_vector, Cell::kValueOffset));
if (__ emit_debug_code()) {
if (FLAG_debug_code) {
__ CmpObjectType(feedback_vector, FEEDBACK_VECTOR_TYPE, scratch);
__ Assert(equal, AbortReason::kExpectedFeedbackVector);
}
@ -2135,7 +2135,7 @@ void Builtins::Generate_CallOrConstructVarargs(MacroAssembler* masm,
__ pop(kArgumentsList);
__ PushReturnAddressFrom(edx);
if (masm->emit_debug_code()) {
if (FLAG_debug_code) {
// Allow kArgumentsList to be a FixedArray, or a FixedDoubleArray if
// kArgumentsLength == 0.
Label ok, fail;
@ -3155,7 +3155,7 @@ Operand ApiParameterOperand(int index) {
// stores the pointer to the reserved slot into esi.
void PrepareCallApiFunction(MacroAssembler* masm, int argc, Register scratch) {
__ EnterApiExitFrame(argc, scratch);
if (__ emit_debug_code()) {
if (FLAG_debug_code) {
__ mov(esi, Immediate(bit_cast<int32_t>(kZapValue)));
}
}

View File

@ -1757,7 +1757,7 @@ void Builtins::Generate_CallOrConstructVarargs(MacroAssembler* masm,
// -- t0 : len (number of elements to push from args)
// -- a3 : new.target (for [[Construct]])
// -----------------------------------
if (masm->emit_debug_code()) {
if (FLAG_debug_code) {
// Allow a2 to be a FixedArray, or a FixedDoubleArray if t0 == 0.
Label ok, fail;
__ AssertNotSmi(a2);
@ -2705,7 +2705,7 @@ void CallApiFunctionAndReturn(MacroAssembler* masm, Register function_address,
// No more valid handles (the result handle was the last one). Restore
// previous handle scope.
__ sw(s0, MemOperand(s5, kNextOffset));
if (__ emit_debug_code()) {
if (FLAG_debug_code) {
__ lw(a1, MemOperand(s5, kLevelOffset));
__ Check(eq, AbortReason::kUnexpectedLevelAfterReturnFromApiCall, a1,
Operand(s2));

View File

@ -1816,7 +1816,7 @@ void Builtins::Generate_CallOrConstructVarargs(MacroAssembler* masm,
// -- a4 : len (number of elements to push from args)
// -- a3 : new.target (for [[Construct]])
// -----------------------------------
if (masm->emit_debug_code()) {
if (FLAG_debug_code) {
// Allow a2 to be a FixedArray, or a FixedDoubleArray if a4 == 0.
Label ok, fail;
__ AssertNotSmi(a2);
@ -2801,7 +2801,7 @@ void CallApiFunctionAndReturn(MacroAssembler* masm, Register function_address,
// No more valid handles (the result handle was the last one). Restore
// previous handle scope.
__ Sd(s0, MemOperand(s5, kNextOffset));
if (__ emit_debug_code()) {
if (FLAG_debug_code) {
__ Lw(a1, MemOperand(s5, kLevelOffset));
__ Check(eq, AbortReason::kUnexpectedLevelAfterReturnFromApiCall, a1,
Operand(s2));

View File

@ -1861,7 +1861,7 @@ void Builtins::Generate_CallOrConstructVarargs(MacroAssembler* masm,
Register scratch = ip;
if (masm->emit_debug_code()) {
if (FLAG_debug_code) {
// Allow r5 to be a FixedArray, or a FixedDoubleArray if r7 == 0.
Label ok, fail;
__ AssertNotSmi(r5);
@ -2899,7 +2899,7 @@ static void CallApiFunctionAndReturn(MacroAssembler* masm,
// No more valid handles (the result handle was the last one). Restore
// previous handle scope.
__ StoreP(r14, MemOperand(r17, kNextOffset));
if (__ emit_debug_code()) {
if (FLAG_debug_code) {
__ lwz(r4, MemOperand(r17, kLevelOffset));
__ cmp(r4, r16);
__ Check(eq, AbortReason::kUnexpectedLevelAfterReturnFromApiCall);

View File

@ -1022,7 +1022,7 @@ void Builtins::Generate_BaselineOutOfLinePrologue(MacroAssembler* masm) {
__ Ld(feedback_vector,
FieldMemOperand(closure, JSFunction::kFeedbackCellOffset));
__ Ld(feedback_vector, FieldMemOperand(feedback_vector, Cell::kValueOffset));
if (__ emit_debug_code()) {
if (FLAG_debug_code) {
__ GetObjectType(feedback_vector, t0, t0);
__ Assert(eq, AbortReason::kExpectedFeedbackVector, t0,
Operand(FEEDBACK_VECTOR_TYPE));
@ -1080,7 +1080,7 @@ void Builtins::Generate_BaselineOutOfLinePrologue(MacroAssembler* masm) {
// Baseline code frames store the feedback vector where interpreter would
// store the bytecode offset.
if (__ emit_debug_code()) {
if (FLAG_debug_code) {
__ GetObjectType(feedback_vector, t0, t0);
__ Assert(eq, AbortReason::kExpectedFeedbackVector, t0,
Operand(FEEDBACK_VECTOR_TYPE));
@ -2051,7 +2051,7 @@ void Builtins::Generate_CallOrConstructVarargs(MacroAssembler* masm,
// -- a4 : len (number of elements to push from args)
// -- a3 : new.target (for [[Construct]])
// -----------------------------------
if (masm->emit_debug_code()) {
if (FLAG_debug_code) {
// Allow a2 to be a FixedArray, or a FixedDoubleArray if a4 == 0.
Label ok, fail;
__ AssertNotSmi(a2);
@ -3009,7 +3009,7 @@ void CallApiFunctionAndReturn(MacroAssembler* masm, Register function_address,
// No more valid handles (the result handle was the last one). Restore
// previous handle scope.
__ Sd(s3, MemOperand(s5, kNextOffset));
if (__ emit_debug_code()) {
if (FLAG_debug_code) {
__ Lw(a1, MemOperand(s5, kLevelOffset));
__ Check(eq, AbortReason::kUnexpectedLevelAfterReturnFromApiCall, a1,
Operand(s2));

View File

@ -1904,7 +1904,7 @@ void Builtins::Generate_CallOrConstructVarargs(MacroAssembler* masm,
Register scratch = ip;
if (masm->emit_debug_code()) {
if (FLAG_debug_code) {
// Allow r4 to be a FixedArray, or a FixedDoubleArray if r6 == 0.
Label ok, fail;
__ AssertNotSmi(r4);
@ -2923,7 +2923,7 @@ static void CallApiFunctionAndReturn(MacroAssembler* masm,
// No more valid handles (the result handle was the last one). Restore
// previous handle scope.
__ StoreU64(r6, MemOperand(r9, kNextOffset));
if (__ emit_debug_code()) {
if (FLAG_debug_code) {
__ LoadU32(r3, MemOperand(r9, kLevelOffset));
__ CmpS64(r3, r8);
__ Check(eq, AbortReason::kUnexpectedLevelAfterReturnFromApiCall);

View File

@ -1629,7 +1629,7 @@ void Builtins::Generate_BaselineOutOfLinePrologue(MacroAssembler* masm) {
feedback_vector, FieldOperand(closure, JSFunction::kFeedbackCellOffset));
__ LoadTaggedPointerField(feedback_vector,
FieldOperand(feedback_vector, Cell::kValueOffset));
if (__ emit_debug_code()) {
if (FLAG_debug_code) {
__ CmpObjectType(feedback_vector, FEEDBACK_VECTOR_TYPE, kScratchRegister);
__ Assert(equal, AbortReason::kExpectedFeedbackVector);
}
@ -2077,7 +2077,7 @@ void Builtins::Generate_CallOrConstructVarargs(MacroAssembler* masm,
// -----------------------------------
Register scratch = r11;
if (masm->emit_debug_code()) {
if (FLAG_debug_code) {
// Allow rbx to be a FixedArray, or a FixedDoubleArray if rcx == 0.
Label ok, fail;
__ AssertNotSmi(rbx);

View File

@ -669,7 +669,7 @@ void MacroAssembler::RecordWriteField(Register object, int offset,
// of the object, so so offset must be a multiple of kPointerSize.
DCHECK(IsAligned(offset, kPointerSize));
if (emit_debug_code()) {
if (FLAG_debug_code) {
Label ok;
UseScratchRegisterScope temps(this);
Register scratch = temps.Acquire();
@ -827,7 +827,7 @@ void MacroAssembler::RecordWrite(Register object, Operand offset,
RememberedSetAction remembered_set_action,
SmiCheck smi_check) {
DCHECK_NE(object, value);
if (emit_debug_code()) {
if (FLAG_debug_code) {
{
UseScratchRegisterScope temps(this);
Register scratch = temps.Acquire();
@ -1436,7 +1436,7 @@ void MacroAssembler::EnterExitFrame(bool save_doubles, int stack_space,
PushCommonFrame(scratch);
// Reserve room for saved entry sp.
sub(sp, fp, Operand(ExitFrameConstants::kFixedFrameSizeFromFp));
if (emit_debug_code()) {
if (FLAG_debug_code) {
mov(scratch, Operand::Zero());
str(scratch, MemOperand(fp, ExitFrameConstants::kSPOffset));
}
@ -2035,11 +2035,11 @@ void MacroAssembler::DecrementCounter(StatsCounter* counter, int value,
}
void TurboAssembler::Assert(Condition cond, AbortReason reason) {
if (emit_debug_code()) Check(cond, reason);
if (FLAG_debug_code) Check(cond, reason);
}
void TurboAssembler::AssertUnreachable(AbortReason reason) {
if (emit_debug_code()) Abort(reason);
if (FLAG_debug_code) Abort(reason);
}
void TurboAssembler::Check(Condition cond, AbortReason reason) {
@ -2144,7 +2144,7 @@ void MacroAssembler::JumpIfNotSmi(Register value, Label* not_smi_label) {
}
void MacroAssembler::AssertNotSmi(Register object) {
if (emit_debug_code()) {
if (FLAG_debug_code) {
STATIC_ASSERT(kSmiTag == 0);
tst(object, Operand(kSmiTagMask));
Check(ne, AbortReason::kOperandIsASmi);
@ -2152,7 +2152,7 @@ void MacroAssembler::AssertNotSmi(Register object) {
}
void MacroAssembler::AssertSmi(Register object) {
if (emit_debug_code()) {
if (FLAG_debug_code) {
STATIC_ASSERT(kSmiTag == 0);
tst(object, Operand(kSmiTagMask));
Check(eq, AbortReason::kOperandIsNotASmi);
@ -2160,7 +2160,7 @@ void MacroAssembler::AssertSmi(Register object) {
}
void MacroAssembler::AssertConstructor(Register object) {
if (emit_debug_code()) {
if (FLAG_debug_code) {
STATIC_ASSERT(kSmiTag == 0);
tst(object, Operand(kSmiTagMask));
Check(ne, AbortReason::kOperandIsASmiAndNotAConstructor);
@ -2174,7 +2174,7 @@ void MacroAssembler::AssertConstructor(Register object) {
}
void MacroAssembler::AssertFunction(Register object) {
if (emit_debug_code()) {
if (FLAG_debug_code) {
STATIC_ASSERT(kSmiTag == 0);
tst(object, Operand(kSmiTagMask));
Check(ne, AbortReason::kOperandIsASmiAndNotAFunction);
@ -2188,7 +2188,7 @@ void MacroAssembler::AssertFunction(Register object) {
}
void MacroAssembler::AssertBoundFunction(Register object) {
if (emit_debug_code()) {
if (FLAG_debug_code) {
STATIC_ASSERT(kSmiTag == 0);
tst(object, Operand(kSmiTagMask));
Check(ne, AbortReason::kOperandIsASmiAndNotABoundFunction);
@ -2200,7 +2200,7 @@ void MacroAssembler::AssertBoundFunction(Register object) {
}
void MacroAssembler::AssertGeneratorObject(Register object) {
if (!emit_debug_code()) return;
if (!FLAG_debug_code) return;
tst(object, Operand(kSmiTagMask));
Check(ne, AbortReason::kOperandIsASmiAndNotAGeneratorObject);
@ -2230,7 +2230,7 @@ void MacroAssembler::AssertGeneratorObject(Register object) {
void MacroAssembler::AssertUndefinedOrAllocationSite(Register object,
Register scratch) {
if (emit_debug_code()) {
if (FLAG_debug_code) {
Label done_checking;
AssertNotSmi(object);
CompareRoot(object, RootIndex::kUndefinedValue);
@ -2521,7 +2521,7 @@ void TurboAssembler::CallCFunctionHelper(Register function,
// running in the simulator. The simulator has its own alignment check which
// provides more information.
#if V8_HOST_ARCH_ARM
if (emit_debug_code()) {
if (FLAG_debug_code) {
int frame_alignment = base::OS::ActivationFrameAlignment();
int frame_alignment_mask = frame_alignment - 1;
if (frame_alignment > kPointerSize) {

View File

@ -1200,7 +1200,7 @@ void TurboAssembler::Poke(const CPURegister& src, const Operand& offset) {
if (offset.IsImmediate()) {
DCHECK_GE(offset.ImmediateValue(), 0);
} else if (emit_debug_code()) {
} else if (FLAG_debug_code) {
Cmp(xzr, offset);
Check(le, AbortReason::kStackAccessBelowStackPointer);
}
@ -1212,7 +1212,7 @@ template <TurboAssembler::LoadLRMode lr_mode>
void TurboAssembler::Peek(const CPURegister& dst, const Operand& offset) {
if (offset.IsImmediate()) {
DCHECK_GE(offset.ImmediateValue(), 0);
} else if (emit_debug_code()) {
} else if (FLAG_debug_code) {
Cmp(xzr, offset);
Check(le, AbortReason::kStackAccessBelowStackPointer);
}

View File

@ -1267,7 +1267,7 @@ void MacroAssembler::PopCalleeSavedRegisters() {
}
void TurboAssembler::AssertSpAligned() {
if (emit_debug_code()) {
if (FLAG_debug_code) {
HardAbortScope hard_abort(this); // Avoid calls to Abort.
// Arm64 requires the stack pointer to be 16-byte aligned prior to address
// calculation.
@ -1300,7 +1300,7 @@ void TurboAssembler::CopyDoubleWords(Register dst, Register src, Register count,
CopyDoubleWordsMode mode) {
DCHECK(!AreAliased(dst, src, count));
if (emit_debug_code()) {
if (FLAG_debug_code) {
Register pointer1 = dst;
Register pointer2 = src;
if (mode == kSrcLessThanDst) {
@ -1375,7 +1375,7 @@ void TurboAssembler::SlotAddress(Register dst, Register slot_offset) {
}
void TurboAssembler::AssertFPCRState(Register fpcr) {
if (emit_debug_code()) {
if (FLAG_debug_code) {
Label unexpected_mode, done;
UseScratchRegisterScope temps(this);
if (fpcr.IsNone()) {
@ -1474,7 +1474,7 @@ void TurboAssembler::Swap(VRegister lhs, VRegister rhs) {
}
void TurboAssembler::AssertSmi(Register object, AbortReason reason) {
if (emit_debug_code()) {
if (FLAG_debug_code) {
STATIC_ASSERT(kSmiTag == 0);
Tst(object, kSmiTagMask);
Check(eq, reason);
@ -1482,7 +1482,7 @@ void TurboAssembler::AssertSmi(Register object, AbortReason reason) {
}
void MacroAssembler::AssertNotSmi(Register object, AbortReason reason) {
if (emit_debug_code()) {
if (FLAG_debug_code) {
STATIC_ASSERT(kSmiTag == 0);
Tst(object, kSmiTagMask);
Check(ne, reason);
@ -1490,7 +1490,7 @@ void MacroAssembler::AssertNotSmi(Register object, AbortReason reason) {
}
void MacroAssembler::AssertConstructor(Register object) {
if (emit_debug_code()) {
if (FLAG_debug_code) {
AssertNotSmi(object, AbortReason::kOperandIsASmiAndNotAConstructor);
UseScratchRegisterScope temps(this);
@ -1505,7 +1505,7 @@ void MacroAssembler::AssertConstructor(Register object) {
}
void MacroAssembler::AssertFunction(Register object) {
if (emit_debug_code()) {
if (FLAG_debug_code) {
AssertNotSmi(object, AbortReason::kOperandIsASmiAndNotAFunction);
UseScratchRegisterScope temps(this);
@ -1518,7 +1518,7 @@ void MacroAssembler::AssertFunction(Register object) {
}
void MacroAssembler::AssertBoundFunction(Register object) {
if (emit_debug_code()) {
if (FLAG_debug_code) {
AssertNotSmi(object, AbortReason::kOperandIsASmiAndNotABoundFunction);
UseScratchRegisterScope temps(this);
@ -1530,7 +1530,7 @@ void MacroAssembler::AssertBoundFunction(Register object) {
}
void MacroAssembler::AssertGeneratorObject(Register object) {
if (!emit_debug_code()) return;
if (!FLAG_debug_code) return;
AssertNotSmi(object, AbortReason::kOperandIsASmiAndNotAGeneratorObject);
// Load map
@ -1556,7 +1556,7 @@ void MacroAssembler::AssertGeneratorObject(Register object) {
}
void MacroAssembler::AssertUndefinedOrAllocationSite(Register object) {
if (emit_debug_code()) {
if (FLAG_debug_code) {
UseScratchRegisterScope temps(this);
Register scratch = temps.AcquireX();
Label done_checking;
@ -1570,7 +1570,7 @@ void MacroAssembler::AssertUndefinedOrAllocationSite(Register object) {
}
void TurboAssembler::AssertPositiveOrZero(Register value) {
if (emit_debug_code()) {
if (FLAG_debug_code) {
Label done;
int sign_bit = value.Is64Bits() ? kXSignBit : kWSignBit;
Tbz(value, sign_bit, &done);
@ -2060,7 +2060,7 @@ void TurboAssembler::StoreReturnAddressAndCall(Register target) {
#endif
Poke(x17, 0);
if (emit_debug_code()) {
if (FLAG_debug_code) {
// Verify that the slot below fp[kSPOffset]-8 points to the signed return
// location.
Ldr(x16, MemOperand(fp, ExitFrameConstants::kSPOffset));
@ -2665,7 +2665,7 @@ void MacroAssembler::LeaveExitFrame(bool restore_doubles,
ExternalReference::Create(IsolateAddressId::kContextAddress, isolate()));
Ldr(cp, MemOperand(scratch));
if (emit_debug_code()) {
if (FLAG_debug_code) {
// Also emit debug code to clear the cp in the top frame.
Mov(scratch2, Operand(Context::kInvalidContext));
Mov(scratch, ExternalReference::Create(IsolateAddressId::kContextAddress,
@ -2913,7 +2913,7 @@ void MacroAssembler::RecordWriteField(Register object, int offset,
// of the object, so offset must be a multiple of kTaggedSize.
DCHECK(IsAligned(offset, kTaggedSize));
if (emit_debug_code()) {
if (FLAG_debug_code) {
Label ok;
UseScratchRegisterScope temps(this);
Register scratch = temps.AcquireX();
@ -3070,7 +3070,7 @@ void MacroAssembler::RecordWrite(Register object, Operand offset,
ASM_LOCATION_IN_ASSEMBLER("MacroAssembler::RecordWrite");
DCHECK(!AreAliased(object, value));
if (emit_debug_code()) {
if (FLAG_debug_code) {
UseScratchRegisterScope temps(this);
Register temp = temps.AcquireX();
@ -3113,13 +3113,13 @@ void MacroAssembler::RecordWrite(Register object, Operand offset,
}
void TurboAssembler::Assert(Condition cond, AbortReason reason) {
if (emit_debug_code()) {
if (FLAG_debug_code) {
Check(cond, reason);
}
}
void TurboAssembler::AssertUnreachable(AbortReason reason) {
if (emit_debug_code()) Abort(reason);
if (FLAG_debug_code) Abort(reason);
}
void TurboAssembler::Check(Condition cond, AbortReason reason) {

View File

@ -180,7 +180,6 @@ AssemblerBase::AssemblerBase(const AssemblerOptions& options,
: buffer_(std::move(buffer)),
options_(options),
enabled_cpu_features_(0),
emit_debug_code_(FLAG_debug_code),
predictable_code_size_(false),
constant_pool_available_(false),
jump_optimization_info_(nullptr) {

View File

@ -222,9 +222,6 @@ class V8_EXPORT_PRIVATE AssemblerBase : public Malloced {
const AssemblerOptions& options() const { return options_; }
bool emit_debug_code() const { return emit_debug_code_; }
void set_emit_debug_code(bool value) { emit_debug_code_ = value; }
bool predictable_code_size() const { return predictable_code_size_; }
void set_predictable_code_size(bool value) { predictable_code_size_ = value; }
@ -349,7 +346,7 @@ class V8_EXPORT_PRIVATE AssemblerBase : public Malloced {
DCHECK(!RelocInfo::IsNone(rmode));
if (options().disable_reloc_info_for_patching) return false;
if (RelocInfo::IsOnlyForSerializer(rmode) &&
!options().record_reloc_info_for_serialization && !emit_debug_code()) {
!options().record_reloc_info_for_serialization && !FLAG_debug_code) {
return false;
}
return true;
@ -381,7 +378,6 @@ class V8_EXPORT_PRIVATE AssemblerBase : public Malloced {
const AssemblerOptions options_;
uint64_t enabled_cpu_features_;
bool emit_debug_code_;
bool predictable_code_size_;
// Indicates whether the constant pool can be accessed, which is only possible
@ -395,20 +391,6 @@ class V8_EXPORT_PRIVATE AssemblerBase : public Malloced {
friend class ConstantPoolUnavailableScope;
};
// Avoids emitting debug code during the lifetime of this scope object.
class V8_NODISCARD DontEmitDebugCodeScope {
public:
explicit DontEmitDebugCodeScope(AssemblerBase* assembler)
: assembler_(assembler), old_value_(assembler->emit_debug_code()) {
assembler_->set_emit_debug_code(false);
}
~DontEmitDebugCodeScope() { assembler_->set_emit_debug_code(old_value_); }
private:
AssemblerBase* assembler_;
bool old_value_;
};
// Enable a specified feature within a scope.
class V8_EXPORT_PRIVATE V8_NODISCARD CpuFeatureScope {
public:

View File

@ -374,7 +374,7 @@ void MacroAssembler::RecordWriteField(Register object, int offset,
DCHECK(IsAligned(offset, kTaggedSize));
lea(dst, FieldOperand(object, offset));
if (emit_debug_code()) {
if (FLAG_debug_code) {
Label ok;
test_b(dst, Immediate(kTaggedSize - 1));
j(zero, &ok, Label::kNear);
@ -389,7 +389,7 @@ void MacroAssembler::RecordWriteField(Register object, int offset,
// Clobber clobbered input registers when running with the debug-code flag
// turned on to provoke errors.
if (emit_debug_code()) {
if (FLAG_debug_code) {
mov(value, Immediate(bit_cast<int32_t>(kZapValue)));
mov(dst, Immediate(bit_cast<int32_t>(kZapValue)));
}
@ -517,7 +517,7 @@ void MacroAssembler::RecordWrite(Register object, Register address,
return;
}
if (emit_debug_code()) {
if (FLAG_debug_code) {
Label ok;
cmp(value, Operand(address, 0));
j(equal, &ok, Label::kNear);
@ -549,7 +549,7 @@ void MacroAssembler::RecordWrite(Register object, Register address,
// Clobber clobbered registers when running with the debug-code flag
// turned on to provoke errors.
if (emit_debug_code()) {
if (FLAG_debug_code) {
mov(address, Immediate(bit_cast<int32_t>(kZapValue)));
mov(value, Immediate(bit_cast<int32_t>(kZapValue)));
}
@ -1029,14 +1029,14 @@ void MacroAssembler::CmpInstanceTypeRange(Register map, Register scratch,
}
void MacroAssembler::AssertSmi(Register object) {
if (emit_debug_code()) {
if (FLAG_debug_code) {
test(object, Immediate(kSmiTagMask));
Check(equal, AbortReason::kOperandIsNotASmi);
}
}
void MacroAssembler::AssertConstructor(Register object) {
if (emit_debug_code()) {
if (FLAG_debug_code) {
test(object, Immediate(kSmiTagMask));
Check(not_equal, AbortReason::kOperandIsASmiAndNotAConstructor);
Push(object);
@ -1049,7 +1049,7 @@ void MacroAssembler::AssertConstructor(Register object) {
}
void MacroAssembler::AssertFunction(Register object, Register scratch) {
if (emit_debug_code()) {
if (FLAG_debug_code) {
test(object, Immediate(kSmiTagMask));
Check(not_equal, AbortReason::kOperandIsASmiAndNotAFunction);
Push(object);
@ -1062,7 +1062,7 @@ void MacroAssembler::AssertFunction(Register object, Register scratch) {
}
void MacroAssembler::AssertBoundFunction(Register object) {
if (emit_debug_code()) {
if (FLAG_debug_code) {
test(object, Immediate(kSmiTagMask));
Check(not_equal, AbortReason::kOperandIsASmiAndNotABoundFunction);
Push(object);
@ -1073,7 +1073,7 @@ void MacroAssembler::AssertBoundFunction(Register object) {
}
void MacroAssembler::AssertGeneratorObject(Register object) {
if (!emit_debug_code()) return;
if (!FLAG_debug_code) return;
test(object, Immediate(kSmiTagMask));
Check(not_equal, AbortReason::kOperandIsASmiAndNotAGeneratorObject);
@ -1105,7 +1105,7 @@ void MacroAssembler::AssertGeneratorObject(Register object) {
void MacroAssembler::AssertUndefinedOrAllocationSite(Register object,
Register scratch) {
if (emit_debug_code()) {
if (FLAG_debug_code) {
Label done_checking;
AssertNotSmi(object);
CompareRoot(object, scratch, RootIndex::kUndefinedValue);
@ -1118,7 +1118,7 @@ void MacroAssembler::AssertUndefinedOrAllocationSite(Register object,
}
void MacroAssembler::AssertNotSmi(Register object) {
if (emit_debug_code()) {
if (FLAG_debug_code) {
test(object, Immediate(kSmiTagMask));
Check(not_equal, AbortReason::kOperandIsASmi);
}
@ -1147,7 +1147,7 @@ void TurboAssembler::EnterFrame(StackFrame::Type type) {
}
void TurboAssembler::LeaveFrame(StackFrame::Type type) {
if (emit_debug_code() && !StackFrame::IsJavaScript(type)) {
if (FLAG_debug_code && !StackFrame::IsJavaScript(type)) {
cmp(Operand(ebp, CommonFrameConstants::kContextOrFrameTypeOffset),
Immediate(StackFrame::TypeToMarker(type)));
Check(equal, AbortReason::kStackFrameTypesMustMatch);
@ -2038,11 +2038,11 @@ void MacroAssembler::DecrementCounter(StatsCounter* counter, int value,
}
void TurboAssembler::Assert(Condition cc, AbortReason reason) {
if (emit_debug_code()) Check(cc, reason);
if (FLAG_debug_code) Check(cc, reason);
}
void TurboAssembler::AssertUnreachable(AbortReason reason) {
if (emit_debug_code()) Abort(reason);
if (FLAG_debug_code) Abort(reason);
}
void TurboAssembler::Check(Condition cc, AbortReason reason) {
@ -2130,7 +2130,7 @@ void TurboAssembler::CallCFunction(Register function, int num_arguments) {
DCHECK_LE(num_arguments, kMaxCParameters);
DCHECK(has_frame());
// Check stack alignment.
if (emit_debug_code()) {
if (FLAG_debug_code) {
CheckStackAlignment();
}

View File

@ -189,7 +189,7 @@ void MacroAssembler::RecordWriteField(Register object, int offset,
DCHECK(IsAligned(offset, kPointerSize));
Addu(dst, object, Operand(offset - kHeapObjectTag));
if (emit_debug_code()) {
if (FLAG_debug_code) {
BlockTrampolinePoolScope block_trampoline_pool(this);
Label ok;
And(t8, dst, Operand(kPointerSize - 1));
@ -205,7 +205,7 @@ void MacroAssembler::RecordWriteField(Register object, int offset,
// Clobber clobbered input registers when running with the debug-code flag
// turned on to provoke errors.
if (emit_debug_code()) {
if (FLAG_debug_code) {
li(value, Operand(bit_cast<int32_t>(kZapValue + 4)));
li(dst, Operand(bit_cast<int32_t>(kZapValue + 8)));
}
@ -337,7 +337,7 @@ void MacroAssembler::RecordWrite(Register object, Register address,
DCHECK(!AreAliased(object, address, value, t8));
DCHECK(!AreAliased(object, address, value, t9));
if (emit_debug_code()) {
if (FLAG_debug_code) {
UseScratchRegisterScope temps(this);
Register scratch = temps.Acquire();
lw(scratch, MemOperand(address));
@ -380,7 +380,7 @@ void MacroAssembler::RecordWrite(Register object, Register address,
// Clobber clobbered registers when running with the debug-code flag
// turned on to provoke errors.
if (emit_debug_code()) {
if (FLAG_debug_code) {
li(address, Operand(bit_cast<int32_t>(kZapValue + 12)));
li(value, Operand(bit_cast<int32_t>(kZapValue + 16)));
}
@ -4747,7 +4747,7 @@ void TurboAssembler::DebugBreak() { stop(); }
void TurboAssembler::Assert(Condition cc, AbortReason reason, Register rs,
Operand rt) {
if (emit_debug_code()) Check(cc, reason, rs, rt);
if (FLAG_debug_code) Check(cc, reason, rs, rt);
}
void TurboAssembler::Check(Condition cc, AbortReason reason, Register rs,
@ -4886,7 +4886,7 @@ void MacroAssembler::EnterExitFrame(bool save_doubles, int stack_space,
// Set up new frame pointer.
addiu(fp, sp, ExitFrameConstants::kFixedFrameSizeFromFp);
if (emit_debug_code()) {
if (FLAG_debug_code) {
sw(zero_reg, MemOperand(fp, ExitFrameConstants::kSPOffset));
}
@ -5000,7 +5000,7 @@ int TurboAssembler::ActivationFrameAlignment() {
}
void MacroAssembler::AssertStackIsAligned() {
if (emit_debug_code()) {
if (FLAG_debug_code) {
const int frame_alignment = ActivationFrameAlignment();
const int frame_alignment_mask = frame_alignment - 1;
@ -5033,7 +5033,7 @@ void MacroAssembler::JumpIfNotSmi(Register value, Label* not_smi_label,
}
void MacroAssembler::AssertNotSmi(Register object) {
if (emit_debug_code()) {
if (FLAG_debug_code) {
STATIC_ASSERT(kSmiTag == 0);
UseScratchRegisterScope temps(this);
Register scratch = temps.Acquire();
@ -5043,7 +5043,7 @@ void MacroAssembler::AssertNotSmi(Register object) {
}
void MacroAssembler::AssertSmi(Register object) {
if (emit_debug_code()) {
if (FLAG_debug_code) {
STATIC_ASSERT(kSmiTag == 0);
UseScratchRegisterScope temps(this);
Register scratch = temps.Acquire();
@ -5053,7 +5053,7 @@ void MacroAssembler::AssertSmi(Register object) {
}
void MacroAssembler::AssertConstructor(Register object) {
if (emit_debug_code()) {
if (FLAG_debug_code) {
BlockTrampolinePoolScope block_trampoline_pool(this);
STATIC_ASSERT(kSmiTag == 0);
SmiTst(object, t8);
@ -5068,7 +5068,7 @@ void MacroAssembler::AssertConstructor(Register object) {
}
void MacroAssembler::AssertFunction(Register object) {
if (emit_debug_code()) {
if (FLAG_debug_code) {
BlockTrampolinePoolScope block_trampoline_pool(this);
STATIC_ASSERT(kSmiTag == 0);
SmiTst(object, t8);
@ -5084,7 +5084,7 @@ void MacroAssembler::AssertFunction(Register object) {
}
void MacroAssembler::AssertBoundFunction(Register object) {
if (emit_debug_code()) {
if (FLAG_debug_code) {
BlockTrampolinePoolScope block_trampoline_pool(this);
STATIC_ASSERT(kSmiTag == 0);
SmiTst(object, t8);
@ -5097,7 +5097,7 @@ void MacroAssembler::AssertBoundFunction(Register object) {
}
void MacroAssembler::AssertGeneratorObject(Register object) {
if (!emit_debug_code()) return;
if (!FLAG_debug_code) return;
BlockTrampolinePoolScope block_trampoline_pool(this);
STATIC_ASSERT(kSmiTag == 0);
SmiTst(object, t8);
@ -5124,7 +5124,7 @@ void MacroAssembler::AssertGeneratorObject(Register object) {
void MacroAssembler::AssertUndefinedOrAllocationSite(Register object,
Register scratch) {
if (emit_debug_code()) {
if (FLAG_debug_code) {
Label done_checking;
AssertNotSmi(object);
LoadRoot(scratch, RootIndex::kUndefinedValue);
@ -5417,7 +5417,7 @@ void TurboAssembler::CallCFunctionHelper(Register function_base,
// PrepareCallCFunction. The C function must be called via t9, for mips ABI.
#if V8_HOST_ARCH_MIPS
if (emit_debug_code()) {
if (FLAG_debug_code) {
int frame_alignment = base::OS::ActivationFrameAlignment();
int frame_alignment_mask = frame_alignment - 1;
if (frame_alignment > kPointerSize) {

View File

@ -187,7 +187,7 @@ void MacroAssembler::RecordWriteField(Register object, int offset,
DCHECK(IsAligned(offset, kPointerSize));
Daddu(dst, object, Operand(offset - kHeapObjectTag));
if (emit_debug_code()) {
if (FLAG_debug_code) {
BlockTrampolinePoolScope block_trampoline_pool(this);
Label ok;
And(t8, dst, Operand(kPointerSize - 1));
@ -203,7 +203,7 @@ void MacroAssembler::RecordWriteField(Register object, int offset,
// Clobber clobbered input registers when running with the debug-code flag
// turned on to provoke errors.
if (emit_debug_code()) {
if (FLAG_debug_code) {
li(value, Operand(bit_cast<int64_t>(kZapValue + 4)));
li(dst, Operand(bit_cast<int64_t>(kZapValue + 8)));
}
@ -335,7 +335,7 @@ void MacroAssembler::RecordWrite(Register object, Register address,
DCHECK(!AreAliased(object, address, value, t8));
DCHECK(!AreAliased(object, address, value, t9));
if (emit_debug_code()) {
if (FLAG_debug_code) {
UseScratchRegisterScope temps(this);
Register scratch = temps.Acquire();
Ld(scratch, MemOperand(address));
@ -378,7 +378,7 @@ void MacroAssembler::RecordWrite(Register object, Register address,
// Clobber clobbered registers when running with the debug-code flag
// turned on to provoke errors.
if (emit_debug_code()) {
if (FLAG_debug_code) {
li(address, Operand(bit_cast<int64_t>(kZapValue + 12)));
li(value, Operand(bit_cast<int64_t>(kZapValue + 16)));
}
@ -5268,7 +5268,7 @@ void TurboAssembler::DebugBreak() { stop(); }
void TurboAssembler::Assert(Condition cc, AbortReason reason, Register rs,
Operand rt) {
if (emit_debug_code()) Check(cc, reason, rs, rt);
if (FLAG_debug_code) Check(cc, reason, rs, rt);
}
void TurboAssembler::Check(Condition cc, AbortReason reason, Register rs,
@ -5406,7 +5406,7 @@ void MacroAssembler::EnterExitFrame(bool save_doubles, int stack_space,
// Set up new frame pointer.
daddiu(fp, sp, ExitFrameConstants::kFixedFrameSizeFromFp);
if (emit_debug_code()) {
if (FLAG_debug_code) {
Sd(zero_reg, MemOperand(fp, ExitFrameConstants::kSPOffset));
}
@ -5522,7 +5522,7 @@ int TurboAssembler::ActivationFrameAlignment() {
}
void MacroAssembler::AssertStackIsAligned() {
if (emit_debug_code()) {
if (FLAG_debug_code) {
const int frame_alignment = ActivationFrameAlignment();
const int frame_alignment_mask = frame_alignment - 1;
@ -5567,7 +5567,7 @@ void MacroAssembler::JumpIfNotSmi(Register value, Label* not_smi_label,
}
void MacroAssembler::AssertNotSmi(Register object) {
if (emit_debug_code()) {
if (FLAG_debug_code) {
STATIC_ASSERT(kSmiTag == 0);
UseScratchRegisterScope temps(this);
Register scratch = temps.Acquire();
@ -5577,7 +5577,7 @@ void MacroAssembler::AssertNotSmi(Register object) {
}
void MacroAssembler::AssertSmi(Register object) {
if (emit_debug_code()) {
if (FLAG_debug_code) {
STATIC_ASSERT(kSmiTag == 0);
UseScratchRegisterScope temps(this);
Register scratch = temps.Acquire();
@ -5587,7 +5587,7 @@ void MacroAssembler::AssertSmi(Register object) {
}
void MacroAssembler::AssertConstructor(Register object) {
if (emit_debug_code()) {
if (FLAG_debug_code) {
BlockTrampolinePoolScope block_trampoline_pool(this);
STATIC_ASSERT(kSmiTag == 0);
SmiTst(object, t8);
@ -5602,7 +5602,7 @@ void MacroAssembler::AssertConstructor(Register object) {
}
void MacroAssembler::AssertFunction(Register object) {
if (emit_debug_code()) {
if (FLAG_debug_code) {
BlockTrampolinePoolScope block_trampoline_pool(this);
STATIC_ASSERT(kSmiTag == 0);
SmiTst(object, t8);
@ -5618,7 +5618,7 @@ void MacroAssembler::AssertFunction(Register object) {
}
void MacroAssembler::AssertBoundFunction(Register object) {
if (emit_debug_code()) {
if (FLAG_debug_code) {
BlockTrampolinePoolScope block_trampoline_pool(this);
STATIC_ASSERT(kSmiTag == 0);
SmiTst(object, t8);
@ -5631,7 +5631,7 @@ void MacroAssembler::AssertBoundFunction(Register object) {
}
void MacroAssembler::AssertGeneratorObject(Register object) {
if (!emit_debug_code()) return;
if (!FLAG_debug_code) return;
BlockTrampolinePoolScope block_trampoline_pool(this);
STATIC_ASSERT(kSmiTag == 0);
SmiTst(object, t8);
@ -5658,7 +5658,7 @@ void MacroAssembler::AssertGeneratorObject(Register object) {
void MacroAssembler::AssertUndefinedOrAllocationSite(Register object,
Register scratch) {
if (emit_debug_code()) {
if (FLAG_debug_code) {
Label done_checking;
AssertNotSmi(object);
LoadRoot(scratch, RootIndex::kUndefinedValue);
@ -5950,7 +5950,7 @@ void TurboAssembler::CallCFunctionHelper(Register function,
// PrepareCallCFunction. The C function must be called via t9, for mips ABI.
#if V8_HOST_ARCH_MIPS || V8_HOST_ARCH_MIPS64
if (emit_debug_code()) {
if (FLAG_debug_code) {
int frame_alignment = base::OS::ActivationFrameAlignment();
int frame_alignment_mask = frame_alignment - 1;
if (frame_alignment > kPointerSize) {

View File

@ -607,7 +607,7 @@ void MacroAssembler::RecordWriteField(Register object, int offset,
DCHECK(IsAligned(offset, kTaggedSize));
Add(dst, object, offset - kHeapObjectTag, r0);
if (emit_debug_code()) {
if (FLAG_debug_code) {
Label ok;
andi(r0, dst, Operand(kTaggedSize - 1));
beq(&ok, cr0);
@ -622,7 +622,7 @@ void MacroAssembler::RecordWriteField(Register object, int offset,
// Clobber clobbered input registers when running with the debug-code flag
// turned on to provoke errors.
if (emit_debug_code()) {
if (FLAG_debug_code) {
mov(value, Operand(bit_cast<intptr_t>(kZapValue + 4)));
mov(dst, Operand(bit_cast<intptr_t>(kZapValue + 8)));
}
@ -753,7 +753,7 @@ void MacroAssembler::RecordWrite(Register object, Register address,
RememberedSetAction remembered_set_action,
SmiCheck smi_check) {
DCHECK(object != value);
if (emit_debug_code()) {
if (FLAG_debug_code) {
LoadTaggedPointerField(r0, MemOperand(address));
cmp(r0, value);
Check(eq, AbortReason::kWrongAddressOrValuePassedToRecordWrite);
@ -795,7 +795,7 @@ void MacroAssembler::RecordWrite(Register object, Register address,
// Clobber clobbered registers when running with the debug-code flag
// turned on to provoke errors.
if (emit_debug_code()) {
if (FLAG_debug_code) {
mov(address, Operand(bit_cast<intptr_t>(kZapValue + 12)));
mov(value, Operand(bit_cast<intptr_t>(kZapValue + 16)));
}
@ -1222,7 +1222,7 @@ void MacroAssembler::EnterExitFrame(bool save_doubles, int stack_space,
// Reserve room for saved entry sp.
subi(sp, fp, Operand(ExitFrameConstants::kFixedFrameSizeFromFp));
if (emit_debug_code()) {
if (FLAG_debug_code) {
li(r8, Operand::Zero());
StoreP(r8, MemOperand(fp, ExitFrameConstants::kSPOffset));
}
@ -1922,7 +1922,7 @@ void MacroAssembler::DecrementCounter(StatsCounter* counter, int value,
}
void TurboAssembler::Assert(Condition cond, AbortReason reason, CRegister cr) {
if (emit_debug_code()) Check(cond, reason, cr);
if (FLAG_debug_code) Check(cond, reason, cr);
}
void TurboAssembler::Check(Condition cond, AbortReason reason, CRegister cr) {
@ -1985,7 +1985,7 @@ void MacroAssembler::LoadNativeContextSlot(Register dst, int index) {
}
void MacroAssembler::AssertNotSmi(Register object) {
if (emit_debug_code()) {
if (FLAG_debug_code) {
STATIC_ASSERT(kSmiTag == 0);
TestIfSmi(object, r0);
Check(ne, AbortReason::kOperandIsASmi, cr0);
@ -1993,7 +1993,7 @@ void MacroAssembler::AssertNotSmi(Register object) {
}
void MacroAssembler::AssertSmi(Register object) {
if (emit_debug_code()) {
if (FLAG_debug_code) {
STATIC_ASSERT(kSmiTag == 0);
TestIfSmi(object, r0);
Check(eq, AbortReason::kOperandIsNotASmi, cr0);
@ -2001,7 +2001,7 @@ void MacroAssembler::AssertSmi(Register object) {
}
void MacroAssembler::AssertConstructor(Register object) {
if (emit_debug_code()) {
if (FLAG_debug_code) {
STATIC_ASSERT(kSmiTag == 0);
TestIfSmi(object, r0);
Check(ne, AbortReason::kOperandIsASmiAndNotAConstructor, cr0);
@ -2015,7 +2015,7 @@ void MacroAssembler::AssertConstructor(Register object) {
}
void MacroAssembler::AssertFunction(Register object) {
if (emit_debug_code()) {
if (FLAG_debug_code) {
STATIC_ASSERT(kSmiTag == 0);
TestIfSmi(object, r0);
Check(ne, AbortReason::kOperandIsASmiAndNotAFunction, cr0);
@ -2029,7 +2029,7 @@ void MacroAssembler::AssertFunction(Register object) {
}
void MacroAssembler::AssertBoundFunction(Register object) {
if (emit_debug_code()) {
if (FLAG_debug_code) {
STATIC_ASSERT(kSmiTag == 0);
TestIfSmi(object, r0);
Check(ne, AbortReason::kOperandIsASmiAndNotABoundFunction, cr0);
@ -2041,7 +2041,7 @@ void MacroAssembler::AssertBoundFunction(Register object) {
}
void MacroAssembler::AssertGeneratorObject(Register object) {
if (!emit_debug_code()) return;
if (!FLAG_debug_code) return;
TestIfSmi(object, r0);
Check(ne, AbortReason::kOperandIsASmiAndNotAGeneratorObject, cr0);
@ -2071,7 +2071,7 @@ void MacroAssembler::AssertGeneratorObject(Register object) {
void MacroAssembler::AssertUndefinedOrAllocationSite(Register object,
Register scratch) {
if (emit_debug_code()) {
if (FLAG_debug_code) {
Label done_checking;
AssertNotSmi(object);
CompareRoot(object, RootIndex::kUndefinedValue);

View File

@ -184,7 +184,7 @@ void MacroAssembler::RecordWriteField(Register object, int offset,
DCHECK(IsAligned(offset, kPointerSize));
Add64(dst, object, Operand(offset - kHeapObjectTag));
if (emit_debug_code()) {
if (FLAG_debug_code) {
UseScratchRegisterScope temps(this);
Register scratch = temps.Acquire();
BlockTrampolinePoolScope block_trampoline_pool(this);
@ -203,7 +203,7 @@ void MacroAssembler::RecordWriteField(Register object, int offset,
// Clobber clobbered input registers when running with the debug-code flag
// turned on to provoke errors.
if (emit_debug_code()) {
if (FLAG_debug_code) {
li(value, Operand(bit_cast<int64_t>(kZapValue + 4)));
li(dst, Operand(bit_cast<int64_t>(kZapValue + 8)));
}
@ -336,7 +336,7 @@ void MacroAssembler::RecordWrite(Register object, Register address,
SaveFPRegsMode fp_mode,
RememberedSetAction remembered_set_action,
SmiCheck smi_check) {
if (emit_debug_code()) {
if (FLAG_debug_code) {
DCHECK(!AreAliased(object, address, value, kScratchReg));
Ld(kScratchReg, MemOperand(address));
Assert(eq, AbortReason::kWrongAddressOrValuePassedToRecordWrite,
@ -378,7 +378,7 @@ void MacroAssembler::RecordWrite(Register object, Register address,
// Clobber clobbered registers when running with the debug-code flag
// turned on to provoke errors.
if (emit_debug_code()) {
if (FLAG_debug_code) {
li(address, Operand(bit_cast<int64_t>(kZapValue + 12)));
li(value, Operand(bit_cast<int64_t>(kZapValue + 16)));
}
@ -3889,7 +3889,7 @@ void TurboAssembler::DebugBreak() { stop(); }
void TurboAssembler::Assert(Condition cc, AbortReason reason, Register rs,
Operand rt) {
if (emit_debug_code()) Check(cc, reason, rs, rt);
if (FLAG_debug_code) Check(cc, reason, rs, rt);
}
void TurboAssembler::Check(Condition cc, AbortReason reason, Register rs,
@ -4022,7 +4022,7 @@ void MacroAssembler::EnterExitFrame(bool save_doubles, int stack_space,
// Set up new frame pointer.
addi(fp, sp, ExitFrameConstants::kFixedFrameSizeFromFp);
if (emit_debug_code()) {
if (FLAG_debug_code) {
Sd(zero_reg, MemOperand(fp, ExitFrameConstants::kSPOffset));
}
@ -4141,7 +4141,7 @@ int TurboAssembler::ActivationFrameAlignment() {
}
void MacroAssembler::AssertStackIsAligned() {
if (emit_debug_code()) {
if (FLAG_debug_code) {
const int frame_alignment = ActivationFrameAlignment();
const int frame_alignment_mask = frame_alignment - 1;
@ -4188,7 +4188,7 @@ void MacroAssembler::JumpIfNotSmi(Register value, Label* not_smi_label) {
}
void MacroAssembler::AssertNotSmi(Register object) {
if (emit_debug_code()) {
if (FLAG_debug_code) {
STATIC_ASSERT(kSmiTag == 0);
DCHECK(object != kScratchReg);
andi(kScratchReg, object, kSmiTagMask);
@ -4197,7 +4197,7 @@ void MacroAssembler::AssertNotSmi(Register object) {
}
void MacroAssembler::AssertSmi(Register object) {
if (emit_debug_code()) {
if (FLAG_debug_code) {
STATIC_ASSERT(kSmiTag == 0);
DCHECK(object != kScratchReg);
andi(kScratchReg, object, kSmiTagMask);
@ -4206,7 +4206,7 @@ void MacroAssembler::AssertSmi(Register object) {
}
void MacroAssembler::AssertConstructor(Register object) {
if (emit_debug_code()) {
if (FLAG_debug_code) {
DCHECK(object != kScratchReg);
BlockTrampolinePoolScope block_trampoline_pool(this);
STATIC_ASSERT(kSmiTag == 0);
@ -4223,7 +4223,7 @@ void MacroAssembler::AssertConstructor(Register object) {
}
void MacroAssembler::AssertFunction(Register object) {
if (emit_debug_code()) {
if (FLAG_debug_code) {
BlockTrampolinePoolScope block_trampoline_pool(this);
STATIC_ASSERT(kSmiTag == 0);
DCHECK(object != kScratchReg);
@ -4240,7 +4240,7 @@ void MacroAssembler::AssertFunction(Register object) {
}
void MacroAssembler::AssertBoundFunction(Register object) {
if (emit_debug_code()) {
if (FLAG_debug_code) {
BlockTrampolinePoolScope block_trampoline_pool(this);
STATIC_ASSERT(kSmiTag == 0);
DCHECK(object != kScratchReg);
@ -4254,7 +4254,7 @@ void MacroAssembler::AssertBoundFunction(Register object) {
}
void MacroAssembler::AssertGeneratorObject(Register object) {
if (!emit_debug_code()) return;
if (!FLAG_debug_code) return;
BlockTrampolinePoolScope block_trampoline_pool(this);
STATIC_ASSERT(kSmiTag == 0);
DCHECK(object != kScratchReg);
@ -4282,7 +4282,7 @@ void MacroAssembler::AssertGeneratorObject(Register object) {
void MacroAssembler::AssertUndefinedOrAllocationSite(Register object,
Register scratch) {
if (emit_debug_code()) {
if (FLAG_debug_code) {
Label done_checking;
AssertNotSmi(object);
LoadRoot(scratch, RootIndex::kUndefinedValue);
@ -4452,7 +4452,7 @@ void TurboAssembler::CallCFunctionHelper(Register function,
// PrepareCallCFunction.
#if V8_HOST_ARCH_RISCV64
if (emit_debug_code()) {
if (FLAG_debug_code) {
int frame_alignment = base::OS::ActivationFrameAlignment();
int frame_alignment_mask = frame_alignment - 1;
if (frame_alignment > kPointerSize) {

View File

@ -824,7 +824,7 @@ void MacroAssembler::RecordWriteField(Register object, int offset,
DCHECK(IsAligned(offset, kTaggedSize));
lay(dst, MemOperand(object, offset - kHeapObjectTag));
if (emit_debug_code()) {
if (FLAG_debug_code) {
Label ok;
AndP(r0, dst, Operand(kTaggedSize - 1));
beq(&ok, Label::kNear);
@ -839,7 +839,7 @@ void MacroAssembler::RecordWriteField(Register object, int offset,
// Clobber clobbered input registers when running with the debug-code flag
// turned on to provoke errors.
if (emit_debug_code()) {
if (FLAG_debug_code) {
mov(value, Operand(bit_cast<intptr_t>(kZapValue + 4)));
mov(dst, Operand(bit_cast<intptr_t>(kZapValue + 8)));
}
@ -967,7 +967,7 @@ void MacroAssembler::RecordWrite(Register object, Register address,
RememberedSetAction remembered_set_action,
SmiCheck smi_check) {
DCHECK(object != value);
if (emit_debug_code()) {
if (FLAG_debug_code) {
LoadTaggedPointerField(r0, MemOperand(address));
CmpS64(value, r0);
Check(eq, AbortReason::kWrongAddressOrValuePassedToRecordWrite);
@ -1006,7 +1006,7 @@ void MacroAssembler::RecordWrite(Register object, Register address,
// Clobber clobbered registers when running with the debug-code flag
// turned on to provoke errors.
if (emit_debug_code()) {
if (FLAG_debug_code) {
mov(address, Operand(bit_cast<intptr_t>(kZapValue + 12)));
mov(value, Operand(bit_cast<intptr_t>(kZapValue + 16)));
}
@ -1408,7 +1408,7 @@ void MacroAssembler::EnterExitFrame(bool save_doubles, int stack_space,
// Reserve room for saved entry sp.
lay(sp, MemOperand(fp, -ExitFrameConstants::kFixedFrameSizeFromFp));
if (emit_debug_code()) {
if (FLAG_debug_code) {
StoreU64(MemOperand(fp, ExitFrameConstants::kSPOffset), Operand::Zero(),
r1);
}
@ -2003,11 +2003,11 @@ void MacroAssembler::DecrementCounter(StatsCounter* counter, int value,
}
void TurboAssembler::Assert(Condition cond, AbortReason reason, CRegister cr) {
if (emit_debug_code()) Check(cond, reason, cr);
if (FLAG_debug_code) Check(cond, reason, cr);
}
void TurboAssembler::AssertUnreachable(AbortReason reason) {
if (emit_debug_code()) Abort(reason);
if (FLAG_debug_code) Abort(reason);
}
void TurboAssembler::Check(Condition cond, AbortReason reason, CRegister cr) {
@ -2073,7 +2073,7 @@ void MacroAssembler::LoadNativeContextSlot(Register dst, int index) {
}
void MacroAssembler::AssertNotSmi(Register object) {
if (emit_debug_code()) {
if (FLAG_debug_code) {
STATIC_ASSERT(kSmiTag == 0);
TestIfSmi(object);
Check(ne, AbortReason::kOperandIsASmi, cr0);
@ -2081,7 +2081,7 @@ void MacroAssembler::AssertNotSmi(Register object) {
}
void MacroAssembler::AssertSmi(Register object) {
if (emit_debug_code()) {
if (FLAG_debug_code) {
STATIC_ASSERT(kSmiTag == 0);
TestIfSmi(object);
Check(eq, AbortReason::kOperandIsNotASmi, cr0);
@ -2089,7 +2089,7 @@ void MacroAssembler::AssertSmi(Register object) {
}
void MacroAssembler::AssertConstructor(Register object, Register scratch) {
if (emit_debug_code()) {
if (FLAG_debug_code) {
STATIC_ASSERT(kSmiTag == 0);
TestIfSmi(object);
Check(ne, AbortReason::kOperandIsASmiAndNotAConstructor);
@ -2101,7 +2101,7 @@ void MacroAssembler::AssertConstructor(Register object, Register scratch) {
}
void MacroAssembler::AssertFunction(Register object) {
if (emit_debug_code()) {
if (FLAG_debug_code) {
STATIC_ASSERT(kSmiTag == 0);
TestIfSmi(object);
Check(ne, AbortReason::kOperandIsASmiAndNotAFunction, cr0);
@ -2115,7 +2115,7 @@ void MacroAssembler::AssertFunction(Register object) {
}
void MacroAssembler::AssertBoundFunction(Register object) {
if (emit_debug_code()) {
if (FLAG_debug_code) {
STATIC_ASSERT(kSmiTag == 0);
TestIfSmi(object);
Check(ne, AbortReason::kOperandIsASmiAndNotABoundFunction, cr0);
@ -2127,7 +2127,7 @@ void MacroAssembler::AssertBoundFunction(Register object) {
}
void MacroAssembler::AssertGeneratorObject(Register object) {
if (!emit_debug_code()) return;
if (!FLAG_debug_code) return;
TestIfSmi(object);
Check(ne, AbortReason::kOperandIsASmiAndNotAGeneratorObject, cr0);
@ -2157,7 +2157,7 @@ void MacroAssembler::AssertGeneratorObject(Register object) {
void MacroAssembler::AssertUndefinedOrAllocationSite(Register object,
Register scratch) {
if (emit_debug_code()) {
if (FLAG_debug_code) {
Label done_checking;
AssertNotSmi(object);
CompareRoot(object, RootIndex::kUndefinedValue);

View File

@ -155,8 +155,7 @@ class V8_EXPORT_PRIVATE TurboAssemblerBase : public Assembler {
};
// Avoids emitting calls to the {Builtins::kAbort} builtin when emitting debug
// code during the lifetime of this scope object. For disabling debug code
// entirely use the {DontEmitDebugCodeScope} instead.
// code during the lifetime of this scope object.
class V8_NODISCARD HardAbortScope {
public:
explicit HardAbortScope(TurboAssemblerBase* assembler)

View File

@ -341,7 +341,7 @@ void MacroAssembler::RecordWriteField(Register object, int offset,
DCHECK(IsAligned(offset, kTaggedSize));
leaq(dst, FieldOperand(object, offset));
if (emit_debug_code()) {
if (FLAG_debug_code) {
Label ok;
testb(dst, Immediate(kTaggedSize - 1));
j(zero, &ok, Label::kNear);
@ -356,7 +356,7 @@ void MacroAssembler::RecordWriteField(Register object, int offset,
// Clobber clobbered input registers when running with the debug-code flag
// turned on to provoke errors.
if (emit_debug_code()) {
if (FLAG_debug_code) {
Move(value, kZapValue, RelocInfo::NONE);
Move(dst, kZapValue, RelocInfo::NONE);
}
@ -500,7 +500,7 @@ void MacroAssembler::RecordWrite(Register object, Register address,
return;
}
if (emit_debug_code()) {
if (FLAG_debug_code) {
Label ok;
cmp_tagged(value, Operand(address, 0));
j(equal, &ok, Label::kNear);
@ -533,18 +533,18 @@ void MacroAssembler::RecordWrite(Register object, Register address,
// Clobber clobbered registers when running with the debug-code flag
// turned on to provoke errors.
if (emit_debug_code()) {
if (FLAG_debug_code) {
Move(address, kZapValue, RelocInfo::NONE);
Move(value, kZapValue, RelocInfo::NONE);
}
}
void TurboAssembler::Assert(Condition cc, AbortReason reason) {
if (emit_debug_code()) Check(cc, reason);
if (FLAG_debug_code) Check(cc, reason);
}
void TurboAssembler::AssertUnreachable(AbortReason reason) {
if (emit_debug_code()) Abort(reason);
if (FLAG_debug_code) Abort(reason);
}
void TurboAssembler::Check(Condition cc, AbortReason reason) {
@ -2557,28 +2557,28 @@ void MacroAssembler::CmpInstanceTypeRange(Register map,
}
void MacroAssembler::AssertNotSmi(Register object) {
if (emit_debug_code()) {
if (FLAG_debug_code) {
Condition is_smi = CheckSmi(object);
Check(NegateCondition(is_smi), AbortReason::kOperandIsASmi);
}
}
void MacroAssembler::AssertSmi(Register object) {
if (emit_debug_code()) {
if (FLAG_debug_code) {
Condition is_smi = CheckSmi(object);
Check(is_smi, AbortReason::kOperandIsNotASmi);
}
}
void MacroAssembler::AssertSmi(Operand object) {
if (emit_debug_code()) {
if (FLAG_debug_code) {
Condition is_smi = CheckSmi(object);
Check(is_smi, AbortReason::kOperandIsNotASmi);
}
}
void TurboAssembler::AssertZeroExtended(Register int32_register) {
if (emit_debug_code()) {
if (FLAG_debug_code) {
DCHECK_NE(int32_register, kScratchRegister);
movq(kScratchRegister, int64_t{0x0000000100000000});
cmpq(kScratchRegister, int32_register);
@ -2587,7 +2587,7 @@ void TurboAssembler::AssertZeroExtended(Register int32_register) {
}
void MacroAssembler::AssertConstructor(Register object) {
if (emit_debug_code()) {
if (FLAG_debug_code) {
testb(object, Immediate(kSmiTagMask));
Check(not_equal, AbortReason::kOperandIsASmiAndNotAConstructor);
Push(object);
@ -2600,7 +2600,7 @@ void MacroAssembler::AssertConstructor(Register object) {
}
void MacroAssembler::AssertFunction(Register object) {
if (emit_debug_code()) {
if (FLAG_debug_code) {
testb(object, Immediate(kSmiTagMask));
Check(not_equal, AbortReason::kOperandIsASmiAndNotAFunction);
Push(object);
@ -2612,7 +2612,7 @@ void MacroAssembler::AssertFunction(Register object) {
}
void MacroAssembler::AssertBoundFunction(Register object) {
if (emit_debug_code()) {
if (FLAG_debug_code) {
testb(object, Immediate(kSmiTagMask));
Check(not_equal, AbortReason::kOperandIsASmiAndNotABoundFunction);
Push(object);
@ -2623,7 +2623,7 @@ void MacroAssembler::AssertBoundFunction(Register object) {
}
void MacroAssembler::AssertGeneratorObject(Register object) {
if (!emit_debug_code()) return;
if (!FLAG_debug_code) return;
testb(object, Immediate(kSmiTagMask));
Check(not_equal, AbortReason::kOperandIsASmiAndNotAGeneratorObject);
@ -2651,7 +2651,7 @@ void MacroAssembler::AssertGeneratorObject(Register object) {
}
void MacroAssembler::AssertUndefinedOrAllocationSite(Register object) {
if (emit_debug_code()) {
if (FLAG_debug_code) {
Label done_checking;
AssertNotSmi(object);
Cmp(object, isolate()->factory()->undefined_value());
@ -3002,7 +3002,7 @@ void TurboAssembler::LeaveFrame(StackFrame::Type type) {
// TODO(v8:11429): Consider passing BASELINE instead, and checking for
// IsJSFrame or similar. Could then unify with manual frame leaves in the
// interpreter too.
if (emit_debug_code() && !StackFrame::IsJavaScript(type)) {
if (FLAG_debug_code && !StackFrame::IsJavaScript(type)) {
cmpq(Operand(rbp, CommonFrameConstants::kContextOrFrameTypeOffset),
Immediate(StackFrame::TypeToMarker(type)));
Check(equal, AbortReason::kStackFrameTypesMustMatch);
@ -3246,7 +3246,7 @@ void TurboAssembler::CallCFunction(Register function, int num_arguments) {
DCHECK_LE(num_arguments, kMaxCParameters);
DCHECK(has_frame());
// Check stack alignment.
if (emit_debug_code()) {
if (FLAG_debug_code) {
CheckStackAlignment();
}

View File

@ -3906,7 +3906,7 @@ void CodeGenerator::AssembleReturn(InstructionOperand* additional_pop_count) {
if (parameter_slots != 0) {
if (additional_pop_count->IsImmediate()) {
DCHECK_EQ(g.ToConstant(additional_pop_count).ToInt32(), 0);
} else if (__ emit_debug_code()) {
} else if (FLAG_debug_code) {
__ cmp(g.ToRegister(additional_pop_count), Operand(0));
__ Assert(eq, AbortReason::kUnexpectedAdditionalPopValue);
}

View File

@ -3280,7 +3280,7 @@ void CodeGenerator::AssembleReturn(InstructionOperand* additional_pop_count) {
if (parameter_slots != 0) {
if (additional_pop_count->IsImmediate()) {
DCHECK_EQ(g.ToConstant(additional_pop_count).ToInt32(), 0);
} else if (__ emit_debug_code()) {
} else if (FLAG_debug_code) {
__ cmp(g.ToRegister(additional_pop_count), Operand(0));
__ Assert(eq, AbortReason::kUnexpectedAdditionalPopValue);
}

View File

@ -4684,7 +4684,7 @@ void CodeGenerator::AssembleReturn(InstructionOperand* additional_pop_count) {
if (parameter_slots != 0) {
if (additional_pop_count->IsImmediate()) {
DCHECK_EQ(g.ToConstant(additional_pop_count).ToInt32(), 0);
} else if (__ emit_debug_code()) {
} else if (FLAG_debug_code) {
__ cmp(g.ToRegister(additional_pop_count), Immediate(0));
__ Assert(equal, AbortReason::kUnexpectedAdditionalPopValue);
}

View File

@ -781,7 +781,7 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
int offset = __ root_array_available() ? 68 : 80;
#endif // V8_ENABLE_WEBASSEMBLY
#if V8_HOST_ARCH_MIPS
if (__ emit_debug_code()) {
if (FLAG_debug_code) {
offset += 16;
}
#endif
@ -4234,7 +4234,7 @@ void CodeGenerator::AssembleReturn(InstructionOperand* additional_pop_count) {
if (parameter_slots != 0) {
if (additional_pop_count->IsImmediate()) {
DCHECK_EQ(g.ToConstant(additional_pop_count).ToInt32(), 0);
} else if (__ emit_debug_code()) {
} else if (FLAG_debug_code) {
__ Assert(eq, AbortReason::kUnexpectedAdditionalPopValue,
g.ToRegister(additional_pop_count),
Operand(static_cast<int64_t>(0)));

View File

@ -746,7 +746,7 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
int offset = __ root_array_available() ? 76 : 88;
#endif // V8_ENABLE_WEBASSEMBLY
#if V8_HOST_ARCH_MIPS64
if (__ emit_debug_code()) {
if (FLAG_debug_code) {
offset += 16;
}
#endif
@ -4446,7 +4446,7 @@ void CodeGenerator::AssembleReturn(InstructionOperand* additional_pop_count) {
if (parameter_slots != 0) {
if (additional_pop_count->IsImmediate()) {
DCHECK_EQ(g.ToConstant(additional_pop_count).ToInt32(), 0);
} else if (__ emit_debug_code()) {
} else if (FLAG_debug_code) {
__ Assert(eq, AbortReason::kUnexpectedAdditionalPopValue,
g.ToRegister(additional_pop_count),
Operand(static_cast<int64_t>(0)));

View File

@ -4249,7 +4249,7 @@ void CodeGenerator::AssembleReturn(InstructionOperand* additional_pop_count) {
if (parameter_slots != 0) {
if (additional_pop_count->IsImmediate()) {
DCHECK_EQ(g.ToConstant(additional_pop_count).ToInt32(), 0);
} else if (__ emit_debug_code()) {
} else if (FLAG_debug_code) {
__ cmpi(g.ToRegister(additional_pop_count), Operand(0));
__ Assert(eq, AbortReason::kUnexpectedAdditionalPopValue);
}

View File

@ -2517,7 +2517,7 @@ void CodeGenerator::AssembleReturn(InstructionOperand* additional_pop_count) {
if (parameter_slots != 0) {
if (additional_pop_count->IsImmediate()) {
DCHECK_EQ(g.ToConstant(additional_pop_count).ToInt32(), 0);
} else if (__ emit_debug_code()) {
} else if (FLAG_debug_code) {
__ Assert(eq, AbortReason::kUnexpectedAdditionalPopValue,
g.ToRegister(additional_pop_count),
Operand(static_cast<int64_t>(0)));

View File

@ -4248,7 +4248,7 @@ void CodeGenerator::AssembleReturn(InstructionOperand* additional_pop_count) {
if (parameter_slots != 0) {
if (additional_pop_count->IsImmediate()) {
DCHECK_EQ(g.ToConstant(additional_pop_count).ToInt32(), 0);
} else if (__ emit_debug_code()) {
} else if (FLAG_debug_code) {
__ CmpS64(g.ToRegister(additional_pop_count), Operand(0));
__ Assert(eq, AbortReason::kUnexpectedAdditionalPopValue);
}

View File

@ -4633,7 +4633,7 @@ void CodeGenerator::AssembleReturn(InstructionOperand* additional_pop_count) {
if (parameter_slots != 0) {
if (additional_pop_count->IsImmediate()) {
DCHECK_EQ(g.ToConstant(additional_pop_count).ToInt32(), 0);
} else if (__ emit_debug_code()) {
} else if (FLAG_debug_code) {
__ cmpq(g.ToRegister(additional_pop_count), Immediate(0));
__ Assert(equal, AbortReason::kUnexpectedAdditionalPopValue);
}

View File

@ -1252,8 +1252,12 @@ DEFINE_BOOL_READONLY(
"object space")
// assembler-ia32.cc / assembler-arm.cc / assembler-arm64.cc / assembler-x64.cc
#ifdef V8_ENABLE_DEBUG_CODE
DEFINE_BOOL(debug_code, DEBUG_BOOL,
"generate extra code (assertions) for debugging")
#else
DEFINE_BOOL_READONLY(debug_code, false, "")
#endif
#ifdef V8_CODE_COMMENTS
DEFINE_BOOL(code_comments, false,
"emit comments in code disassembly; for more readable source "

View File

@ -395,7 +395,7 @@ void RegExpMacroAssemblerARM64::CheckNotBackReferenceIgnoreCase(
__ Sub(current_input_offset().X(), current_input_offset().X(),
Operand(capture_length, SXTW));
}
if (masm_->emit_debug_code()) {
if (FLAG_debug_code) {
__ Cmp(current_input_offset().X(), Operand(current_input_offset(), SXTW));
__ Ccmp(current_input_offset(), 0, NoFlag, eq);
// The current input offset should be <= 0, and fit in a W register.
@ -528,7 +528,7 @@ void RegExpMacroAssemblerARM64::CheckNotBackReference(int start_reg,
Operand(capture_length, SXTW));
}
if (masm_->emit_debug_code()) {
if (FLAG_debug_code) {
__ Cmp(current_input_offset().X(), Operand(current_input_offset(), SXTW));
__ Ccmp(current_input_offset(), 0, NoFlag, eq);
// The current input offset should be <= 0, and fit in a W register.
@ -817,7 +817,7 @@ Handle<HeapObject> RegExpMacroAssemblerARM64::GetCode(Handle<String> source) {
// Find negative length (offset of start relative to end).
__ Sub(x10, input_start(), input_end());
if (masm_->emit_debug_code()) {
if (FLAG_debug_code) {
// Check that the size of the input string chars is in range.
__ Neg(x11, x10);
__ Cmp(x11, SeqTwoByteString::kMaxCharsSize);
@ -882,7 +882,7 @@ Handle<HeapObject> RegExpMacroAssemblerARM64::GetCode(Handle<String> source) {
// Get string length.
__ Sub(x10, input_end(), input_start());
if (masm_->emit_debug_code()) {
if (FLAG_debug_code) {
// Check that the size of the input string chars is in range.
__ Cmp(x10, SeqTwoByteString::kMaxCharsSize);
__ Check(ls, AbortReason::kInputStringTooLong);
@ -1167,7 +1167,7 @@ void RegExpMacroAssemblerARM64::PushBacktrack(Label* label) {
} else {
__ Adr(x10, label, MacroAssembler::kAdrFar);
__ Sub(x10, x10, code_pointer());
if (masm_->emit_debug_code()) {
if (FLAG_debug_code) {
__ Cmp(x10, kWRegMask);
// The code offset has to fit in a W register.
__ Check(ls, AbortReason::kOffsetOutOfRange);
@ -1322,7 +1322,7 @@ void RegExpMacroAssemblerARM64::ClearRegisters(int reg_from, int reg_to) {
void RegExpMacroAssemblerARM64::WriteStackPointerToRegister(int reg) {
__ Ldr(x10, MemOperand(frame_pointer(), kStackBase));
__ Sub(x10, backtrack_stackpointer(), x10);
if (masm_->emit_debug_code()) {
if (FLAG_debug_code) {
__ Cmp(x10, Operand(w10, SXTW));
// The stack offset needs to fit in a W register.
__ Check(eq, AbortReason::kOffsetOutOfRange);
@ -1629,7 +1629,7 @@ void RegExpMacroAssemblerARM64::LoadCurrentCharacterUnchecked(int cp_offset,
}
if (cp_offset != 0) {
if (masm_->emit_debug_code()) {
if (FLAG_debug_code) {
__ Mov(x10, cp_offset * char_size());
__ Add(x10, x10, Operand(current_input_offset(), SXTW));
__ Cmp(x10, Operand(w10, SXTW));

View File

@ -2837,7 +2837,7 @@ void LiftoffAssembler::CallTrapCallbackForTesting() {
}
void LiftoffAssembler::AssertUnreachable(AbortReason reason) {
if (emit_debug_code()) Abort(reason);
if (FLAG_debug_code) Abort(reason);
}
void LiftoffAssembler::PushRegisters(LiftoffRegList regs) {

View File

@ -2996,7 +2996,7 @@ void LiftoffAssembler::CallTrapCallbackForTesting() {
}
void LiftoffAssembler::AssertUnreachable(AbortReason reason) {
if (emit_debug_code()) Abort(reason);
if (FLAG_debug_code) Abort(reason);
}
void LiftoffAssembler::PushRegisters(LiftoffRegList regs) {

View File

@ -2427,7 +2427,7 @@ void LiftoffAssembler::CallTrapCallbackForTesting() {
}
void LiftoffAssembler::AssertUnreachable(AbortReason reason) {
if (emit_debug_code()) Abort(reason);
if (FLAG_debug_code) Abort(reason);
}
void LiftoffAssembler::PushRegisters(LiftoffRegList regs) {

View File

@ -337,7 +337,7 @@ void LiftoffAssembler::LoadTaggedPointer(Register dst, Register src_addr,
int32_t offset_imm,
LiftoffRegList pinned) {
DCHECK_GE(offset_imm, 0);
if (emit_debug_code() && offset_reg != no_reg) {
if (FLAG_debug_code && offset_reg != no_reg) {
AssertZeroExtended(offset_reg);
}
Operand src_op = liftoff::GetMemOp(this, src_addr, offset_reg,

View File

@ -29,7 +29,11 @@ TEST(DisasmPoisonMonomorphicLoad) {
i::FLAG_allow_natives_syntax = true;
i::FLAG_untrusted_code_mitigations = true;
#ifdef V8_ENABLE_DEBUG_CODE
i::FLAG_debug_code = false;
#else
STATIC_ASSERT(i::FLAG_debug_code == false);
#endif
CcTest::InitializeVM();
v8::HandleScope scope(CcTest::isolate());
@ -79,7 +83,11 @@ TEST(DisasmPoisonPolymorphicLoad) {
i::FLAG_allow_natives_syntax = true;
i::FLAG_untrusted_code_mitigations = true;
#ifdef V8_ENABLE_DEBUG_CODE
i::FLAG_debug_code = false;
#else
STATIC_ASSERT(i::FLAG_debug_code == false);
#endif
CcTest::InitializeVM();
v8::HandleScope scope(CcTest::isolate());