Debugger: record reloc info for debug break slot immediate before the slot.

If we do it too early, we might get a constant pool between the reloc info
and the actual slot.

R=ulan@chromium.org

Review URL: https://codereview.chromium.org/1229673005

Cr-Commit-Position: refs/heads/master@{#29568}
This commit is contained in:
yangguo 2015-07-10 05:47:18 -07:00 committed by Commit bot
parent b625d4d8cc
commit 0a19e44925
9 changed files with 60 additions and 18 deletions

View File

@ -121,12 +121,15 @@ void DebugCodegen::GenerateReturnDebugBreak(MacroAssembler* masm) {
} }
void DebugCodegen::GenerateSlot(MacroAssembler* masm) { void DebugCodegen::GenerateSlot(MacroAssembler* masm,
DebugCodegen::SlotLocation location,
int call_argc) {
// Generate enough nop's to make space for a call instruction. Avoid emitting // Generate enough nop's to make space for a call instruction. Avoid emitting
// the constant pool in the debug break slot code. // the constant pool in the debug break slot code.
Assembler::BlockConstPoolScope block_const_pool(masm); Assembler::BlockConstPoolScope block_const_pool(masm);
Label check_codesize; Label check_codesize;
__ bind(&check_codesize); __ bind(&check_codesize);
RecordRelocInfo(masm, location, call_argc);
for (int i = 0; i < Assembler::kDebugBreakSlotInstructions; i++) { for (int i = 0; i < Assembler::kDebugBreakSlotInstructions; i++) {
__ nop(MacroAssembler::DEBUG_BREAK_NOP); __ nop(MacroAssembler::DEBUG_BREAK_NOP);
} }

View File

@ -166,11 +166,13 @@ void DebugCodegen::GenerateReturnDebugBreak(MacroAssembler* masm) {
} }
void DebugCodegen::GenerateSlot(MacroAssembler* masm) { void DebugCodegen::GenerateSlot(MacroAssembler* masm,
DebugCodegen::SlotLocation location,
int call_argc) {
// Generate enough nop's to make space for a call instruction. Avoid emitting // Generate enough nop's to make space for a call instruction. Avoid emitting
// the constant pool in the debug break slot code. // the constant pool in the debug break slot code.
InstructionAccurateScope scope(masm, Assembler::kDebugBreakSlotInstructions); InstructionAccurateScope scope(masm, Assembler::kDebugBreakSlotInstructions);
RecordRelocInfo(masm, location, call_argc);
for (int i = 0; i < Assembler::kDebugBreakSlotInstructions; i++) { for (int i = 0; i < Assembler::kDebugBreakSlotInstructions; i++) {
__ nop(Assembler::DEBUG_BREAK_NOP); __ nop(Assembler::DEBUG_BREAK_NOP);
} }

View File

@ -3176,5 +3176,23 @@ void LockingCommandMessageQueue::Clear() {
queue_.Clear(); queue_.Clear();
} }
void DebugCodegen::RecordRelocInfo(MacroAssembler* masm,
DebugCodegen::SlotLocation location,
int call_argc) {
switch (location) {
case PLAIN_DEBUG_BREAK:
masm->RecordDebugBreakSlot();
return;
case DEBUG_BREAK_AT_CALL:
DCHECK_LE(0, call_argc);
masm->RecordDebugBreakSlotForCall(call_argc);
return;
case DEBUG_BREAK_AT_CONSTRUCT_CALL:
masm->RecordDebugBreakSlotForConstructCall();
return;
}
}
} // namespace internal } // namespace internal
} // namespace v8 } // namespace v8

View File

