Remove special debug ExternalReferences.

R=ulan@chromium.org

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

git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@21421 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
yangguo@chromium.org 2014-05-22 07:57:33 +00:00
parent 7c30bba18a
commit 6fd69c2476
12 changed files with 50 additions and 69 deletions

View File

@ -148,7 +148,7 @@ static void Generate_DebugBreakCallHelper(MacroAssembler* masm,
// jumping to the target address intended by the caller and that was
// overwritten by the address of DebugBreakXXX.
ExternalReference after_break_target =
ExternalReference(Debug_Address::AfterBreakTarget(), masm->isolate());
ExternalReference::debug_after_break_target_address(masm->isolate());
__ mov(ip, Operand(after_break_target));
__ ldr(ip, MemOperand(ip));
__ Jump(ip);

View File

@ -207,8 +207,8 @@ static void Generate_DebugBreakCallHelper(MacroAssembler* masm,
// Now that the break point has been handled, resume normal execution by
// jumping to the target address intended by the caller and that was
// overwritten by the address of DebugBreakXXX.
ExternalReference after_break_target(Debug_Address::AfterBreakTarget(),
masm->isolate());
ExternalReference after_break_target =
ExternalReference::debug_after_break_target_address(masm->isolate());
__ Mov(scratch, after_break_target);
__ Ldr(scratch, MemOperand(scratch));
__ Br(scratch);

View File

@ -996,9 +996,6 @@ ExternalReference::ExternalReference(const IC_Utility& ic_utility,
Isolate* isolate)
: address_(Redirect(isolate, ic_utility.address())) {}
ExternalReference::ExternalReference(const Debug_Address& debug_address,
Isolate* isolate)
: address_(debug_address.address(isolate)) {}
ExternalReference::ExternalReference(StatsCounter* counter)
: address_(reinterpret_cast<Address>(counter->GetInternalPointer())) {}
@ -1431,6 +1428,20 @@ ExternalReference ExternalReference::cpu_features() {
}
ExternalReference ExternalReference::debug_after_break_target_address(
Isolate* isolate) {
return ExternalReference(isolate->debug()->after_break_target_address());
}
ExternalReference
ExternalReference::debug_restarter_frame_function_pointer_address(
Isolate* isolate) {
return ExternalReference(
isolate->debug()->restarter_frame_function_pointer_address());
}
double power_helper(double x, double y) {
int y_int = static_cast<int>(y);
if (y == y_int) {

View File

@ -794,8 +794,6 @@ class ExternalReference BASE_EMBEDDED {
ExternalReference(const IC_Utility& ic_utility, Isolate* isolate);
ExternalReference(const Debug_Address& debug_address, Isolate* isolate);
explicit ExternalReference(StatsCounter* counter);
ExternalReference(Isolate::AddressId id, Isolate* isolate);
@ -915,6 +913,10 @@ class ExternalReference BASE_EMBEDDED {
static ExternalReference cpu_features();
static ExternalReference debug_after_break_target_address(Isolate* isolate);
static ExternalReference debug_restarter_frame_function_pointer_address(
Isolate* isolate);
static ExternalReference is_profiling_address(Isolate* isolate);
static ExternalReference invoke_function_callback(Isolate* isolate);
static ExternalReference invoke_accessor_getter_callback(Isolate* isolate);

View File

@ -342,12 +342,13 @@ class Debug {
};
// Support for setting the address to jump to when returning from break point.
Address* after_break_target_address() {
return reinterpret_cast<Address*>(&thread_local_.after_break_target_);
Address after_break_target_address() {
return reinterpret_cast<Address>(&thread_local_.after_break_target_);
}
Address* restarter_frame_function_pointer_address() {
Address restarter_frame_function_pointer_address() {
Object*** address = &thread_local_.restarter_frame_function_pointer_;
return reinterpret_cast<Address*>(address);
return reinterpret_cast<Address>(address);
}
static const int kEstimatedNofDebugInfoEntries = 16;
@ -927,39 +928,6 @@ class DisableBreak BASE_EMBEDDED {
bool prev_disable_break_;
};
// Debug_Address encapsulates the Address pointers used in generating debug
// code.
class Debug_Address {
public:
explicit Debug_Address(Debug::AddressId id) : id_(id) { }
static Debug_Address AfterBreakTarget() {
return Debug_Address(Debug::k_after_break_target_address);
}
static Debug_Address RestarterFrameFunctionPointer() {
return Debug_Address(Debug::k_restarter_frame_function_pointer);
}
Address address(Isolate* isolate) const {
Debug* debug = isolate->debug();
switch (id_) {
case Debug::k_after_break_target_address:
return reinterpret_cast<Address>(debug->after_break_target_address());
case Debug::k_restarter_frame_function_pointer:
return reinterpret_cast<Address>(
debug->restarter_frame_function_pointer_address());
default:
UNREACHABLE();
return NULL;
}
}
private:
Debug::AddressId id_;
};
} } // namespace v8::internal
#endif // V8_DEBUG_H_

View File

@ -167,7 +167,7 @@ static void Generate_DebugBreakCallHelper(MacroAssembler* masm,
// jumping to the target address intended by the caller and that was
// overwritten by the address of DebugBreakXXX.
ExternalReference after_break_target =
ExternalReference(Debug_Address::AfterBreakTarget(), masm->isolate());
ExternalReference::debug_after_break_target_address(masm->isolate());
__ jmp(Operand::StaticVariable(after_break_target));
}
@ -308,8 +308,8 @@ void Debug::GeneratePlainReturnLiveEdit(MacroAssembler* masm) {
void Debug::GenerateFrameDropperLiveEdit(MacroAssembler* masm) {
ExternalReference restarter_frame_function_slot =
ExternalReference(Debug_Address::RestarterFrameFunctionPointer(),
masm->isolate());
ExternalReference::debug_restarter_frame_function_pointer_address(
masm->isolate());
__ mov(Operand::StaticVariable(restarter_frame_function_slot), Immediate(0));
// We do not know our frame height, but set esp based on ebp.

View File

@ -155,8 +155,9 @@ static void Generate_DebugBreakCallHelper(MacroAssembler* masm,
// Now that the break point has been handled, resume normal execution by
// jumping to the target address intended by the caller and that was
// overwritten by the address of DebugBreakXXX.
__ li(t9, Operand(
ExternalReference(Debug_Address::AfterBreakTarget(), masm->isolate())));
ExternalReference after_break_target =
ExternalReference::debug_after_break_target_address(masm->isolate());
__ li(t9, Operand(after_break_target));
__ lw(t9, MemOperand(t9));
__ Jump(t9);
}

View File

@ -185,16 +185,6 @@ void ExternalReferenceTable::PopulateTable(Isolate* isolate) {
isolate);
}
// Debug addresses
Add(Debug_Address(Debug::k_after_break_target_address).address(isolate),
DEBUG_ADDRESS,
Debug::k_after_break_target_address << kDebugIdShift,
"Debug::after_break_target_address()");
Add(Debug_Address(Debug::k_restarter_frame_function_pointer).address(isolate),
DEBUG_ADDRESS,
Debug::k_restarter_frame_function_pointer << kDebugIdShift,
"Debug::restarter_frame_function_pointer_address()");
// Stat counters
struct StatsRefTableEntry {
StatsCounter* (Counters::*counter)();
@ -535,6 +525,18 @@ void ExternalReferenceTable::PopulateTable(Isolate* isolate) {
66,
"InvokeAccessorGetterCallback");
// Debug addresses
Add(ExternalReference::debug_after_break_target_address(isolate).address(),
UNCLASSIFIED,
67,
"Debug::after_break_target_address()");
Add(ExternalReference::debug_restarter_frame_function_pointer_address(
isolate).address(),
UNCLASSIFIED,
68,
"Debug::restarter_frame_function_pointer_address()");
// Add a small set of deopt entry addresses to encoder without generating the
// deopt table code, which isn't possible at deserialization time.
HandleScope scope(isolate);
@ -563,7 +565,7 @@ ExternalReferenceEncoder::ExternalReferenceEncoder(Isolate* isolate)
uint32_t ExternalReferenceEncoder::Encode(Address key) const {
int index = IndexOf(key);
ASSERT(key == NULL || index >= 0);
return index >=0 ?
return index >= 0 ?
ExternalReferenceTable::instance(isolate_)->code(index) : 0;
}

View File

@ -17,7 +17,6 @@ enum TypeCode {
BUILTIN,
RUNTIME_FUNCTION,
IC_UTILITY,
DEBUG_ADDRESS,
STATS_COUNTER,
TOP_ADDRESS,
C_BUILTIN,
@ -34,8 +33,6 @@ const int kFirstTypeCode = UNCLASSIFIED;
const int kReferenceIdBits = 16;
const int kReferenceIdMask = (1 << kReferenceIdBits) - 1;
const int kReferenceTypeShift = kReferenceIdBits;
const int kDebugRegisterBits = 4;
const int kDebugIdShift = kDebugRegisterBits;
const int kDeoptTableSerializeEntryCount = 12;

View File

@ -146,7 +146,7 @@ static void Generate_DebugBreakCallHelper(MacroAssembler* masm,
// jumping to the target address intended by the caller and that was
// overwritten by the address of DebugBreakXXX.
ExternalReference after_break_target =
ExternalReference(Debug_Address::AfterBreakTarget(), masm->isolate());
ExternalReference::debug_after_break_target_address(masm->isolate());
__ Move(kScratchRegister, after_break_target);
__ Jump(Operand(kScratchRegister, 0));
}
@ -285,8 +285,8 @@ void Debug::GeneratePlainReturnLiveEdit(MacroAssembler* masm) {
void Debug::GenerateFrameDropperLiveEdit(MacroAssembler* masm) {
ExternalReference restarter_frame_function_slot =
ExternalReference(Debug_Address::RestarterFrameFunctionPointer(),
masm->isolate());
ExternalReference::debug_restarter_frame_function_pointer_address(
masm->isolate());
__ Move(rax, restarter_frame_function_slot);
__ movp(Operand(rax, 0), Immediate(0));

View File

@ -275,7 +275,7 @@ TEST(DisasmIa320) {
__ jmp(&L1);
__ jmp(Operand(ebx, ecx, times_4, 10000));
ExternalReference after_break_target =
ExternalReference(Debug_Address::AfterBreakTarget(), isolate);
ExternalReference::debug_after_break_target_address(isolate);
__ jmp(Operand::StaticVariable(after_break_target));
__ jmp(ic, RelocInfo::CODE_TARGET);
__ nop();

View File

@ -261,7 +261,7 @@ TEST(DisasmX64) {
// TODO(mstarzinger): The following is protected.
// __ jmp(Operand(rbx, rcx, times_4, 10000));
ExternalReference after_break_target =
ExternalReference(Debug_Address::AfterBreakTarget(), isolate);
ExternalReference::debug_after_break_target_address(isolate);
USE(after_break_target);
__ jmp(ic, RelocInfo::CODE_TARGET);
__ nop();