Revision: 19827
Author: [email protected]
Date: Tue Mar 11 21:46:26 2014 UTC
Log: Revert "Pass a Code object to Assembler::(set_)target_address_at
for use by ool constant pool."
This reverts r19825 for breaking ia32.debug checks.
Original Review URL: https://codereview.chromium.org/183803022
Update serializer to be able to deal with ool constant pool.
[email protected]
Review URL: https://codereview.chromium.org/195373004
http://code.google.com/p/v8/source/detail?r=19827
Modified:
/branches/bleeding_edge/src/a64/assembler-a64-inl.h
/branches/bleeding_edge/src/a64/assembler-a64.h
/branches/bleeding_edge/src/a64/frames-a64.h
/branches/bleeding_edge/src/arm/assembler-arm-inl.h
/branches/bleeding_edge/src/arm/assembler-arm.h
/branches/bleeding_edge/src/debug.cc
/branches/bleeding_edge/src/ia32/assembler-ia32-inl.h
/branches/bleeding_edge/src/ia32/assembler-ia32.h
/branches/bleeding_edge/src/ia32/frames-ia32.h
/branches/bleeding_edge/src/ia32/full-codegen-ia32.cc
/branches/bleeding_edge/src/ic-inl.h
/branches/bleeding_edge/src/ic.cc
/branches/bleeding_edge/src/ic.h
/branches/bleeding_edge/src/objects-visiting-inl.h
/branches/bleeding_edge/src/objects.cc
/branches/bleeding_edge/src/serialize.cc
/branches/bleeding_edge/src/x64/assembler-x64-inl.h
/branches/bleeding_edge/src/x64/assembler-x64.h
/branches/bleeding_edge/src/x64/frames-x64.h
/branches/bleeding_edge/src/x64/full-codegen-x64.cc
=======================================
--- /branches/bleeding_edge/src/a64/assembler-a64-inl.h Tue Mar 11 20:31:23
2014 UTC
+++ /branches/bleeding_edge/src/a64/assembler-a64-inl.h Tue Mar 11 21:46:26
2014 UTC
@@ -44,7 +44,7 @@
void RelocInfo::set_target_address(Address target, WriteBarrierMode mode) {
ASSERT(IsCodeTarget(rmode_) || IsRuntimeEntry(rmode_));
- Assembler::set_target_address_at(pc_, host_, target);
+ Assembler::set_target_address_at(pc_, target);
if (mode == UPDATE_WRITE_BARRIER && host() != NULL &&
IsCodeTarget(rmode_)) {
Object* target_code = Code::GetCodeFromTargetAddress(target);
host()->GetHeap()->incremental_marking()->RecordWriteIntoCode(
@@ -558,16 +558,9 @@
// Read/Modify the code target address in the branch/call instruction at
pc.
-Address Assembler::target_address_at(Address pc,
- ConstantPoolArray* constant_pool) {
+Address Assembler::target_address_at(Address pc) {
return Memory::Address_at(target_pointer_address_at(pc));
}
-
-
-Address Assembler::target_address_at(Address pc, Code* code) {
- ConstantPoolArray* constant_pool = code ? code->constant_pool() : NULL;
- return target_address_at(pc, constant_pool);
-}
Address Assembler::target_address_from_return_address(Address pc) {
@@ -623,14 +616,12 @@
void Assembler::deserialization_set_special_target_at(
- Address constant_pool_entry, Code* code, Address target) {
+ Address constant_pool_entry, Address target) {
Memory::Address_at(constant_pool_entry) = target;
}
-void Assembler::set_target_address_at(Address pc,
- ConstantPoolArray* constant_pool,
- Address target) {
+void Assembler::set_target_address_at(Address pc, Address target) {
Memory::Address_at(target_pointer_address_at(pc)) = target;
// Intuitively, we would think it is necessary to always flush the
// instruction cache after patching a target address in the code as
follows:
@@ -641,14 +632,6 @@
// since the instruction accessing this address in the constant pool
remains
// unchanged, a flush is not required.
}
-
-
-void Assembler::set_target_address_at(Address pc,
- Code* code,
- Address target) {
- ConstantPoolArray* constant_pool = code ? code->constant_pool() : NULL;
- set_target_address_at(pc, constant_pool, target);
-}
int RelocInfo::target_address_size() {
@@ -658,7 +641,7 @@
Address RelocInfo::target_address() {
ASSERT(IsCodeTarget(rmode_) || IsRuntimeEntry(rmode_));
- return Assembler::target_address_at(pc_, host_);
+ return Assembler::target_address_at(pc_);
}
@@ -678,22 +661,21 @@
Object* RelocInfo::target_object() {
ASSERT(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT);
- return reinterpret_cast<Object*>(Assembler::target_address_at(pc_,
host_));
+ return reinterpret_cast<Object*>(Assembler::target_address_at(pc_));
}
Handle<Object> RelocInfo::target_object_handle(Assembler* origin) {
ASSERT(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT);
return Handle<Object>(reinterpret_cast<Object**>(
- Assembler::target_address_at(pc_, host_)));
+ Assembler::target_address_at(pc_)));
}
void RelocInfo::set_target_object(Object* target, WriteBarrierMode mode) {
ASSERT(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT);
ASSERT(!target->IsConsString());
- Assembler::set_target_address_at(pc_, host_,
- reinterpret_cast<Address>(target));
+ Assembler::set_target_address_at(pc_, reinterpret_cast<Address>(target));
if (mode == UPDATE_WRITE_BARRIER &&
host() != NULL &&
target->IsHeapObject()) {
@@ -705,7 +687,7 @@
Address RelocInfo::target_reference() {
ASSERT(rmode_ == EXTERNAL_REFERENCE);
- return Assembler::target_address_at(pc_, host_);
+ return Assembler::target_address_at(pc_);
}
@@ -774,14 +756,14 @@
(IsDebugBreakSlot(rmode()) && IsPatchedDebugBreakSlotSequence()));
// For the above sequences the Relocinfo points to the load literal
loading
// the call address.
- return Assembler::target_address_at(pc_, host_);
+ return Assembler::target_address_at(pc_);
}
void RelocInfo::set_call_address(Address target) {
ASSERT((IsJSReturn(rmode()) && IsPatchedReturnSequence()) ||
(IsDebugBreakSlot(rmode()) && IsPatchedDebugBreakSlotSequence()));
- Assembler::set_target_address_at(pc_, host_, target);
+ Assembler::set_target_address_at(pc_, target);
if (host() != NULL) {
Object* target_code = Code::GetCodeFromTargetAddress(target);
host()->GetHeap()->incremental_marking()->RecordWriteIntoCode(
@@ -795,7 +777,7 @@
IsCodeTarget(rmode_) ||
IsRuntimeEntry(rmode_) ||
IsExternalReference(rmode_));
- Assembler::set_target_address_at(pc_, host_, NULL);
+ Assembler::set_target_address_at(pc_, NULL);
}
=======================================
--- /branches/bleeding_edge/src/a64/assembler-a64.h Tue Mar 11 20:31:23
2014 UTC
+++ /branches/bleeding_edge/src/a64/assembler-a64.h Tue Mar 11 21:46:26
2014 UTC
@@ -780,15 +780,8 @@
inline static Address target_pointer_address_at(Address pc);
// Read/Modify the code target address in the branch/call instruction at
pc.
- inline static Address target_address_at(Address pc,
- ConstantPoolArray*
constant_pool);
- inline static void set_target_address_at(Address pc,
- ConstantPoolArray*
constant_pool,
- Address target);
- static inline Address target_address_at(Address pc, Code* code);
- static inline void set_target_address_at(Address pc,
- Code* code,
- Address target);
+ inline static Address target_address_at(Address pc);
+ inline static void set_target_address_at(Address pc, Address target);
// Return the code target address at a call site from the return address
of
// that call in the instruction stream.
@@ -801,7 +794,7 @@
// This sets the branch destination (which is in the constant pool on
ARM).
// This is for calls and branches within generated code.
inline static void deserialization_set_special_target_at(
- Address constant_pool_entry, Code* code, Address target);
+ Address constant_pool_entry, Address target);
// All addresses in the constant pool are the same size as pointers.
static const int kSpecialTargetSize = kPointerSize;
=======================================
--- /branches/bleeding_edge/src/a64/frames-a64.h Tue Mar 11 20:31:23 2014
UTC
+++ /branches/bleeding_edge/src/a64/frames-a64.h Tue Mar 11 21:46:26 2014
UTC
@@ -69,8 +69,6 @@
static const int kSPOffset = -1 * kPointerSize;
static const int kCodeOffset = -2 * kPointerSize;
static const int kLastExitFrameField = kCodeOffset;
-
- static const int kConstantPoolOffset = 0; // Not used
};
=======================================
--- /branches/bleeding_edge/src/arm/assembler-arm-inl.h Tue Mar 11 20:31:23
2014 UTC
+++ /branches/bleeding_edge/src/arm/assembler-arm-inl.h Tue Mar 11 21:46:26
2014 UTC
@@ -101,7 +101,7 @@
Address RelocInfo::target_address() {
ASSERT(IsCodeTarget(rmode_) || IsRuntimeEntry(rmode_));
- return Assembler::target_address_at(pc_, host_);
+ return Assembler::target_address_at(pc_);
}
@@ -127,7 +127,7 @@
void RelocInfo::set_target_address(Address target, WriteBarrierMode mode) {
ASSERT(IsCodeTarget(rmode_) || IsRuntimeEntry(rmode_));
- Assembler::set_target_address_at(pc_, host_, target);
+ Assembler::set_target_address_at(pc_, target);
if (mode == UPDATE_WRITE_BARRIER && host() != NULL &&
IsCodeTarget(rmode_)) {
Object* target_code = Code::GetCodeFromTargetAddress(target);
host()->GetHeap()->incremental_marking()->RecordWriteIntoCode(
@@ -138,22 +138,21 @@
Object* RelocInfo::target_object() {
ASSERT(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT);
- return reinterpret_cast<Object*>(Assembler::target_address_at(pc_,
host_));
+ return reinterpret_cast<Object*>(Assembler::target_address_at(pc_));
}
Handle<Object> RelocInfo::target_object_handle(Assembler* origin) {
ASSERT(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT);
return Handle<Object>(reinterpret_cast<Object**>(
- Assembler::target_address_at(pc_, host_)));
+ Assembler::target_address_at(pc_)));
}
void RelocInfo::set_target_object(Object* target, WriteBarrierMode mode) {
ASSERT(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT);
ASSERT(!target->IsConsString());
- Assembler::set_target_address_at(pc_, host_,
- reinterpret_cast<Address>(target));
+ Assembler::set_target_address_at(pc_, reinterpret_cast<Address>(target));
if (mode == UPDATE_WRITE_BARRIER &&
host() != NULL &&
target->IsHeapObject()) {
@@ -165,7 +164,7 @@
Address RelocInfo::target_reference() {
ASSERT(rmode_ == EXTERNAL_REFERENCE);
- return Assembler::target_address_at(pc_, host_);
+ return Assembler::target_address_at(pc_);
}
@@ -276,7 +275,7 @@
IsCodeTarget(rmode_) ||
IsRuntimeEntry(rmode_) ||
IsExternalReference(rmode_));
- Assembler::set_target_address_at(pc_, host_, NULL);
+ Assembler::set_target_address_at(pc_, NULL);
}
@@ -410,8 +409,7 @@
}
-Address Assembler::target_address_at(Address pc,
- ConstantPoolArray* constant_pool) {
+Address Assembler::target_address_at(Address pc) {
if (IsMovW(Memory::int32_at(pc))) {
ASSERT(IsMovT(Memory::int32_at(pc + kInstrSize)));
Instruction* instr = Instruction::At(pc);
@@ -461,7 +459,7 @@
void Assembler::deserialization_set_special_target_at(
- Address constant_pool_entry, Code* code, Address target) {
+ Address constant_pool_entry, Address target) {
Memory::Address_at(constant_pool_entry) = target;
}
@@ -472,9 +470,7 @@
}
-void Assembler::set_target_address_at(Address pc,
- ConstantPoolArray* constant_pool,
- Address target) {
+void Assembler::set_target_address_at(Address pc, Address target) {
if (IsMovW(Memory::int32_at(pc))) {
ASSERT(IsMovT(Memory::int32_at(pc + kInstrSize)));
uint32_t* instr_ptr = reinterpret_cast<uint32_t*>(pc);
=======================================
--- /branches/bleeding_edge/src/arm/assembler-arm.h Tue Mar 11 20:31:23
2014 UTC
+++ /branches/bleeding_edge/src/arm/assembler-arm.h Tue Mar 11 21:46:26
2014 UTC
@@ -780,27 +780,9 @@
// the branch/call instruction at pc, or the object in a mov.
INLINE(static Address target_pointer_address_at(Address pc));
- // Return the address in the constant pool of the code target address
used by
- // the branch/call instruction at pc, or the object in a mov.
- INLINE(static Address target_constant_pool_address_at(
- Address pc, ConstantPoolArray* constant_pool));
-
// Read/Modify the code target address in the branch/call instruction at
pc.
- INLINE(static Address target_address_at(Address pc,
- ConstantPoolArray*
constant_pool));
- INLINE(static void set_target_address_at(Address pc,
- ConstantPoolArray*
constant_pool,
- Address target));
- INLINE(static Address target_address_at(Address pc, Code* code)) {
- ConstantPoolArray* constant_pool = code ? code->constant_pool() : NULL;
- return target_address_at(pc, constant_pool);
- }
- INLINE(static void set_target_address_at(Address pc,
- Code* code,
- Address target)) {
- ConstantPoolArray* constant_pool = code ? code->constant_pool() : NULL;
- set_target_address_at(pc, constant_pool, target);
- }
+ INLINE(static Address target_address_at(Address pc));
+ INLINE(static void set_target_address_at(Address pc, Address target));
// Return the code target address at a call site from the return address
// of that call in the instruction stream.
@@ -813,7 +795,7 @@
// This sets the branch destination (which is in the constant pool on
ARM).
// This is for calls and branches within generated code.
inline static void deserialization_set_special_target_at(
- Address constant_pool_entry, Code* code, Address target);
+ Address constant_pool_entry, Address target);
// Here we are patching the address in the constant pool, not the actual
call
// instruction. The address in the constant pool is the same size as a
=======================================
--- /branches/bleeding_edge/src/debug.cc Tue Mar 11 20:31:23 2014 UTC
+++ /branches/bleeding_edge/src/debug.cc Tue Mar 11 21:46:26 2014 UTC
@@ -2359,7 +2359,7 @@
// Continue just after the slot.
thread_local_.after_break_target_ = addr +
Assembler::kDebugBreakSlotLength;
- } else if (IsDebugBreak(Assembler::target_address_at(addr, *code))) {
+ } else if (IsDebugBreak(Assembler::target_address_at(addr))) {
// We now know that there is still a debug break call at the target
address,
// so the break point is still there and the original code will hold
the
// address to jump to in order to complete the call which is replaced
by a
@@ -2370,15 +2370,13 @@
// Install jump to the call address in the original code. This will be
the
// call which was overwritten by the call to DebugBreakXXX.
- thread_local_.after_break_target_ =
- Assembler::target_address_at(addr, *original_code);
+ thread_local_.after_break_target_ = Assembler::target_address_at(addr);
} else {
// There is no longer a break point present. Don't try to look in the
// original code as the running code will have the right address. This
takes
// care of the case where the last break point is removed from the
function
// and therefore no "original code" is available.
- thread_local_.after_break_target_ =
- Assembler::target_address_at(addr, *code);
+ thread_local_.after_break_target_ = Assembler::target_address_at(addr);
}
}
=======================================
--- /branches/bleeding_edge/src/ia32/assembler-ia32-inl.h Tue Mar 11
20:31:23 2014 UTC
+++ /branches/bleeding_edge/src/ia32/assembler-ia32-inl.h Tue Mar 11
21:46:26 2014 UTC
@@ -85,7 +85,7 @@
Address RelocInfo::target_address() {
ASSERT(IsCodeTarget(rmode_) || IsRuntimeEntry(rmode_));
- return Assembler::target_address_at(pc_, host_);
+ return Assembler::target_address_at(pc_);
}
@@ -109,7 +109,7 @@
void RelocInfo::set_target_address(Address target, WriteBarrierMode mode) {
- Assembler::set_target_address_at(pc_, host_, target);
+ Assembler::set_target_address_at(pc_, target);
ASSERT(IsCodeTarget(rmode_) || IsRuntimeEntry(rmode_));
if (mode == UPDATE_WRITE_BARRIER && host() != NULL &&
IsCodeTarget(rmode_)) {
Object* target_code = Code::GetCodeFromTargetAddress(target);
@@ -202,28 +202,28 @@
ASSERT(rmode_ == RelocInfo::CODE_AGE_SEQUENCE);
ASSERT(*pc_ == kCallOpcode);
return Code::GetCodeFromTargetAddress(
- Assembler::target_address_at(pc_ + 1, host_));
+ Assembler::target_address_at(pc_ + 1));
}
void RelocInfo::set_code_age_stub(Code* stub) {
ASSERT(*pc_ == kCallOpcode);
ASSERT(rmode_ == RelocInfo::CODE_AGE_SEQUENCE);
- Assembler::set_target_address_at(pc_ + 1, host_,
stub->instruction_start());
+ Assembler::set_target_address_at(pc_ + 1, stub->instruction_start());
}
Address RelocInfo::call_address() {
ASSERT((IsJSReturn(rmode()) && IsPatchedReturnSequence()) ||
(IsDebugBreakSlot(rmode()) && IsPatchedDebugBreakSlotSequence()));
- return Assembler::target_address_at(pc_ + 1, host_);
+ return Assembler::target_address_at(pc_ + 1);
}
void RelocInfo::set_call_address(Address target) {
ASSERT((IsJSReturn(rmode()) && IsPatchedReturnSequence()) ||
(IsDebugBreakSlot(rmode()) && IsPatchedDebugBreakSlotSequence()));
- Assembler::set_target_address_at(pc_ + 1, host_, target);
+ Assembler::set_target_address_at(pc_ + 1, target);
if (host() != NULL) {
Object* target_code = Code::GetCodeFromTargetAddress(target);
host()->GetHeap()->incremental_marking()->RecordWriteIntoCode(
@@ -254,7 +254,7 @@
Memory::Address_at(pc_) = NULL;
} else if (IsCodeTarget(rmode_) || IsRuntimeEntry(rmode_)) {
// Effectively write zero into the relocation.
- Assembler::set_target_address_at(pc_, host_, pc_ + sizeof(int32_t));
+ Assembler::set_target_address_at(pc_, pc_ + sizeof(int32_t));
} else {
UNREACHABLE();
}
@@ -445,15 +445,12 @@
}
-Address Assembler::target_address_at(Address pc,
- ConstantPoolArray* constant_pool) {
+Address Assembler::target_address_at(Address pc) {
return pc + sizeof(int32_t) + *reinterpret_cast<int32_t*>(pc);
}
-void Assembler::set_target_address_at(Address pc,
- ConstantPoolArray* constant_pool,
- Address target) {
+void Assembler::set_target_address_at(Address pc, Address target) {
int32_t* p = reinterpret_cast<int32_t*>(pc);
*p = target - (pc + sizeof(int32_t));
CPU::FlushICache(p, sizeof(int32_t));
=======================================
--- /branches/bleeding_edge/src/ia32/assembler-ia32.h Tue Mar 11 20:31:23
2014 UTC
+++ /branches/bleeding_edge/src/ia32/assembler-ia32.h Tue Mar 11 21:46:26
2014 UTC
@@ -624,19 +624,8 @@
void GetCode(CodeDesc* desc);
// Read/Modify the code target in the branch/call instruction at pc.
- inline static Address target_address_at(Address pc,
- ConstantPoolArray*
constant_pool);
- inline static void set_target_address_at(Address pc,
- ConstantPoolArray*
constant_pool,
- Address target);
- static inline Address target_address_at(Address pc, Code* code) {
- return target_address_at(pc, code->constant_pool());
- }
- static inline void set_target_address_at(Address pc,
- Code* code,
- Address target) {
- set_target_address_at(pc, code->constant_pool(), target);
- }
+ inline static Address target_address_at(Address pc);
+ inline static void set_target_address_at(Address pc, Address target);
// Return the code target address at a call site from the return address
// of that call in the instruction stream.
@@ -645,8 +634,8 @@
// This sets the branch destination (which is in the instruction on x86).
// This is for calls and branches within generated code.
inline static void deserialization_set_special_target_at(
- Address instruction_payload, Code* code, Address target) {
- set_target_address_at(instruction_payload, code, target);
+ Address instruction_payload, Address target) {
+ set_target_address_at(instruction_payload, target);
}
static const int kSpecialTargetSize = kPointerSize;
=======================================
--- /branches/bleeding_edge/src/ia32/frames-ia32.h Tue Mar 11 20:31:23 2014
UTC
+++ /branches/bleeding_edge/src/ia32/frames-ia32.h Tue Mar 11 21:46:26 2014
UTC
@@ -84,8 +84,6 @@
// FP-relative displacement of the caller's SP. It points just
// below the saved PC.
static const int kCallerSPDisplacement = +2 * kPointerSize;
-
- static const int kConstantPoolOffset = 0; // Not used
};
=======================================
--- /branches/bleeding_edge/src/ia32/full-codegen-ia32.cc Tue Mar 11
20:31:23 2014 UTC
+++ /branches/bleeding_edge/src/ia32/full-codegen-ia32.cc Tue Mar 11
21:46:26 2014 UTC
@@ -4863,7 +4863,6 @@
}
Assembler::set_target_address_at(call_target_address,
- unoptimized_code,
replacement_code->entry());
unoptimized_code->GetHeap()->incremental_marking()->RecordCodeTargetPatch(
unoptimized_code, call_target_address, replacement_code);
@@ -4881,22 +4880,20 @@
if (*jns_instr_address == kJnsInstruction) {
ASSERT_EQ(kJnsOffset, *(call_target_address - 2));
ASSERT_EQ(isolate->builtins()->InterruptCheck()->entry(),
- Assembler::target_address_at(call_target_address,
- unoptimized_code));
+ Assembler::target_address_at(call_target_address));
return INTERRUPT;
}
ASSERT_EQ(kNopByteOne, *jns_instr_address);
ASSERT_EQ(kNopByteTwo, *(call_target_address - 2));
- if (Assembler::target_address_at(call_target_address, unoptimized_code)
==
+ if (Assembler::target_address_at(call_target_address) ==
isolate->builtins()->OnStackReplacement()->entry()) {
return ON_STACK_REPLACEMENT;
}
ASSERT_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(),
- Assembler::target_address_at(call_target_address,
- unoptimized_code));
+ Assembler::target_address_at(call_target_address));
return OSR_AFTER_STACK_CHECK;
}
=======================================
--- /branches/bleeding_edge/src/ic-inl.h Tue Mar 11 20:31:23 2014 UTC
+++ /branches/bleeding_edge/src/ic-inl.h Tue Mar 11 21:46:26 2014 UTC
@@ -50,20 +50,12 @@
// At least one break point is active perform additional test to ensure
that
// break point locations are updated correctly.
- if (debug->IsDebugBreak(Assembler::target_address_at(result,
-
raw_constant_pool()))) {
+ if (debug->IsDebugBreak(Assembler::target_address_at(result))) {
// If the call site is a call to debug break then return the address in
// the original code instead of the address in the running code. This
will
// cause the original code to be updated and keeps the breakpoint
active in
// the running code.
- Code* code = GetCode();
- Code* original_code = GetOriginalCode();
- intptr_t delta =
- original_code->instruction_start() - code->instruction_start();
- // Return the address in the original code. This is the place where
- // the call which has been overwritten by the DebugBreakXXX resides
- // and the place where the inline cache system should look.
- return result + delta;
+ return OriginalCodeAddress();
} else {
// No break point here just return the address of the call.
return result;
@@ -74,45 +66,9 @@
}
-ConstantPoolArray* IC::constant_pool() const {
- if (!FLAG_enable_ool_constant_pool) {
- return NULL;
- } else {
- Handle<ConstantPoolArray> result = raw_constant_pool_;
-#ifdef ENABLE_DEBUGGER_SUPPORT
- Debug* debug = isolate()->debug();
- // First check if any break points are active if not just return the
- // original constant pool.
- if (!debug->has_break_points()) return *result;
-
- // At least one break point is active perform additional test to
ensure that
- // break point locations are updated correctly.
- Address target = Assembler::target_address_from_return_address(pc());
- if (debug->IsDebugBreak(
- Assembler::target_address_at(target, raw_constant_pool()))) {
- // If the call site is a call to debug break then we want to return
the
- // constant pool for the original code instead of the breakpointed
code.
- return GetOriginalCode()->constant_pool();
- }
-#endif
- return *result;
- }
-}
-
-
-ConstantPoolArray* IC::raw_constant_pool() const {
- if (FLAG_enable_ool_constant_pool) {
- return *raw_constant_pool_;
- } else {
- return NULL;
- }
-}
-
-
-Code* IC::GetTargetAtAddress(Address address,
- ConstantPoolArray* constant_pool) {
+Code* IC::GetTargetAtAddress(Address address) {
// Get the target address of the IC.
- Address target = Assembler::target_address_at(address, constant_pool);
+ Address target = Assembler::target_address_at(address);
// Convert target address to the code object.
Code::GetCodeFromTargetAddress
// is safe for use during GC where the map might be marked.
Code* result = Code::GetCodeFromTargetAddress(target);
@@ -121,12 +77,10 @@
}
-void IC::SetTargetAtAddress(Address address,
- Code* target,
- ConstantPoolArray* constant_pool) {
+void IC::SetTargetAtAddress(Address address, Code* target) {
ASSERT(target->is_inline_cache_stub() || target->is_compare_ic_stub());
Heap* heap = target->GetHeap();
- Code* old_target = GetTargetAtAddress(address, constant_pool);
+ Code* old_target = GetTargetAtAddress(address);
#ifdef DEBUG
// STORE_IC and KEYED_STORE_IC use Code::extra_ic_state() to mark
// ICs as strict mode. The strict-ness of the IC must be preserved.
@@ -136,8 +90,7 @@
StoreIC::GetStrictMode(target->extra_ic_state()));
}
#endif
- Assembler::set_target_address_at(
- address, constant_pool, target->instruction_start());
+ Assembler::set_target_address_at(address, target->instruction_start());
if (heap->gc_state() == Heap::MARK_COMPACT) {
heap->mark_compact_collector()->RecordCodeTargetPatch(address, target);
} else {
=======================================
--- /branches/bleeding_edge/src/ic.cc Tue Mar 11 20:31:23 2014 UTC
+++ /branches/bleeding_edge/src/ic.cc Tue Mar 11 21:46:26 2014 UTC
@@ -127,11 +127,6 @@
// running DeltaBlue and a ~25% speedup of gbemu with the '--nouse-ic'
flag.
const Address entry =
Isolate::c_entry_fp(isolate->thread_local_top());
- Address constant_pool = NULL;
- if (FLAG_enable_ool_constant_pool) {
- constant_pool = Memory::Address_at(
- entry + ExitFrameConstants::kConstantPoolOffset);
- }
Address* pc_address =
reinterpret_cast<Address*>(entry +
ExitFrameConstants::kCallerPCOffset);
Address fp = Memory::Address_at(entry +
ExitFrameConstants::kCallerFPOffset);
@@ -139,10 +134,6 @@
// StubFailureTrampoline, we need to look one frame further down the
stack to
// find the frame pointer and the return address stack slot.
if (depth == EXTRA_CALL_FRAME) {
- if (FLAG_enable_ool_constant_pool) {
- constant_pool = Memory::Address_at(
- fp + StandardFrameConstants::kConstantPoolOffset);
- }
const int kCallerPCOffset = StandardFrameConstants::kCallerPCOffset;
pc_address = reinterpret_cast<Address*>(fp + kCallerPCOffset);
fp = Memory::Address_at(fp + StandardFrameConstants::kCallerFPOffset);
@@ -154,11 +145,6 @@
ASSERT(fp == frame->fp() && pc_address == frame->pc_address());
#endif
fp_ = fp;
- if (FLAG_enable_ool_constant_pool) {
- raw_constant_pool_ = handle(
- ConstantPoolArray::cast(reinterpret_cast<Object*>(constant_pool)),
- isolate);
- }
pc_address_ = StackFrame::ResolveReturnAddressLocation(pc_address);
target_ = handle(raw_target(), isolate);
state_ = target_->ic_state();
@@ -167,7 +153,8 @@
#ifdef ENABLE_DEBUGGER_SUPPORT
-SharedFunctionInfo* IC::GetSharedFunctionInfo() const {
+Address IC::OriginalCodeAddress() const {
+ HandleScope scope(isolate());
// Compute the JavaScript frame for the frame pointer of this IC
// structure. We need this to be able to find the function
// corresponding to the frame.
@@ -177,25 +164,21 @@
// Find the function on the stack and both the active code for the
// function and the original code.
JSFunction* function = frame->function();
- return function->shared();
-}
-
-
-Code* IC::GetCode() const {
- HandleScope scope(isolate());
- Handle<SharedFunctionInfo> shared(GetSharedFunctionInfo(), isolate());
+ Handle<SharedFunctionInfo> shared(function->shared(), isolate());
Code* code = shared->code();
- return code;
-}
-
-
-Code* IC::GetOriginalCode() const {
- HandleScope scope(isolate());
- Handle<SharedFunctionInfo> shared(GetSharedFunctionInfo(), isolate());
ASSERT(Debug::HasDebugInfo(shared));
Code* original_code = Debug::GetDebugInfo(shared)->original_code();
ASSERT(original_code->IsCode());
- return original_code;
+ // Get the address of the call site in the active code. This is the
+ // place where the call to DebugBreakXXX is and where the IC
+ // normally would be.
+ Address addr = Assembler::target_address_from_return_address(pc());
+ // Return the address in the original code. This is the place where
+ // the call which has been overwritten by the DebugBreakXXX resides
+ // and the place where the inline cache system should look.
+ intptr_t delta =
+ original_code->instruction_start() - code->instruction_start();
+ return addr + delta;
}
#endif
@@ -426,26 +409,21 @@
}
-void IC::Clear(Isolate* isolate, Address address,
- ConstantPoolArray* constant_pool) {
- Code* target = GetTargetAtAddress(address, constant_pool);
+void IC::Clear(Isolate* isolate, Address address) {
+ Code* target = GetTargetAtAddress(address);
// Don't clear debug break inline cache as it will remove the break
point.
if (target->is_debug_stub()) return;
switch (target->kind()) {
- case Code::LOAD_IC:
- return LoadIC::Clear(isolate, address, target, constant_pool);
+ case Code::LOAD_IC: return LoadIC::Clear(isolate, address, target);
case Code::KEYED_LOAD_IC:
- return KeyedLoadIC::Clear(isolate, address, target, constant_pool);
- case Code::STORE_IC:
- return StoreIC::Clear(isolate, address, target, constant_pool);
+ return KeyedLoadIC::Clear(isolate, address, target);
+ case Code::STORE_IC: return StoreIC::Clear(isolate, address, target);
case Code::KEYED_STORE_IC:
- return KeyedStoreIC::Clear(isolate, address, target, constant_pool);
- case Code::COMPARE_IC:
- return CompareIC::Clear(isolate, address, target, constant_pool);
- case Code::COMPARE_NIL_IC:
- return CompareNilIC::Clear(address, target, constant_pool);
+ return KeyedStoreIC::Clear(isolate, address, target);
+ case Code::COMPARE_IC: return CompareIC::Clear(isolate, address,
target);
+ case Code::COMPARE_NIL_IC: return CompareNilIC::Clear(address, target);
case Code::BINARY_OP_IC:
case Code::TO_BOOLEAN_IC:
// Clearing these is tricky and does not
@@ -456,56 +434,40 @@
}
-void KeyedLoadIC::Clear(Isolate* isolate,
- Address address,
- Code* target,
- ConstantPoolArray* constant_pool) {
+void KeyedLoadIC::Clear(Isolate* isolate, Address address, Code* target) {
if (IsCleared(target)) return;
// Make sure to also clear the map used in inline fast cases. If we
// do not clear these maps, cached code can keep objects alive
// through the embedded maps.
- SetTargetAtAddress(address, *pre_monomorphic_stub(isolate),
constant_pool);
+ SetTargetAtAddress(address, *pre_monomorphic_stub(isolate));
}
-void LoadIC::Clear(Isolate* isolate,
- Address address,
- Code* target,
- ConstantPoolArray* constant_pool) {
+void LoadIC::Clear(Isolate* isolate, Address address, Code* target) {
if (IsCleared(target)) return;
Code* code = target->GetIsolate()->stub_cache()->FindPreMonomorphicIC(
Code::LOAD_IC, target->extra_ic_state());
- SetTargetAtAddress(address, code, constant_pool);
+ SetTargetAtAddress(address, code);
}
-void StoreIC::Clear(Isolate* isolate,
- Address address,
- Code* target,
- ConstantPoolArray* constant_pool) {
+void StoreIC::Clear(Isolate* isolate, Address address, Code* target) {
if (IsCleared(target)) return;
Code* code = target->GetIsolate()->stub_cache()->FindPreMonomorphicIC(
Code::STORE_IC, target->extra_ic_state());
- SetTargetAtAddress(address, code, constant_pool);
+ SetTargetAtAddress(address, code);
}
-void KeyedStoreIC::Clear(Isolate* isolate,
- Address address,
- Code* target,
- ConstantPoolArray* constant_pool) {
+void KeyedStoreIC::Clear(Isolate* isolate, Address address, Code* target) {
if (IsCleared(target)) return;
SetTargetAtAddress(address,
*pre_monomorphic_stub(
- isolate, StoreIC::GetStrictMode(target->extra_ic_state())),
- constant_pool);
+ isolate, StoreIC::GetStrictMode(target->extra_ic_state())));
}
-void CompareIC::Clear(Isolate* isolate,
- Address address,
- Code* target,
- ConstantPoolArray* constant_pool) {
+void CompareIC::Clear(Isolate* isolate, Address address, Code* target) {
ASSERT(target->major_key() == CodeStub::CompareIC);
CompareIC::State handler_state;
Token::Value op;
@@ -513,7 +475,7 @@
&handler_state, &op);
// Only clear CompareICs that can retain objects.
if (handler_state != KNOWN_OBJECT) return;
- SetTargetAtAddress(address, GetRawUninitialized(isolate, op),
constant_pool);
+ SetTargetAtAddress(address, GetRawUninitialized(isolate, op));
PatchInlinedSmiCode(address, DISABLE_INLINED_SMI_CHECK);
}
@@ -2723,9 +2685,7 @@
}
-void CompareNilIC::Clear(Address address,
- Code* target,
- ConstantPoolArray* constant_pool) {
+void CompareNilIC::Clear(Address address, Code* target) {
if (IsCleared(target)) return;
ExtraICState state = target->extra_ic_state();
@@ -2735,7 +2695,7 @@
Code* code = NULL;
CHECK(stub.FindCodeInCache(&code, target->GetIsolate()));
- SetTargetAtAddress(address, code, constant_pool);
+ SetTargetAtAddress(address, code);
}
=======================================
--- /branches/bleeding_edge/src/ic.h Tue Mar 11 20:31:23 2014 UTC
+++ /branches/bleeding_edge/src/ic.h Tue Mar 11 21:46:26 2014 UTC
@@ -101,9 +101,7 @@
}
// Clear the inline cache to initial state.
- static void Clear(Isolate* isolate,
- Address address,
- ConstantPoolArray* constant_pool);
+ static void Clear(Isolate* isolate, Address address);
#ifdef DEBUG
bool IsLoadStub() const {
@@ -157,17 +155,14 @@
Isolate* isolate() const { return isolate_; }
#ifdef ENABLE_DEBUGGER_SUPPORT
- // Get the shared function info of the caller.
- SharedFunctionInfo* GetSharedFunctionInfo() const;
- // Get the code object of the caller.
- Code* GetCode() const;
- // Get the original (non-breakpointed) code object of the caller.
- Code* GetOriginalCode() const;
+ // Computes the address in the original code when the code running is
+ // containing break points (calls to DebugBreakXXX builtins).
+ Address OriginalCodeAddress() const;
#endif
// Set the call-site target.
void set_target(Code* code) {
- SetTargetAtAddress(address(), code, constant_pool());
+ SetTargetAtAddress(address(), code);
target_set_ = true;
}
@@ -185,11 +180,8 @@
Failure* ReferenceError(const char* type, Handle<String> name);
// Access the target code for the given IC address.
- static inline Code* GetTargetAtAddress(Address address,
- ConstantPoolArray* constant_pool);
- static inline void SetTargetAtAddress(Address address,
- Code* target,
- ConstantPoolArray* constant_pool);
+ static inline Code* GetTargetAtAddress(Address address);
+ static inline void SetTargetAtAddress(Address address, Code* target);
static void PostPatching(Address address, Code* target, Code*
old_target);
// Compute the handler either by compiling or by retrieving a cached
version.
@@ -248,11 +240,7 @@
}
private:
- Code* raw_target() const {
- return GetTargetAtAddress(address(), constant_pool());
- }
- inline ConstantPoolArray* constant_pool() const;
- inline ConstantPoolArray* raw_constant_pool() const;
+ Code* raw_target() const { return GetTargetAtAddress(address()); }
// Frame pointer for the frame that uses (calls) the IC.
Address fp_;
@@ -265,10 +253,6 @@
Isolate* isolate_;
- // The constant pool of the code which originally called the IC (which
might
- // be for the breakpointed copy of the original code).
- Handle<ConstantPoolArray> raw_constant_pool_;
-
// The original code target that missed.
Handle<Code> target_;
State state_;
@@ -389,10 +373,7 @@
Representation representation =
Representation::Tagged());
- static void Clear(Isolate* isolate,
- Address address,
- Code* target,
- ConstantPoolArray* constant_pool);
+ static void Clear(Isolate* isolate, Address address, Code* target);
friend class IC;
};
@@ -462,10 +443,7 @@
return isolate()->builtins()->KeyedLoadIC_String();
}
- static void Clear(Isolate* isolate,
- Address address,
- Code* target,
- ConstantPoolArray* constant_pool);
+ static void Clear(Isolate* isolate, Address address, Code* target);
friend class IC;
};
@@ -555,10 +533,7 @@
IC::set_target(code);
}
- static void Clear(Isolate* isolate,
- Address address,
- Code* target,
- ConstantPoolArray* constant_pool);
+ static void Clear(Isolate* isolate, Address address, Code* target);
friend class IC;
};
@@ -665,10 +640,7 @@
return isolate()->builtins()->KeyedStoreIC_SloppyArguments();
}
- static void Clear(Isolate* isolate,
- Address address,
- Code* target,
- ConstantPoolArray* constant_pool);
+ static void Clear(Isolate* isolate, Address address, Code* target);
KeyedAccessStoreMode GetStoreMode(Handle<JSObject> receiver,
Handle<Object> key,
@@ -875,10 +847,7 @@
static Code* GetRawUninitialized(Isolate* isolate, Token::Value op);
- static void Clear(Isolate* isolate,
- Address address,
- Code* target,
- ConstantPoolArray* constant_pool);
+ static void Clear(Isolate* isolate, Address address, Code* target);
Token::Value op_;
@@ -894,9 +863,7 @@
static Handle<Code> GetUninitialized();
- static void Clear(Address address,
- Code* target,
- ConstantPoolArray* constant_pool);
+ static void Clear(Address address, Code* target);
static MUST_USE_RESULT MaybeObject* DoCompareNilSlow(NilValue nil,
Handle<Object>
object);
=======================================
--- /branches/bleeding_edge/src/objects-visiting-inl.h Tue Mar 11 20:31:23
2014 UTC
+++ /branches/bleeding_edge/src/objects-visiting-inl.h Tue Mar 11 21:46:26
2014 UTC
@@ -313,8 +313,7 @@
&& (target->ic_state() == MEGAMORPHIC || target->ic_state() ==
GENERIC ||
target->ic_state() == POLYMORPHIC ||
heap->flush_monomorphic_ics() ||
Serializer::enabled() || target->ic_age() !=
heap->global_ic_age())) {
- IC::Clear(target->GetIsolate(), rinfo->pc(),
- rinfo->host()->constant_pool());
+ IC::Clear(target->GetIsolate(), rinfo->pc());
target = Code::GetCodeFromTargetAddress(rinfo->target_address());
}
heap->mark_compact_collector()->RecordRelocSlot(rinfo, target);
=======================================
--- /branches/bleeding_edge/src/objects.cc Tue Mar 11 20:31:23 2014 UTC
+++ /branches/bleeding_edge/src/objects.cc Tue Mar 11 21:46:26 2014 UTC
@@ -10635,8 +10635,7 @@
Code* target(Code::GetCodeFromTargetAddress(info->target_address()));
if (target->is_inline_cache_stub()) {
if (kind == NULL || *kind == target->kind()) {
- IC::Clear(this->GetIsolate(), info->pc(),
- info->host()->constant_pool());
+ IC::Clear(this->GetIsolate(), info->pc());
}
}
}
=======================================
--- /branches/bleeding_edge/src/serialize.cc Tue Mar 11 20:52:00 2014 UTC
+++ /branches/bleeding_edge/src/serialize.cc Tue Mar 11 21:46:26 2014 UTC
@@ -983,7 +983,6 @@
reinterpret_cast<Address>(current); \
Assembler::deserialization_set_special_target_at( \
location_of_branch_data, \
-
Code::cast(HeapObject::FromAddress(current_object_address)), \
reinterpret_cast<Address>(new_object)); \
location_of_branch_data +=
Assembler::kSpecialTargetSize; \
current =
reinterpret_cast<Object**>(location_of_branch_data); \
=======================================
--- /branches/bleeding_edge/src/x64/assembler-x64-inl.h Tue Mar 11 20:31:23
2014 UTC
+++ /branches/bleeding_edge/src/x64/assembler-x64-inl.h Tue Mar 11 21:46:26
2014 UTC
@@ -205,15 +205,12 @@
}
-Address Assembler::target_address_at(Address pc,
- ConstantPoolArray* constant_pool) {
+Address Assembler::target_address_at(Address pc) {
return Memory::int32_at(pc) + pc + 4;
}
-void Assembler::set_target_address_at(Address pc,
- ConstantPoolArray* constant_pool,
- Address target) {
+void Assembler::set_target_address_at(Address pc, Address target) {
Memory::int32_at(pc) = static_cast<int32_t>(target - pc - 4);
CPU::FlushICache(pc, sizeof(int32_t));
}
@@ -258,7 +255,7 @@
Address RelocInfo::target_address() {
ASSERT(IsCodeTarget(rmode_) || IsRuntimeEntry(rmode_));
- return Assembler::target_address_at(pc_, host_);
+ return Assembler::target_address_at(pc_);
}
@@ -287,7 +284,7 @@
void RelocInfo::set_target_address(Address target, WriteBarrierMode mode) {
ASSERT(IsCodeTarget(rmode_) || IsRuntimeEntry(rmode_));
- Assembler::set_target_address_at(pc_, host_, target);
+ Assembler::set_target_address_at(pc_, target);
if (mode == UPDATE_WRITE_BARRIER && host() != NULL &&
IsCodeTarget(rmode_)) {
Object* target_code = Code::GetCodeFromTargetAddress(target);
host()->GetHeap()->incremental_marking()->RecordWriteIntoCode(
@@ -378,7 +375,7 @@
Memory::Address_at(pc_) = NULL;
} else if (IsCodeTarget(rmode_) || IsRuntimeEntry(rmode_)) {
// Effectively write zero into the relocation.
- Assembler::set_target_address_at(pc_, host_, pc_ + sizeof(int32_t));
+ Assembler::set_target_address_at(pc_, pc_ + sizeof(int32_t));
} else {
UNREACHABLE();
}
@@ -417,14 +414,14 @@
ASSERT(rmode_ == RelocInfo::CODE_AGE_SEQUENCE);
ASSERT(*pc_ == kCallOpcode);
return Code::GetCodeFromTargetAddress(
- Assembler::target_address_at(pc_ + 1, host_));
+ Assembler::target_address_at(pc_ + 1));
}
void RelocInfo::set_code_age_stub(Code* stub) {
ASSERT(*pc_ == kCallOpcode);
ASSERT(rmode_ == RelocInfo::CODE_AGE_SEQUENCE);
- Assembler::set_target_address_at(pc_ + 1, host_,
stub->instruction_start());
+ Assembler::set_target_address_at(pc_ + 1, stub->instruction_start());
}
=======================================
--- /branches/bleeding_edge/src/x64/assembler-x64.h Tue Mar 11 20:31:23
2014 UTC
+++ /branches/bleeding_edge/src/x64/assembler-x64.h Tue Mar 11 21:46:26
2014 UTC
@@ -555,19 +555,8 @@
// the absolute address of the target.
// These functions convert between absolute Addresses of Code objects and
// the relative displacements stored in the code.
- static inline Address target_address_at(Address pc,
- ConstantPoolArray*
constant_pool);
- static inline void set_target_address_at(Address pc,
- ConstantPoolArray*
constant_pool,
- Address target);
- static inline Address target_address_at(Address pc, Code* code) {
- return target_address_at(pc, code->constant_pool());
- }
- static inline void set_target_address_at(Address pc,
- Code* code,
- Address target) {
- set_target_address_at(pc, code->constant_pool(), target);
- }
+ static inline Address target_address_at(Address pc);
+ static inline void set_target_address_at(Address pc, Address target);
// Return the code target address at a call site from the return address
// of that call in the instruction stream.
@@ -576,8 +565,8 @@
// This sets the branch destination (which is in the instruction on x64).
// This is for calls and branches within generated code.
inline static void deserialization_set_special_target_at(
- Address instruction_payload, Code* code, Address target) {
- set_target_address_at(instruction_payload, code, target);
+ Address instruction_payload, Address target) {
+ set_target_address_at(instruction_payload, target);
}
static inline RelocInfo::Mode RelocInfoNone() {
=======================================
--- /branches/bleeding_edge/src/x64/frames-x64.h Tue Mar 11 20:31:23 2014
UTC
+++ /branches/bleeding_edge/src/x64/frames-x64.h Tue Mar 11 21:46:26 2014
UTC
@@ -77,8 +77,6 @@
// FP-relative displacement of the caller's SP. It points just
// below the saved PC.
static const int kCallerSPDisplacement = kCallerPCOffset +
kPCOnStackSize;
-
- static const int kConstantPoolOffset = 0; // Not used
};
=======================================
--- /branches/bleeding_edge/src/x64/full-codegen-x64.cc Tue Mar 11 20:31:23
2014 UTC
+++ /branches/bleeding_edge/src/x64/full-codegen-x64.cc Tue Mar 11 21:46:26
2014 UTC
@@ -4859,7 +4859,6 @@
}
Assembler::set_target_address_at(call_target_address,
- unoptimized_code,
replacement_code->entry());
unoptimized_code->GetHeap()->incremental_marking()->RecordCodeTargetPatch(
unoptimized_code, call_target_address, replacement_code);
@@ -4877,23 +4876,20 @@
if (*jns_instr_address == kJnsInstruction) {
ASSERT_EQ(kJnsOffset, *(call_target_address - 2));
ASSERT_EQ(isolate->builtins()->InterruptCheck()->entry(),
- Assembler::target_address_at(call_target_address,
- unoptimized_code));
+ Assembler::target_address_at(call_target_address));
return INTERRUPT;
}
ASSERT_EQ(kNopByteOne, *jns_instr_address);
ASSERT_EQ(kNopByteTwo, *(call_target_address - 2));
- if (Assembler::target_address_at(call_target_address,
- unoptimized_code) ==
+ if (Assembler::target_address_at(call_target_address) ==
isolate->builtins()->OnStackReplacement()->entry()) {
return ON_STACK_REPLACEMENT;
}
ASSERT_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(),
- Assembler::target_address_at(call_target_address,
- unoptimized_code));
+ Assembler::target_address_at(call_target_address));
return OSR_AFTER_STACK_CHECK;
}
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.