Move CPU-specific constants from debug.h into the platform-specific directories.
The constant for the return sequence length (JSReturnSequenceLength) was defined in debug.h. Since this constant are also needed outside the debugger code I moved them into assembler-xxx.h. Otherwise compiling with debuggersupport=off would fail on ARM. BUG=http://code.google.com/p/v8/issues/detail?id=533 Review URL: http://codereview.chromium.org/456001 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@3383 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
parent
dd38c22699
commit
5debbc3693
@ -566,6 +566,7 @@ class Assembler : public Malloced {
|
||||
// register.
|
||||
static const int kPcLoadDelta = 8;
|
||||
|
||||
static const int kJSReturnSequenceLength = 4;
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Code generation
|
||||
|
@ -326,7 +326,7 @@ void CodeGenerator::GenCode(FunctionLiteral* fun) {
|
||||
// Calculate the exact length of the return sequence and make sure that
|
||||
// the constant pool is not emitted inside of the return sequence.
|
||||
int32_t sp_delta = (scope_->num_parameters() + 1) * kPointerSize;
|
||||
int return_sequence_length = Debug::kARMJSReturnSequenceLength;
|
||||
int return_sequence_length = Assembler::kJSReturnSequenceLength;
|
||||
if (!masm_->ImmediateFitsAddrMode1Instruction(sp_delta)) {
|
||||
// Additional mov instruction generated.
|
||||
return_sequence_length++;
|
||||
|
@ -61,7 +61,7 @@ void BreakLocationIterator::SetDebugBreakAtReturn() {
|
||||
// Restore the JS frame exit code.
|
||||
void BreakLocationIterator::ClearDebugBreakAtReturn() {
|
||||
rinfo()->PatchCode(original_rinfo()->pc(),
|
||||
Debug::kARMJSReturnSequenceLength);
|
||||
Assembler::kJSReturnSequenceLength);
|
||||
}
|
||||
|
||||
|
||||
|
@ -188,7 +188,7 @@ void FastCodeGenerator::EmitReturnSequence(int position) {
|
||||
// the constant pool is not emitted inside of the return sequence.
|
||||
int num_parameters = function_->scope()->num_parameters();
|
||||
int32_t sp_delta = (num_parameters + 1) * kPointerSize;
|
||||
int return_sequence_length = Debug::kARMJSReturnSequenceLength;
|
||||
int return_sequence_length = Assembler::kJSReturnSequenceLength;
|
||||
if (!masm_->ImmediateFitsAddrMode1Instruction(sp_delta)) {
|
||||
// Additional mov instruction generated.
|
||||
return_sequence_length++;
|
||||
|
11
src/debug.h
11
src/debug.h
@ -370,17 +370,6 @@ class Debug {
|
||||
// Garbage collection notifications.
|
||||
static void AfterGarbageCollection();
|
||||
|
||||
// Code generation assumptions.
|
||||
static const int kIa32CallInstructionLength = 5;
|
||||
static const int kIa32JSReturnSequenceLength = 6;
|
||||
|
||||
// The x64 JS return sequence is padded with int3 to make it large
|
||||
// enough to hold a call instruction when the debugger patches it.
|
||||
static const int kX64CallInstructionLength = 13;
|
||||
static const int kX64JSReturnSequenceLength = 13;
|
||||
|
||||
static const int kARMJSReturnSequenceLength = 4;
|
||||
|
||||
// Code generator routines.
|
||||
static void GenerateLoadICDebugBreak(MacroAssembler* masm);
|
||||
static void GenerateStoreICDebugBreak(MacroAssembler* masm);
|
||||
|
@ -464,6 +464,8 @@ class Assembler : public Malloced {
|
||||
// to jump to.
|
||||
static const int kPatchReturnSequenceAddressOffset = 1; // JMP imm32.
|
||||
|
||||
static const int kCallInstructionLength = 5;
|
||||
static const int kJSReturnSequenceLength = 6;
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Code generation
|
||||
|
@ -2490,7 +2490,7 @@ void CodeGenerator::GenerateReturnSequence(Result* return_value) {
|
||||
#ifdef ENABLE_DEBUGGER_SUPPORT
|
||||
// Check that the size of the code used for returning matches what is
|
||||
// expected by the debugger.
|
||||
ASSERT_EQ(Debug::kIa32JSReturnSequenceLength,
|
||||
ASSERT_EQ(Assembler::kJSReturnSequenceLength,
|
||||
masm_->SizeOfCodeGeneratedSince(&check_exit_codesize));
|
||||
#endif
|
||||
}
|
||||
|
@ -45,17 +45,17 @@ bool BreakLocationIterator::IsDebugBreakAtReturn() {
|
||||
// CodeGenerator::VisitReturnStatement and VirtualFrame::Exit in codegen-ia32.cc
|
||||
// for the precise return instructions sequence.
|
||||
void BreakLocationIterator::SetDebugBreakAtReturn() {
|
||||
ASSERT(Debug::kIa32JSReturnSequenceLength >=
|
||||
Debug::kIa32CallInstructionLength);
|
||||
ASSERT(Assembler::kJSReturnSequenceLength >=
|
||||
Assembler::kCallInstructionLength);
|
||||
rinfo()->PatchCodeWithCall(Debug::debug_break_return()->entry(),
|
||||
Debug::kIa32JSReturnSequenceLength - Debug::kIa32CallInstructionLength);
|
||||
Assembler::kJSReturnSequenceLength - Assembler::kCallInstructionLength);
|
||||
}
|
||||
|
||||
|
||||
// Restore the JS frame exit code.
|
||||
void BreakLocationIterator::ClearDebugBreakAtReturn() {
|
||||
rinfo()->PatchCode(original_rinfo()->pc(),
|
||||
Debug::kIa32JSReturnSequenceLength);
|
||||
Assembler::kJSReturnSequenceLength);
|
||||
}
|
||||
|
||||
|
||||
|
@ -187,7 +187,7 @@ void FastCodeGenerator::EmitReturnSequence(int position) {
|
||||
#ifdef ENABLE_DEBUGGER_SUPPORT
|
||||
// Check that the size of the code used for returning matches what is
|
||||
// expected by the debugger.
|
||||
ASSERT_EQ(Debug::kIa32JSReturnSequenceLength,
|
||||
ASSERT_EQ(Assembler::kJSReturnSequenceLength,
|
||||
masm_->SizeOfCodeGeneratedSince(&check_exit_codesize));
|
||||
#endif
|
||||
}
|
||||
|
@ -482,6 +482,12 @@ class Assembler : public Malloced {
|
||||
static const int kPatchReturnSequenceAddressOffset = 13 - 4;
|
||||
// TODO(X64): Rename this, removing the "Real", after changing the above.
|
||||
static const int kRealPatchReturnSequenceAddressOffset = 2;
|
||||
|
||||
// The x64 JS return sequence is padded with int3 to make it large
|
||||
// enough to hold a call instruction when the debugger patches it.
|
||||
static const int kCallInstructionLength = 13;
|
||||
static const int kJSReturnSequenceLength = 13;
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Code generation
|
||||
//
|
||||
|
@ -505,13 +505,13 @@ void CodeGenerator::GenerateReturnSequence(Result* return_value) {
|
||||
// Add padding that will be overwritten by a debugger breakpoint.
|
||||
// frame_->Exit() generates "movq rsp, rbp; pop rbp; ret k"
|
||||
// with length 7 (3 + 1 + 3).
|
||||
const int kPadding = Debug::kX64JSReturnSequenceLength - 7;
|
||||
const int kPadding = Assembler::kJSReturnSequenceLength - 7;
|
||||
for (int i = 0; i < kPadding; ++i) {
|
||||
masm_->int3();
|
||||
}
|
||||
// Check that the size of the code used for returning matches what is
|
||||
// expected by the debugger.
|
||||
ASSERT_EQ(Debug::kX64JSReturnSequenceLength,
|
||||
ASSERT_EQ(Assembler::kJSReturnSequenceLength,
|
||||
masm_->SizeOfCodeGeneratedSince(&check_exit_codesize));
|
||||
#endif
|
||||
DeleteFrame();
|
||||
|
@ -181,7 +181,7 @@ void Debug::GenerateStubNoRegistersDebugBreak(MacroAssembler* masm) {
|
||||
|
||||
void BreakLocationIterator::ClearDebugBreakAtReturn() {
|
||||
rinfo()->PatchCode(original_rinfo()->pc(),
|
||||
Debug::kX64JSReturnSequenceLength);
|
||||
Assembler::kJSReturnSequenceLength);
|
||||
}
|
||||
|
||||
|
||||
@ -191,9 +191,10 @@ bool BreakLocationIterator::IsDebugBreakAtReturn() {
|
||||
|
||||
|
||||
void BreakLocationIterator::SetDebugBreakAtReturn() {
|
||||
ASSERT(Debug::kX64JSReturnSequenceLength >= Debug::kX64CallInstructionLength);
|
||||
ASSERT(Assembler::kJSReturnSequenceLength >=
|
||||
Assembler::kCallInstructionLength);
|
||||
rinfo()->PatchCodeWithCall(Debug::debug_break_return()->entry(),
|
||||
Debug::kX64JSReturnSequenceLength - Debug::kX64CallInstructionLength);
|
||||
Assembler::kJSReturnSequenceLength - Assembler::kCallInstructionLength);
|
||||
}
|
||||
|
||||
#endif // ENABLE_DEBUGGER_SUPPORT
|
||||
|
@ -189,13 +189,13 @@ void FastCodeGenerator::EmitReturnSequence(int position) {
|
||||
// Add padding that will be overwritten by a debugger breakpoint. We
|
||||
// have just generated "movq rsp, rbp; pop rbp; ret k" with length 7
|
||||
// (3 + 1 + 3).
|
||||
const int kPadding = Debug::kX64JSReturnSequenceLength - 7;
|
||||
const int kPadding = Assembler::kJSReturnSequenceLength - 7;
|
||||
for (int i = 0; i < kPadding; ++i) {
|
||||
masm_->int3();
|
||||
}
|
||||
// Check that the size of the code used for returning matches what is
|
||||
// expected by the debugger.
|
||||
ASSERT_EQ(Debug::kX64JSReturnSequenceLength,
|
||||
ASSERT_EQ(Assembler::kJSReturnSequenceLength,
|
||||
masm_->SizeOfCodeGeneratedSince(&check_exit_codesize));
|
||||
#endif
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user