From 531dde9f80cb4e6aaa03083b42285c319a47867f Mon Sep 17 00:00:00 2001 From: yangguo Date: Wed, 2 Dec 2015 06:13:39 -0800 Subject: [PATCH] [debugger] simplify reloc info for debug break slots. The new step-in implementation no longer tries to predict the step-in target, so we don't need the arguments count nor call type anymore. R=verwaest@chromium.org Review URL: https://codereview.chromium.org/1484893003 Cr-Commit-Position: refs/heads/master@{#32516} --- src/arm/assembler-arm.h | 2 +- src/arm64/assembler-arm64.cc | 2 +- src/arm64/assembler-arm64.h | 2 +- src/assembler.cc | 22 ++++--------------- src/assembler.h | 16 ++++---------- src/debug/arm/debug-arm.cc | 5 ++--- src/debug/arm64/debug-arm64.cc | 5 ++--- src/debug/debug.cc | 8 +------ src/debug/debug.h | 12 +--------- src/debug/ia32/debug-ia32.cc | 5 ++--- src/debug/mips/debug-mips.cc | 5 ++--- src/debug/mips64/debug-mips64.cc | 5 ++--- src/debug/x64/debug-x64.cc | 5 ++--- src/full-codegen/arm/full-codegen-arm.cc | 14 ++++++------ src/full-codegen/arm64/full-codegen-arm64.cc | 14 ++++++------ src/full-codegen/full-codegen.cc | 16 ++------------ src/full-codegen/full-codegen.h | 7 ++++-- src/full-codegen/ia32/full-codegen-ia32.cc | 14 ++++++------ src/full-codegen/mips/full-codegen-mips.cc | 14 ++++++------ .../mips64/full-codegen-mips64.cc | 14 ++++++------ src/full-codegen/x64/full-codegen-x64.cc | 14 ++++++------ src/full-codegen/x87/full-codegen-x87.cc | 8 +++---- src/ia32/assembler-ia32.h | 2 +- src/mips/assembler-mips.cc | 2 +- src/mips/assembler-mips.h | 2 +- src/mips64/assembler-mips64.cc | 2 +- src/mips64/assembler-mips64.h | 2 +- src/x64/assembler-x64.h | 2 +- 28 files changed, 84 insertions(+), 137 deletions(-) diff --git a/src/arm/assembler-arm.h b/src/arm/assembler-arm.h index 8173b16a10..1abf1ab6a6 100644 --- a/src/arm/assembler-arm.h +++ b/src/arm/assembler-arm.h @@ -1314,7 +1314,7 @@ class Assembler : public AssemblerBase { void RecordGeneratorContinuation(); // Mark address of a debug break slot. - void RecordDebugBreakSlot(RelocInfo::Mode mode, int argc = 0); + void RecordDebugBreakSlot(RelocInfo::Mode mode); // Record the AST id of the CallIC being compiled, so that it can be placed // in the relocation information. diff --git a/src/arm64/assembler-arm64.cc b/src/arm64/assembler-arm64.cc index 2084a36ba1..ea7a732f8a 100644 --- a/src/arm64/assembler-arm64.cc +++ b/src/arm64/assembler-arm64.cc @@ -2871,7 +2871,7 @@ void Assembler::RecordRelocInfo(RelocInfo::Mode rmode, intptr_t data) { // We do not try to reuse pool constants. RelocInfo rinfo(isolate(), reinterpret_cast(pc_), rmode, data, NULL); if (((rmode >= RelocInfo::COMMENT) && - (rmode <= RelocInfo::DEBUG_BREAK_SLOT_AT_CONSTRUCT_CALL)) || + (rmode <= RelocInfo::DEBUG_BREAK_SLOT_AT_CALL)) || (rmode == RelocInfo::INTERNAL_REFERENCE) || (rmode == RelocInfo::CONST_POOL) || (rmode == RelocInfo::VENEER_POOL) || (rmode == RelocInfo::DEOPT_REASON) || diff --git a/src/arm64/assembler-arm64.h b/src/arm64/assembler-arm64.h index f8d9737af5..5854704b68 100644 --- a/src/arm64/assembler-arm64.h +++ b/src/arm64/assembler-arm64.h @@ -933,7 +933,7 @@ class Assembler : public AssemblerBase { void RecordGeneratorContinuation(); // Mark address of a debug break slot. - void RecordDebugBreakSlot(RelocInfo::Mode mode, int argc = 0); + void RecordDebugBreakSlot(RelocInfo::Mode mode); // Record the emission of a constant pool. // diff --git a/src/assembler.cc b/src/assembler.cc index 0841b057f2..923214b927 100644 --- a/src/assembler.cc +++ b/src/assembler.cc @@ -508,9 +508,7 @@ void RelocInfoWriter::Write(const RelocInfo* rinfo) { if (RelocInfo::IsComment(rmode)) { WriteData(rinfo->data()); } else if (RelocInfo::IsConstPool(rmode) || - RelocInfo::IsVeneerPool(rmode) || - RelocInfo::IsDebugBreakSlotAtCall(rmode) || - RelocInfo::IsDebugBreakSlotAtConstructCall(rmode)) { + RelocInfo::IsVeneerPool(rmode)) { WriteIntData(static_cast(rinfo->data())); } } @@ -701,9 +699,7 @@ void RelocIterator::next() { Advance(kIntSize); } } else if (RelocInfo::IsConstPool(rmode) || - RelocInfo::IsVeneerPool(rmode) || - RelocInfo::IsDebugBreakSlotAtCall(rmode) || - RelocInfo::IsDebugBreakSlotAtConstructCall(rmode)) { + RelocInfo::IsVeneerPool(rmode)) { if (SetMode(rmode)) { AdvanceReadInt(); return; @@ -833,8 +829,6 @@ const char* RelocInfo::RelocModeName(RelocInfo::Mode rmode) { return "debug break slot at return"; case DEBUG_BREAK_SLOT_AT_CALL: return "debug break slot at call"; - case DEBUG_BREAK_SLOT_AT_CONSTRUCT_CALL: - return "debug break slot at construct call"; case CODE_AGE_SEQUENCE: return "code age sequence"; case GENERATOR_CONTINUATION: @@ -931,7 +925,6 @@ void RelocInfo::Verify(Isolate* isolate) { case DEBUG_BREAK_SLOT_AT_POSITION: case DEBUG_BREAK_SLOT_AT_RETURN: case DEBUG_BREAK_SLOT_AT_CALL: - case DEBUG_BREAK_SLOT_AT_CONSTRUCT_CALL: case GENERATOR_CONTINUATION: case NONE32: case NONE64: @@ -948,12 +941,6 @@ void RelocInfo::Verify(Isolate* isolate) { #endif // VERIFY_HEAP -int RelocInfo::DebugBreakCallArgumentsCount(intptr_t data) { - return static_cast(data); -} - - -// ----------------------------------------------------------------------------- // Implementation of ExternalReference void ExternalReference::SetUp() { @@ -1883,11 +1870,10 @@ void Assembler::RecordGeneratorContinuation() { } -void Assembler::RecordDebugBreakSlot(RelocInfo::Mode mode, int call_argc) { +void Assembler::RecordDebugBreakSlot(RelocInfo::Mode mode) { EnsureSpace ensure_space(this); DCHECK(RelocInfo::IsDebugBreakSlot(mode)); - intptr_t data = static_cast(call_argc); - RecordRelocInfo(mode, data); + RecordRelocInfo(mode); } diff --git a/src/assembler.h b/src/assembler.h index 19f79493d1..ccfedafa07 100644 --- a/src/assembler.h +++ b/src/assembler.h @@ -391,7 +391,6 @@ class RelocInfo { DEBUG_BREAK_SLOT_AT_POSITION, DEBUG_BREAK_SLOT_AT_RETURN, DEBUG_BREAK_SLOT_AT_CALL, - DEBUG_BREAK_SLOT_AT_CONSTRUCT_CALL, EXTERNAL_REFERENCE, // The address of an external C++ function. INTERNAL_REFERENCE, // An address inside the same function. @@ -484,8 +483,7 @@ class RelocInfo { } static inline bool IsDebugBreakSlot(Mode mode) { return IsDebugBreakSlotAtPosition(mode) || IsDebugBreakSlotAtReturn(mode) || - IsDebugBreakSlotAtCall(mode) || - IsDebugBreakSlotAtConstructCall(mode); + IsDebugBreakSlotAtCall(mode); } static inline bool IsDebugBreakSlotAtPosition(Mode mode) { return mode == DEBUG_BREAK_SLOT_AT_POSITION; @@ -496,9 +494,6 @@ class RelocInfo { static inline bool IsDebugBreakSlotAtCall(Mode mode) { return mode == DEBUG_BREAK_SLOT_AT_CALL; } - static inline bool IsDebugBreakSlotAtConstructCall(Mode mode) { - return mode == DEBUG_BREAK_SLOT_AT_CONSTRUCT_CALL; - } static inline bool IsDebuggerStatement(Mode mode) { return mode == DEBUGGER_STATEMENT; } @@ -537,9 +532,6 @@ class RelocInfo { // constant pool, otherwise the pointer is embedded in the instruction stream. bool IsInConstantPool(); - static int DebugBreakCallArgumentsCount(intptr_t data); - - // Read/modify the code target in the branch/call instruction // this relocation applies to; // can only be called if IsCodeTarget(rmode_) || IsRuntimeEntry(rmode_) INLINE(Address target_address()); @@ -649,9 +641,9 @@ class RelocInfo { static const int kPositionMask = 1 << POSITION | 1 << STATEMENT_POSITION; static const int kDataMask = (1 << CODE_TARGET_WITH_ID) | kPositionMask | (1 << COMMENT); - static const int kDebugBreakSlotMask = - 1 << DEBUG_BREAK_SLOT_AT_POSITION | 1 << DEBUG_BREAK_SLOT_AT_RETURN | - 1 << DEBUG_BREAK_SLOT_AT_CALL | 1 << DEBUG_BREAK_SLOT_AT_CONSTRUCT_CALL; + static const int kDebugBreakSlotMask = 1 << DEBUG_BREAK_SLOT_AT_POSITION | + 1 << DEBUG_BREAK_SLOT_AT_RETURN | + 1 << DEBUG_BREAK_SLOT_AT_CALL; static const int kApplyMask; // Modes affected by apply. Depends on arch. private: diff --git a/src/debug/arm/debug-arm.cc b/src/debug/arm/debug-arm.cc index da39268a8a..b5b6054d7d 100644 --- a/src/debug/arm/debug-arm.cc +++ b/src/debug/arm/debug-arm.cc @@ -24,12 +24,11 @@ void EmitDebugBreakSlot(MacroAssembler* masm) { } -void DebugCodegen::GenerateSlot(MacroAssembler* masm, RelocInfo::Mode mode, - int call_argc) { +void DebugCodegen::GenerateSlot(MacroAssembler* masm, RelocInfo::Mode mode) { // Generate enough nop's to make space for a call instruction. Avoid emitting // the constant pool in the debug break slot code. Assembler::BlockConstPoolScope block_const_pool(masm); - masm->RecordDebugBreakSlot(mode, call_argc); + masm->RecordDebugBreakSlot(mode); EmitDebugBreakSlot(masm); } diff --git a/src/debug/arm64/debug-arm64.cc b/src/debug/arm64/debug-arm64.cc index 2600fca818..599815bf54 100644 --- a/src/debug/arm64/debug-arm64.cc +++ b/src/debug/arm64/debug-arm64.cc @@ -25,12 +25,11 @@ void EmitDebugBreakSlot(Assembler* masm) { } -void DebugCodegen::GenerateSlot(MacroAssembler* masm, RelocInfo::Mode mode, - int call_argc) { +void DebugCodegen::GenerateSlot(MacroAssembler* masm, RelocInfo::Mode mode) { // Generate enough nop's to make space for a call instruction. Avoid emitting // the constant pool in the debug break slot code. InstructionAccurateScope scope(masm, Assembler::kDebugBreakSlotInstructions); - masm->RecordDebugBreakSlot(mode, call_argc); + masm->RecordDebugBreakSlot(mode); EmitDebugBreakSlot(masm); } diff --git a/src/debug/debug.cc b/src/debug/debug.cc index 55b4a839e2..d3f3b90515 100644 --- a/src/debug/debug.cc +++ b/src/debug/debug.cc @@ -86,7 +86,6 @@ int BreakLocation::Iterator::GetModeMask(BreakLocatorType type) { mask |= RelocInfo::ModeMask(RelocInfo::STATEMENT_POSITION); mask |= RelocInfo::ModeMask(RelocInfo::DEBUG_BREAK_SLOT_AT_RETURN); mask |= RelocInfo::ModeMask(RelocInfo::DEBUG_BREAK_SLOT_AT_CALL); - mask |= RelocInfo::ModeMask(RelocInfo::DEBUG_BREAK_SLOT_AT_CONSTRUCT_CALL); if (type == ALL_BREAK_LOCATIONS) { mask |= RelocInfo::ModeMask(RelocInfo::DEBUG_BREAK_SLOT_AT_POSITION); mask |= RelocInfo::ModeMask(RelocInfo::DEBUGGER_STATEMENT); @@ -300,11 +299,6 @@ void BreakLocation::ClearDebugBreak() { } -bool BreakLocation::IsStepInLocation() const { - return IsConstructCall() || IsCall(); -} - - bool BreakLocation::IsDebugBreak() const { if (IsDebugBreakSlot()) { return rinfo().IsPatchedDebugBreakSlotSequence(); @@ -1606,7 +1600,7 @@ void Debug::GetStepinPositions(JavaScriptFrame* frame, StackFrame::Id frame_id, if (frame_it.frame()->id() != frame_id) continue; } } - if (location.IsStepInLocation()) results_out->Add(location.position()); + if (location.IsCall()) results_out->Add(location.position()); } } diff --git a/src/debug/debug.h b/src/debug/debug.h index ab870f0990..78b31352a7 100644 --- a/src/debug/debug.h +++ b/src/debug/debug.h @@ -83,15 +83,6 @@ class BreakLocation { inline bool IsCall() const { return RelocInfo::IsDebugBreakSlotAtCall(rmode_); } - inline bool IsConstructCall() const { - return RelocInfo::IsDebugBreakSlotAtConstructCall(rmode_); - } - inline int CallArgumentsCount() const { - DCHECK(IsStepInLocation()); - return RelocInfo::DebugBreakCallArgumentsCount(data_); - } - - bool IsStepInLocation() const; inline bool HasBreakPoint() const { return debug_info_->HasBreakPoint(pc_offset_); } @@ -775,8 +766,7 @@ class DebugCodegen : public AllStatic { static void GenerateFrameDropperLiveEdit(MacroAssembler* masm); - static void GenerateSlot(MacroAssembler* masm, RelocInfo::Mode mode, - int call_argc = -1); + static void GenerateSlot(MacroAssembler* masm, RelocInfo::Mode mode); static void PatchDebugBreakSlot(Isolate* isolate, Address pc, Handle code); diff --git a/src/debug/ia32/debug-ia32.cc b/src/debug/ia32/debug-ia32.cc index ef01dfe2a3..d07ac51721 100644 --- a/src/debug/ia32/debug-ia32.cc +++ b/src/debug/ia32/debug-ia32.cc @@ -23,10 +23,9 @@ void EmitDebugBreakSlot(MacroAssembler* masm) { } -void DebugCodegen::GenerateSlot(MacroAssembler* masm, RelocInfo::Mode mode, - int call_argc) { +void DebugCodegen::GenerateSlot(MacroAssembler* masm, RelocInfo::Mode mode) { // Generate enough nop's to make space for a call instruction. - masm->RecordDebugBreakSlot(mode, call_argc); + masm->RecordDebugBreakSlot(mode); EmitDebugBreakSlot(masm); } diff --git a/src/debug/mips/debug-mips.cc b/src/debug/mips/debug-mips.cc index c1d24c447e..5a291aa086 100644 --- a/src/debug/mips/debug-mips.cc +++ b/src/debug/mips/debug-mips.cc @@ -24,12 +24,11 @@ void EmitDebugBreakSlot(MacroAssembler* masm) { } -void DebugCodegen::GenerateSlot(MacroAssembler* masm, RelocInfo::Mode mode, - int call_argc) { +void DebugCodegen::GenerateSlot(MacroAssembler* masm, RelocInfo::Mode mode) { // Generate enough nop's to make space for a call instruction. Avoid emitting // the trampoline pool in the debug break slot code. Assembler::BlockTrampolinePoolScope block_pool(masm); - masm->RecordDebugBreakSlot(mode, call_argc); + masm->RecordDebugBreakSlot(mode); EmitDebugBreakSlot(masm); } diff --git a/src/debug/mips64/debug-mips64.cc b/src/debug/mips64/debug-mips64.cc index 5c1bb3e963..49bbf3bf8c 100644 --- a/src/debug/mips64/debug-mips64.cc +++ b/src/debug/mips64/debug-mips64.cc @@ -23,12 +23,11 @@ void EmitDebugBreakSlot(MacroAssembler* masm) { } -void DebugCodegen::GenerateSlot(MacroAssembler* masm, RelocInfo::Mode mode, - int call_argc) { +void DebugCodegen::GenerateSlot(MacroAssembler* masm, RelocInfo::Mode mode) { // Generate enough nop's to make space for a call instruction. Avoid emitting // the trampoline pool in the debug break slot code. Assembler::BlockTrampolinePoolScope block_pool(masm); - masm->RecordDebugBreakSlot(mode, call_argc); + masm->RecordDebugBreakSlot(mode); EmitDebugBreakSlot(masm); } diff --git a/src/debug/x64/debug-x64.cc b/src/debug/x64/debug-x64.cc index 2f017c8022..7935b1d9ab 100644 --- a/src/debug/x64/debug-x64.cc +++ b/src/debug/x64/debug-x64.cc @@ -24,10 +24,9 @@ void EmitDebugBreakSlot(MacroAssembler* masm) { } -void DebugCodegen::GenerateSlot(MacroAssembler* masm, RelocInfo::Mode mode, - int call_argc) { +void DebugCodegen::GenerateSlot(MacroAssembler* masm, RelocInfo::Mode mode) { // Generate enough nop's to make space for a call instruction. - masm->RecordDebugBreakSlot(mode, call_argc); + masm->RecordDebugBreakSlot(mode); EmitDebugBreakSlot(masm); } diff --git a/src/full-codegen/arm/full-codegen-arm.cc b/src/full-codegen/arm/full-codegen-arm.cc index 131f0da758..336c1797fa 100644 --- a/src/full-codegen/arm/full-codegen-arm.cc +++ b/src/full-codegen/arm/full-codegen-arm.cc @@ -2046,7 +2046,7 @@ void FullCodeGenerator::VisitYield(Yield* expr) { CallIC(ic, TypeFeedbackId::None()); __ mov(r1, r0); __ str(r1, MemOperand(sp, 2 * kPointerSize)); - SetCallPosition(expr, 1); + SetCallPosition(expr); __ mov(r0, Operand(1)); __ Call( isolate()->builtins()->Call(ConvertReceiverMode::kNotNullOrUndefined), @@ -2873,7 +2873,7 @@ void FullCodeGenerator::EmitCall(Call* expr, ConvertReceiverMode mode) { } PrepareForBailoutForId(expr->CallId(), NO_REGISTERS); - SetCallPosition(expr, arg_count); + SetCallPosition(expr); Handle ic = CodeFactory::CallIC(isolate(), arg_count, mode).code(); __ mov(r3, Operand(SmiFromSlot(expr->CallFeedbackICSlot()))); __ ldr(r1, MemOperand(sp, (arg_count + 1) * kPointerSize)); @@ -2981,7 +2981,7 @@ void FullCodeGenerator::EmitPossiblyEvalCall(Call* expr) { PrepareForBailoutForId(expr->EvalId(), NO_REGISTERS); // Record source position for debugger. - SetCallPosition(expr, arg_count); + SetCallPosition(expr); __ ldr(r1, MemOperand(sp, (arg_count + 1) * kPointerSize)); __ mov(r0, Operand(arg_count)); __ Call(isolate()->builtins()->Call(), RelocInfo::CODE_TARGET); @@ -3013,7 +3013,7 @@ void FullCodeGenerator::VisitCallNew(CallNew* expr) { // Call the construct call builtin that handles allocation and // constructor invocation. - SetConstructCallPosition(expr, arg_count); + SetConstructCallPosition(expr); // Load function and argument count into r1 and r0. __ mov(r0, Operand(arg_count)); @@ -3049,7 +3049,7 @@ void FullCodeGenerator::EmitSuperConstructorCall(Call* expr) { // Call the construct call builtin that handles allocation and // constructor invocation. - SetConstructCallPosition(expr, arg_count); + SetConstructCallPosition(expr); // Load new target into r3. VisitForAccumulatorValue(super_call_ref->new_target_var()); @@ -3746,7 +3746,7 @@ void FullCodeGenerator::EmitDefaultConstructorCallSuper(CallRuntime* expr) { // Call the construct call builtin that handles allocation and // constructor invocation. - SetConstructCallPosition(expr, 0); + SetConstructCallPosition(expr); // Load new target into r3. __ ldr(r3, MemOperand(sp, 1 * kPointerSize)); @@ -4117,7 +4117,7 @@ void FullCodeGenerator::EmitCallJSRuntimeFunction(CallRuntime* expr) { ZoneList* args = expr->arguments(); int arg_count = args->length(); - SetCallPosition(expr, arg_count); + SetCallPosition(expr); __ ldr(r1, MemOperand(sp, (arg_count + 1) * kPointerSize)); __ mov(r0, Operand(arg_count)); __ Call(isolate()->builtins()->Call(ConvertReceiverMode::kNullOrUndefined), diff --git a/src/full-codegen/arm64/full-codegen-arm64.cc b/src/full-codegen/arm64/full-codegen-arm64.cc index e930a8e990..df5eb28e0f 100644 --- a/src/full-codegen/arm64/full-codegen-arm64.cc +++ b/src/full-codegen/arm64/full-codegen-arm64.cc @@ -2584,7 +2584,7 @@ void FullCodeGenerator::EmitCall(Call* expr, ConvertReceiverMode mode) { } PrepareForBailoutForId(expr->CallId(), NO_REGISTERS); - SetCallPosition(expr, arg_count); + SetCallPosition(expr); Handle ic = CodeFactory::CallIC(isolate(), arg_count, mode).code(); __ Mov(x3, SmiFromSlot(expr->CallFeedbackICSlot())); @@ -2693,7 +2693,7 @@ void FullCodeGenerator::EmitPossiblyEvalCall(Call* expr) { PrepareForBailoutForId(expr->EvalId(), NO_REGISTERS); // Record source position for debugger. - SetCallPosition(expr, arg_count); + SetCallPosition(expr); // Call the evaluated function. __ Peek(x1, (arg_count + 1) * kXRegSize); @@ -2727,7 +2727,7 @@ void FullCodeGenerator::VisitCallNew(CallNew* expr) { // Call the construct call builtin that handles allocation and // constructor invocation. - SetConstructCallPosition(expr, arg_count); + SetConstructCallPosition(expr); // Load function and argument count into x1 and x0. __ Mov(x0, arg_count); @@ -2763,7 +2763,7 @@ void FullCodeGenerator::EmitSuperConstructorCall(Call* expr) { // Call the construct call builtin that handles allocation and // constructor invocation. - SetConstructCallPosition(expr, arg_count); + SetConstructCallPosition(expr); // Load new target into x3. VisitForAccumulatorValue(super_call_ref->new_target_var()); @@ -3462,7 +3462,7 @@ void FullCodeGenerator::EmitDefaultConstructorCallSuper(CallRuntime* expr) { // Call the construct call builtin that handles allocation and // constructor invocation. - SetConstructCallPosition(expr, 0); + SetConstructCallPosition(expr); // Load new target into x3. __ Peek(x3, 1 * kPointerSize); @@ -3827,7 +3827,7 @@ void FullCodeGenerator::EmitCallJSRuntimeFunction(CallRuntime* expr) { ZoneList* args = expr->arguments(); int arg_count = args->length(); - SetCallPosition(expr, arg_count); + SetCallPosition(expr); __ Peek(x1, (arg_count + 1) * kPointerSize); __ Mov(x0, arg_count); __ Call(isolate()->builtins()->Call(ConvertReceiverMode::kNullOrUndefined), @@ -4588,7 +4588,7 @@ void FullCodeGenerator::VisitYield(Yield* expr) { CallIC(ic, TypeFeedbackId::None()); __ Mov(x1, x0); __ Poke(x1, 2 * kPointerSize); - SetCallPosition(expr, 1); + SetCallPosition(expr); __ Mov(x0, 1); __ Call( isolate()->builtins()->Call(ConvertReceiverMode::kNotNullOrUndefined), diff --git a/src/full-codegen/full-codegen.cc b/src/full-codegen/full-codegen.cc index c8c43bf8ce..b7040d09da 100644 --- a/src/full-codegen/full-codegen.cc +++ b/src/full-codegen/full-codegen.cc @@ -602,24 +602,12 @@ void FullCodeGenerator::SetExpressionAsStatementPosition(Expression* expr) { } -void FullCodeGenerator::SetCallPosition(Expression* expr, int argc) { +void FullCodeGenerator::SetCallPosition(Expression* expr) { if (expr->position() == RelocInfo::kNoPosition) return; RecordPosition(masm_, expr->position()); if (info_->is_debug()) { // Always emit a debug break slot before a call. - DebugCodegen::GenerateSlot(masm_, RelocInfo::DEBUG_BREAK_SLOT_AT_CALL, - argc); - } -} - - -void FullCodeGenerator::SetConstructCallPosition(Expression* expr, int argc) { - if (expr->position() == RelocInfo::kNoPosition) return; - RecordPosition(masm_, expr->position()); - if (info_->is_debug()) { - // Always emit a debug break slot before a construct call. - DebugCodegen::GenerateSlot( - masm_, RelocInfo::DEBUG_BREAK_SLOT_AT_CONSTRUCT_CALL, argc); + DebugCodegen::GenerateSlot(masm_, RelocInfo::DEBUG_BREAK_SLOT_AT_CALL); } } diff --git a/src/full-codegen/full-codegen.h b/src/full-codegen/full-codegen.h index 5534475f96..954d4c0d81 100644 --- a/src/full-codegen/full-codegen.h +++ b/src/full-codegen/full-codegen.h @@ -659,9 +659,12 @@ class FullCodeGenerator: public AstVisitor { // This is used in loop headers where we want to break for each iteration. void SetExpressionAsStatementPosition(Expression* expr); - void SetCallPosition(Expression* expr, int argc); + void SetCallPosition(Expression* expr); - void SetConstructCallPosition(Expression* expr, int argc); + void SetConstructCallPosition(Expression* expr) { + // Currently call and construct calls are treated the same wrt debugging. + SetCallPosition(expr); + } // Non-local control flow support. void EnterTryBlock(int handler_index, Label* handler); diff --git a/src/full-codegen/ia32/full-codegen-ia32.cc b/src/full-codegen/ia32/full-codegen-ia32.cc index c3ac88b1f8..b9ca6feed1 100644 --- a/src/full-codegen/ia32/full-codegen-ia32.cc +++ b/src/full-codegen/ia32/full-codegen-ia32.cc @@ -1965,7 +1965,7 @@ void FullCodeGenerator::VisitYield(Yield* expr) { CallIC(ic, TypeFeedbackId::None()); __ mov(edi, eax); __ mov(Operand(esp, 2 * kPointerSize), edi); - SetCallPosition(expr, 1); + SetCallPosition(expr); __ Set(eax, 1); __ Call( isolate()->builtins()->Call(ConvertReceiverMode::kNotNullOrUndefined), @@ -2763,7 +2763,7 @@ void FullCodeGenerator::EmitCall(Call* expr, ConvertReceiverMode mode) { } PrepareForBailoutForId(expr->CallId(), NO_REGISTERS); - SetCallPosition(expr, arg_count); + SetCallPosition(expr); Handle ic = CodeFactory::CallIC(isolate(), arg_count, mode).code(); __ Move(edx, Immediate(SmiFromSlot(expr->CallFeedbackICSlot()))); __ mov(edi, Operand(esp, (arg_count + 1) * kPointerSize)); @@ -2867,7 +2867,7 @@ void FullCodeGenerator::EmitPossiblyEvalCall(Call* expr) { PrepareForBailoutForId(expr->EvalId(), NO_REGISTERS); - SetCallPosition(expr, arg_count); + SetCallPosition(expr); __ mov(edi, Operand(esp, (arg_count + 1) * kPointerSize)); __ Set(eax, arg_count); __ Call(isolate()->builtins()->Call(), RelocInfo::CODE_TARGET); @@ -2899,7 +2899,7 @@ void FullCodeGenerator::VisitCallNew(CallNew* expr) { // Call the construct call builtin that handles allocation and // constructor invocation. - SetConstructCallPosition(expr, arg_count); + SetConstructCallPosition(expr); // Load function and argument count into edi and eax. __ Move(eax, Immediate(arg_count)); @@ -2935,7 +2935,7 @@ void FullCodeGenerator::EmitSuperConstructorCall(Call* expr) { // Call the construct call builtin that handles allocation and // constructor invocation. - SetConstructCallPosition(expr, arg_count); + SetConstructCallPosition(expr); // Load new target into edx. VisitForAccumulatorValue(super_call_ref->new_target_var()); @@ -3642,7 +3642,7 @@ void FullCodeGenerator::EmitDefaultConstructorCallSuper(CallRuntime* expr) { // Call the construct call builtin that handles allocation and // constructor invocation. - SetConstructCallPosition(expr, 0); + SetConstructCallPosition(expr); // Check if the calling frame is an arguments adaptor frame. Label adaptor_frame, args_set_up, runtime; @@ -4042,7 +4042,7 @@ void FullCodeGenerator::EmitCallJSRuntimeFunction(CallRuntime* expr) { ZoneList* args = expr->arguments(); int arg_count = args->length(); - SetCallPosition(expr, arg_count); + SetCallPosition(expr); __ mov(edi, Operand(esp, (arg_count + 1) * kPointerSize)); __ Set(eax, arg_count); __ Call(isolate()->builtins()->Call(ConvertReceiverMode::kNullOrUndefined), diff --git a/src/full-codegen/mips/full-codegen-mips.cc b/src/full-codegen/mips/full-codegen-mips.cc index 6ce506d4f1..fe91e5883a 100644 --- a/src/full-codegen/mips/full-codegen-mips.cc +++ b/src/full-codegen/mips/full-codegen-mips.cc @@ -2051,7 +2051,7 @@ void FullCodeGenerator::VisitYield(Yield* expr) { __ mov(a0, v0); __ mov(a1, a0); __ sw(a1, MemOperand(sp, 2 * kPointerSize)); - SetCallPosition(expr, 1); + SetCallPosition(expr); __ li(a0, Operand(1)); __ Call( isolate()->builtins()->Call(ConvertReceiverMode::kNotNullOrUndefined), @@ -2869,7 +2869,7 @@ void FullCodeGenerator::EmitCall(Call* expr, ConvertReceiverMode mode) { PrepareForBailoutForId(expr->CallId(), NO_REGISTERS); // Record source position of the IC call. - SetCallPosition(expr, arg_count); + SetCallPosition(expr); Handle ic = CodeFactory::CallIC(isolate(), arg_count, mode).code(); __ li(a3, Operand(SmiFromSlot(expr->CallFeedbackICSlot()))); __ lw(a1, MemOperand(sp, (arg_count + 1) * kPointerSize)); @@ -2976,7 +2976,7 @@ void FullCodeGenerator::EmitPossiblyEvalCall(Call* expr) { PrepareForBailoutForId(expr->EvalId(), NO_REGISTERS); // Record source position for debugger. - SetCallPosition(expr, arg_count); + SetCallPosition(expr); __ lw(a1, MemOperand(sp, (arg_count + 1) * kPointerSize)); __ li(a0, Operand(arg_count)); __ Call(isolate()->builtins()->Call(), RelocInfo::CODE_TARGET); @@ -3008,7 +3008,7 @@ void FullCodeGenerator::VisitCallNew(CallNew* expr) { // Call the construct call builtin that handles allocation and // constructor invocation. - SetConstructCallPosition(expr, arg_count); + SetConstructCallPosition(expr); // Load function and argument count into a1 and a0. __ li(a0, Operand(arg_count)); @@ -3044,7 +3044,7 @@ void FullCodeGenerator::EmitSuperConstructorCall(Call* expr) { // Call the construct call builtin that handles allocation and // constructor invocation. - SetConstructCallPosition(expr, arg_count); + SetConstructCallPosition(expr); // Load new target into a3. VisitForAccumulatorValue(super_call_ref->new_target_var()); @@ -3763,7 +3763,7 @@ void FullCodeGenerator::EmitDefaultConstructorCallSuper(CallRuntime* expr) { // Call the construct call builtin that handles allocation and // constructor invocation. - SetConstructCallPosition(expr, 0); + SetConstructCallPosition(expr); // Load new target into a3. __ lw(a3, MemOperand(sp, 1 * kPointerSize)); @@ -4137,7 +4137,7 @@ void FullCodeGenerator::EmitCallJSRuntimeFunction(CallRuntime* expr) { ZoneList* args = expr->arguments(); int arg_count = args->length(); - SetCallPosition(expr, arg_count); + SetCallPosition(expr); __ lw(a1, MemOperand(sp, (arg_count + 1) * kPointerSize)); __ li(a0, Operand(arg_count)); __ Call(isolate()->builtins()->Call(ConvertReceiverMode::kNullOrUndefined), diff --git a/src/full-codegen/mips64/full-codegen-mips64.cc b/src/full-codegen/mips64/full-codegen-mips64.cc index c61eb7eeca..0f6ad379ac 100644 --- a/src/full-codegen/mips64/full-codegen-mips64.cc +++ b/src/full-codegen/mips64/full-codegen-mips64.cc @@ -2049,7 +2049,7 @@ void FullCodeGenerator::VisitYield(Yield* expr) { __ mov(a0, v0); __ mov(a1, a0); __ sd(a1, MemOperand(sp, 2 * kPointerSize)); - SetCallPosition(expr, 1); + SetCallPosition(expr); __ li(a0, Operand(1)); __ Call( isolate()->builtins()->Call(ConvertReceiverMode::kNotNullOrUndefined), @@ -2874,7 +2874,7 @@ void FullCodeGenerator::EmitCall(Call* expr, ConvertReceiverMode mode) { PrepareForBailoutForId(expr->CallId(), NO_REGISTERS); // Record source position of the IC call. - SetCallPosition(expr, arg_count); + SetCallPosition(expr); Handle ic = CodeFactory::CallIC(isolate(), arg_count, mode).code(); __ li(a3, Operand(SmiFromSlot(expr->CallFeedbackICSlot()))); __ ld(a1, MemOperand(sp, (arg_count + 1) * kPointerSize)); @@ -2980,7 +2980,7 @@ void FullCodeGenerator::EmitPossiblyEvalCall(Call* expr) { PrepareForBailoutForId(expr->EvalId(), NO_REGISTERS); // Record source position for debugger. - SetCallPosition(expr, arg_count); + SetCallPosition(expr); __ ld(a1, MemOperand(sp, (arg_count + 1) * kPointerSize)); __ li(a0, Operand(arg_count)); __ Call(isolate()->builtins()->Call(), RelocInfo::CODE_TARGET); @@ -3012,7 +3012,7 @@ void FullCodeGenerator::VisitCallNew(CallNew* expr) { // Call the construct call builtin that handles allocation and // constructor invocation. - SetConstructCallPosition(expr, arg_count); + SetConstructCallPosition(expr); // Load function and argument count into a1 and a0. __ li(a0, Operand(arg_count)); @@ -3048,7 +3048,7 @@ void FullCodeGenerator::EmitSuperConstructorCall(Call* expr) { // Call the construct call builtin that handles allocation and // constructor invocation. - SetConstructCallPosition(expr, arg_count); + SetConstructCallPosition(expr); // Load new target into a3. VisitForAccumulatorValue(super_call_ref->new_target_var()); @@ -3768,7 +3768,7 @@ void FullCodeGenerator::EmitDefaultConstructorCallSuper(CallRuntime* expr) { // Call the construct call builtin that handles allocation and // constructor invocation. - SetConstructCallPosition(expr, 0); + SetConstructCallPosition(expr); // Load new target into a3. __ ld(a3, MemOperand(sp, 1 * kPointerSize)); @@ -4142,7 +4142,7 @@ void FullCodeGenerator::EmitCallJSRuntimeFunction(CallRuntime* expr) { ZoneList* args = expr->arguments(); int arg_count = args->length(); - SetCallPosition(expr, arg_count); + SetCallPosition(expr); __ ld(a1, MemOperand(sp, (arg_count + 1) * kPointerSize)); __ li(a0, Operand(arg_count)); __ Call(isolate()->builtins()->Call(ConvertReceiverMode::kNullOrUndefined), diff --git a/src/full-codegen/x64/full-codegen-x64.cc b/src/full-codegen/x64/full-codegen-x64.cc index 39a826c409..28afd71c48 100644 --- a/src/full-codegen/x64/full-codegen-x64.cc +++ b/src/full-codegen/x64/full-codegen-x64.cc @@ -1988,7 +1988,7 @@ void FullCodeGenerator::VisitYield(Yield* expr) { __ movp(rdi, rax); __ movp(Operand(rsp, 2 * kPointerSize), rdi); - SetCallPosition(expr, 1); + SetCallPosition(expr); __ Set(rax, 1); __ Call( isolate()->builtins()->Call(ConvertReceiverMode::kNotNullOrUndefined), @@ -2747,7 +2747,7 @@ void FullCodeGenerator::EmitCall(Call* expr, ConvertReceiverMode mode) { } PrepareForBailoutForId(expr->CallId(), NO_REGISTERS); - SetCallPosition(expr, arg_count); + SetCallPosition(expr); Handle ic = CodeFactory::CallIC(isolate(), arg_count, mode).code(); __ Move(rdx, SmiFromSlot(expr->CallFeedbackICSlot())); __ movp(rdi, Operand(rsp, (arg_count + 1) * kPointerSize)); @@ -2850,7 +2850,7 @@ void FullCodeGenerator::EmitPossiblyEvalCall(Call* expr) { PrepareForBailoutForId(expr->EvalId(), NO_REGISTERS); - SetCallPosition(expr, arg_count); + SetCallPosition(expr); __ movp(rdi, Operand(rsp, (arg_count + 1) * kPointerSize)); __ Set(rax, arg_count); __ Call(isolate()->builtins()->Call(), RelocInfo::CODE_TARGET); @@ -2882,7 +2882,7 @@ void FullCodeGenerator::VisitCallNew(CallNew* expr) { // Call the construct call builtin that handles allocation and // constructor invocation. - SetConstructCallPosition(expr, arg_count); + SetConstructCallPosition(expr); // Load function and argument count into rdi and rax. __ Set(rax, arg_count); @@ -2918,7 +2918,7 @@ void FullCodeGenerator::EmitSuperConstructorCall(Call* expr) { // Call the construct call builtin that handles allocation and // constructor invocation. - SetConstructCallPosition(expr, arg_count); + SetConstructCallPosition(expr); // Load new target into rdx. VisitForAccumulatorValue(super_call_ref->new_target_var()); @@ -3630,7 +3630,7 @@ void FullCodeGenerator::EmitDefaultConstructorCallSuper(CallRuntime* expr) { // Call the construct call builtin that handles allocation and // constructor invocation. - SetConstructCallPosition(expr, 0); + SetConstructCallPosition(expr); // Check if the calling frame is an arguments adaptor frame. Label adaptor_frame, args_set_up, runtime; @@ -4049,7 +4049,7 @@ void FullCodeGenerator::EmitCallJSRuntimeFunction(CallRuntime* expr) { ZoneList* args = expr->arguments(); int arg_count = args->length(); - SetCallPosition(expr, arg_count); + SetCallPosition(expr); __ movp(rdi, Operand(rsp, (arg_count + 1) * kPointerSize)); __ Set(rax, arg_count); __ Call(isolate()->builtins()->Call(ConvertReceiverMode::kNullOrUndefined), diff --git a/src/full-codegen/x87/full-codegen-x87.cc b/src/full-codegen/x87/full-codegen-x87.cc index b97d56aa69..486ddd93e4 100644 --- a/src/full-codegen/x87/full-codegen-x87.cc +++ b/src/full-codegen/x87/full-codegen-x87.cc @@ -1957,7 +1957,7 @@ void FullCodeGenerator::VisitYield(Yield* expr) { CallIC(ic, TypeFeedbackId::None()); __ mov(edi, eax); __ mov(Operand(esp, 2 * kPointerSize), edi); - SetCallPosition(expr, 1); + SetCallPosition(expr); __ Set(eax, 1); __ Call( isolate()->builtins()->Call(ConvertReceiverMode::kNotNullOrUndefined), @@ -2755,7 +2755,7 @@ void FullCodeGenerator::EmitCall(Call* expr, ConvertReceiverMode mode) { } PrepareForBailoutForId(expr->CallId(), NO_REGISTERS); - SetCallPosition(expr, arg_count); + SetCallPosition(expr); Handle ic = CodeFactory::CallIC(isolate(), arg_count, mode).code(); __ Move(edx, Immediate(SmiFromSlot(expr->CallFeedbackICSlot()))); __ mov(edi, Operand(esp, (arg_count + 1) * kPointerSize)); @@ -2859,7 +2859,7 @@ void FullCodeGenerator::EmitPossiblyEvalCall(Call* expr) { PrepareForBailoutForId(expr->EvalId(), NO_REGISTERS); - SetCallPosition(expr, arg_count); + SetCallPosition(expr); __ mov(edi, Operand(esp, (arg_count + 1) * kPointerSize)); __ Set(eax, arg_count); __ Call(isolate()->builtins()->Call(), RelocInfo::CODE_TARGET); @@ -4034,7 +4034,7 @@ void FullCodeGenerator::EmitCallJSRuntimeFunction(CallRuntime* expr) { ZoneList* args = expr->arguments(); int arg_count = args->length(); - SetCallPosition(expr, arg_count); + SetCallPosition(expr); __ mov(edi, Operand(esp, (arg_count + 1) * kPointerSize)); __ Set(eax, arg_count); __ Call(isolate()->builtins()->Call(ConvertReceiverMode::kNullOrUndefined), diff --git a/src/ia32/assembler-ia32.h b/src/ia32/assembler-ia32.h index c8485993d5..0b202529f9 100644 --- a/src/ia32/assembler-ia32.h +++ b/src/ia32/assembler-ia32.h @@ -1400,7 +1400,7 @@ class Assembler : public AssemblerBase { void RecordGeneratorContinuation(); // Mark address of a debug break slot. - void RecordDebugBreakSlot(RelocInfo::Mode mode, int argc = 0); + void RecordDebugBreakSlot(RelocInfo::Mode mode); // Record a comment relocation entry that can be used by a disassembler. // Use --code-comments to enable. diff --git a/src/mips/assembler-mips.cc b/src/mips/assembler-mips.cc index 089780f0a6..1962e9aa31 100644 --- a/src/mips/assembler-mips.cc +++ b/src/mips/assembler-mips.cc @@ -2896,7 +2896,7 @@ void Assembler::RecordRelocInfo(RelocInfo::Mode rmode, intptr_t data) { // We do not try to reuse pool constants. RelocInfo rinfo(isolate(), pc_, rmode, data, NULL); if (rmode >= RelocInfo::COMMENT && - rmode <= RelocInfo::DEBUG_BREAK_SLOT_AT_CONSTRUCT_CALL) { + rmode <= RelocInfo::DEBUG_BREAK_SLOT_AT_CALL) { // Adjust code for new modes. DCHECK(RelocInfo::IsDebugBreakSlot(rmode) || RelocInfo::IsComment(rmode) diff --git a/src/mips/assembler-mips.h b/src/mips/assembler-mips.h index 688d78722a..17ba78979e 100644 --- a/src/mips/assembler-mips.h +++ b/src/mips/assembler-mips.h @@ -1011,7 +1011,7 @@ class Assembler : public AssemblerBase { void RecordGeneratorContinuation(); // Mark address of a debug break slot. - void RecordDebugBreakSlot(RelocInfo::Mode mode, int argc = 0); + void RecordDebugBreakSlot(RelocInfo::Mode mode); // Record the AST id of the CallIC being compiled, so that it can be placed // in the relocation information. diff --git a/src/mips64/assembler-mips64.cc b/src/mips64/assembler-mips64.cc index b39dac35db..fa62932e82 100644 --- a/src/mips64/assembler-mips64.cc +++ b/src/mips64/assembler-mips64.cc @@ -3114,7 +3114,7 @@ void Assembler::RecordRelocInfo(RelocInfo::Mode rmode, intptr_t data) { // We do not try to reuse pool constants. RelocInfo rinfo(isolate(), pc_, rmode, data, NULL); if (rmode >= RelocInfo::COMMENT && - rmode <= RelocInfo::DEBUG_BREAK_SLOT_AT_CONSTRUCT_CALL) { + rmode <= RelocInfo::DEBUG_BREAK_SLOT_AT_CALL) { // Adjust code for new modes. DCHECK(RelocInfo::IsDebugBreakSlot(rmode) || RelocInfo::IsComment(rmode) diff --git a/src/mips64/assembler-mips64.h b/src/mips64/assembler-mips64.h index ac3bdaaff2..093daaf865 100644 --- a/src/mips64/assembler-mips64.h +++ b/src/mips64/assembler-mips64.h @@ -1047,7 +1047,7 @@ class Assembler : public AssemblerBase { void RecordGeneratorContinuation(); // Mark address of a debug break slot. - void RecordDebugBreakSlot(RelocInfo::Mode mode, int argc = 0); + void RecordDebugBreakSlot(RelocInfo::Mode mode); // Record the AST id of the CallIC being compiled, so that it can be placed // in the relocation information. diff --git a/src/x64/assembler-x64.h b/src/x64/assembler-x64.h index ced06a388e..799fa6fe9d 100644 --- a/src/x64/assembler-x64.h +++ b/src/x64/assembler-x64.h @@ -1652,7 +1652,7 @@ class Assembler : public AssemblerBase { void RecordGeneratorContinuation(); // Mark address of a debug break slot. - void RecordDebugBreakSlot(RelocInfo::Mode mode, int argc = 0); + void RecordDebugBreakSlot(RelocInfo::Mode mode); // Record a comment relocation entry that can be used by a disassembler. // Use --code-comments to enable.