@ -791,7 +791,14 @@ class SuppressDebug BASE_EMBEDDED {
// Code generator routines. // Code generator routines.
class DebugCodegen : public AllStatic { class DebugCodegen : public AllStatic {
public: public:
static void GenerateSlot(MacroAssembler* masm); enum SlotLocation {
PLAIN_DEBUG_BREAK,
DEBUG_BREAK_AT_CALL,
DEBUG_BREAK_AT_CONSTRUCT_CALL
};
static void GenerateSlot(MacroAssembler* masm, SlotLocation location,
int call_argc = -1);
static void GenerateReturnDebugBreak(MacroAssembler* masm); static void GenerateReturnDebugBreak(MacroAssembler* masm);
static void GenerateSlotDebugBreak(MacroAssembler* masm); static void GenerateSlotDebugBreak(MacroAssembler* masm);
static void GeneratePlainReturnLiveEdit(MacroAssembler* masm); static void GeneratePlainReturnLiveEdit(MacroAssembler* masm);
@ -801,6 +808,10 @@ class DebugCodegen : public AllStatic {
// There is no calling conventions here, because it never actually gets // There is no calling conventions here, because it never actually gets
// called, it only gets returned to. // called, it only gets returned to.
static void GenerateFrameDropperLiveEdit(MacroAssembler* masm); static void GenerateFrameDropperLiveEdit(MacroAssembler* masm);
private:
static void RecordRelocInfo(MacroAssembler* masm, SlotLocation location,
int call_argc);
}; };

View File

@ -433,8 +433,7 @@ void FullCodeGenerator::SetStatementPosition(
bool recorded = RecordStatementPosition(masm_, stmt->position()); bool recorded = RecordStatementPosition(masm_, stmt->position());
if (recorded && insert_break == INSERT_BREAK && info_->is_debug() && if (recorded && insert_break == INSERT_BREAK && info_->is_debug() &&
!stmt->IsDebuggerStatement()) { !stmt->IsDebuggerStatement()) {
masm_->RecordDebugBreakSlot(); DebugCodegen::GenerateSlot(masm_, DebugCodegen::PLAIN_DEBUG_BREAK);
DebugCodegen::GenerateSlot(masm_);
} }
} }
@ -444,8 +443,7 @@ void FullCodeGenerator::SetExpressionPosition(
if (expr->position() == RelocInfo::kNoPosition) return; if (expr->position() == RelocInfo::kNoPosition) return;
bool recorded = RecordPosition(masm_, expr->position()); bool recorded = RecordPosition(masm_, expr->position());
if (recorded && insert_break == INSERT_BREAK && info_->is_debug()) { if (recorded && insert_break == INSERT_BREAK && info_->is_debug()) {
masm_->RecordDebugBreakSlot(); DebugCodegen::GenerateSlot(masm_, DebugCodegen::PLAIN_DEBUG_BREAK);
DebugCodegen::GenerateSlot(masm_);
} }
} }
@ -454,8 +452,7 @@ void FullCodeGenerator::SetExpressionAsStatementPosition(Expression* expr) {
if (expr->position() == RelocInfo::kNoPosition) return; if (expr->position() == RelocInfo::kNoPosition) return;
bool recorded = RecordStatementPosition(masm_, expr->position()); bool recorded = RecordStatementPosition(masm_, expr->position());
if (recorded && info_->is_debug()) { if (recorded && info_->is_debug()) {
masm_->RecordDebugBreakSlot(); DebugCodegen::GenerateSlot(masm_, DebugCodegen::PLAIN_DEBUG_BREAK);
DebugCodegen::GenerateSlot(masm_);
} }
} }
@ -465,8 +462,7 @@ void FullCodeGenerator::SetCallPosition(Expression* expr, int argc) {
RecordPosition(masm_, expr->position()); RecordPosition(masm_, expr->position());
if (info_->is_debug()) { if (info_->is_debug()) {
// Always emit a debug break slot before a call. // Always emit a debug break slot before a call.
masm_->RecordDebugBreakSlotForCall(argc); DebugCodegen::GenerateSlot(masm_, DebugCodegen::DEBUG_BREAK_AT_CALL, argc);
DebugCodegen::GenerateSlot(masm_);
} }
} }
@ -476,8 +472,8 @@ void FullCodeGenerator::SetConstructCallPosition(Expression* expr) {
RecordPosition(masm_, expr->position()); RecordPosition(masm_, expr->position());
if (info_->is_debug()) { if (info_->is_debug()) {
// Always emit a debug break slot before a construct call. // Always emit a debug break slot before a construct call.
masm_->RecordDebugBreakSlotForConstructCall(); DebugCodegen::GenerateSlot(masm_,
DebugCodegen::GenerateSlot(masm_); DebugCodegen::DEBUG_BREAK_AT_CONSTRUCT_CALL);
} }
} }

View File

@ -158,10 +158,13 @@ void DebugCodegen::GenerateReturnDebugBreak(MacroAssembler* masm) {
} }
void DebugCodegen::GenerateSlot(MacroAssembler* masm) { void DebugCodegen::GenerateSlot(MacroAssembler* masm,
DebugCodegen::SlotLocation location,
int call_argc) {
// Generate enough nop's to make space for a call instruction. // Generate enough nop's to make space for a call instruction.
Label check_codesize; Label check_codesize;
__ bind(&check_codesize); __ bind(&check_codesize);
RecordRelocInfo(masm, location, call_argc);
__ Nop(Assembler::kDebugBreakSlotLength); __ Nop(Assembler::kDebugBreakSlotLength);
DCHECK_EQ(Assembler::kDebugBreakSlotLength, DCHECK_EQ(Assembler::kDebugBreakSlotLength,
masm->SizeOfCodeGeneratedSince(&check_codesize)); masm->SizeOfCodeGeneratedSince(&check_codesize));

View File

@ -129,12 +129,15 @@ void DebugCodegen::GenerateReturnDebugBreak(MacroAssembler* masm) {
} }
void DebugCodegen::GenerateSlot(MacroAssembler* masm) { void DebugCodegen::GenerateSlot(MacroAssembler* masm,
DebugCodegen::SlotLocation location,
int call_argc) {
// Generate enough nop's to make space for a call instruction. Avoid emitting // Generate enough nop's to make space for a call instruction. Avoid emitting
// the trampoline pool in the debug break slot code. // the trampoline pool in the debug break slot code.
Assembler::BlockTrampolinePoolScope block_trampoline_pool(masm); Assembler::BlockTrampolinePoolScope block_trampoline_pool(masm);
Label check_codesize; Label check_codesize;
__ bind(&check_codesize); __ bind(&check_codesize);
RecordRelocInfo(masm, location, call_argc);
for (int i = 0; i < Assembler::kDebugBreakSlotInstructions; i++) { for (int i = 0; i < Assembler::kDebugBreakSlotInstructions; i++) {
__ nop(MacroAssembler::DEBUG_BREAK_NOP); __ nop(MacroAssembler::DEBUG_BREAK_NOP);
} }

View File

@ -140,12 +140,15 @@ void DebugCodegen::GenerateReturnDebugBreak(MacroAssembler* masm) {
} }
void DebugCodegen::GenerateSlot(MacroAssembler* masm) { void DebugCodegen::GenerateSlot(MacroAssembler* masm,
DebugCodegen::SlotLocation location,
int call_argc) {
// Generate enough nop's to make space for a call instruction. Avoid emitting // Generate enough nop's to make space for a call instruction. Avoid emitting
// the trampoline pool in the debug break slot code. // the trampoline pool in the debug break slot code.
Assembler::BlockTrampolinePoolScope block_trampoline_pool(masm); Assembler::BlockTrampolinePoolScope block_trampoline_pool(masm);
Label check_codesize; Label check_codesize;
__ bind(&check_codesize); __ bind(&check_codesize);
RecordRelocInfo(masm, location, call_argc);
for (int i = 0; i < Assembler::kDebugBreakSlotInstructions; i++) { for (int i = 0; i < Assembler::kDebugBreakSlotInstructions; i++) {
__ nop(MacroAssembler::DEBUG_BREAK_NOP); __ nop(MacroAssembler::DEBUG_BREAK_NOP);
} }

View File

@ -145,10 +145,13 @@ void DebugCodegen::GenerateReturnDebugBreak(MacroAssembler* masm) {
} }
void DebugCodegen::GenerateSlot(MacroAssembler* masm) { void DebugCodegen::GenerateSlot(MacroAssembler* masm,
DebugCodegen::SlotLocation location,
int call_argc) {
// Generate enough nop's to make space for a call instruction. // Generate enough nop's to make space for a call instruction.
Label check_codesize; Label check_codesize;
__ bind(&check_codesize); __ bind(&check_codesize);
RecordRelocInfo(masm, location, call_argc);
__ Nop(Assembler::kDebugBreakSlotLength); __ Nop(Assembler::kDebugBreakSlotLength);
DCHECK_EQ(Assembler::kDebugBreakSlotLength, DCHECK_EQ(Assembler::kDebugBreakSlotLength,
masm->SizeOfCodeGeneratedSince(&check_codesize)); masm->SizeOfCodeGeneratedSince(&check_codesize));