MIPS: Reland "Pass a Code object to Assembler::(set_)target_address_at for use by ool constant pool."
Port r19856 (0546217) Original commit message: The ool constant pool will require a pointer to the code's constant pool when updating or reading target addresses using set_target_address_at() and target_address_at(). BUG= R=plind44@gmail.com Review URL: https://codereview.chromium.org/198163002 Patch from Balazs Kilvady <kilvadyb@homejinni.com>. git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@19867 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
parent
f9ee4f19b4
commit
eb606948b1
@ -128,7 +128,7 @@ void RelocInfo::apply(intptr_t delta) {
|
|||||||
|
|
||||||
Address RelocInfo::target_address() {
|
Address RelocInfo::target_address() {
|
||||||
ASSERT(IsCodeTarget(rmode_) || IsRuntimeEntry(rmode_));
|
ASSERT(IsCodeTarget(rmode_) || IsRuntimeEntry(rmode_));
|
||||||
return Assembler::target_address_at(pc_);
|
return Assembler::target_address_at(pc_, host_);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -169,7 +169,7 @@ int RelocInfo::target_address_size() {
|
|||||||
|
|
||||||
void RelocInfo::set_target_address(Address target, WriteBarrierMode mode) {
|
void RelocInfo::set_target_address(Address target, WriteBarrierMode mode) {
|
||||||
ASSERT(IsCodeTarget(rmode_) || IsRuntimeEntry(rmode_));
|
ASSERT(IsCodeTarget(rmode_) || IsRuntimeEntry(rmode_));
|
||||||
Assembler::set_target_address_at(pc_, target);
|
Assembler::set_target_address_at(pc_, host_, target);
|
||||||
if (mode == UPDATE_WRITE_BARRIER && host() != NULL && IsCodeTarget(rmode_)) {
|
if (mode == UPDATE_WRITE_BARRIER && host() != NULL && IsCodeTarget(rmode_)) {
|
||||||
Object* target_code = Code::GetCodeFromTargetAddress(target);
|
Object* target_code = Code::GetCodeFromTargetAddress(target);
|
||||||
host()->GetHeap()->incremental_marking()->RecordWriteIntoCode(
|
host()->GetHeap()->incremental_marking()->RecordWriteIntoCode(
|
||||||
@ -185,21 +185,22 @@ Address Assembler::target_address_from_return_address(Address pc) {
|
|||||||
|
|
||||||
Object* RelocInfo::target_object() {
|
Object* RelocInfo::target_object() {
|
||||||
ASSERT(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT);
|
ASSERT(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT);
|
||||||
return reinterpret_cast<Object*>(Assembler::target_address_at(pc_));
|
return reinterpret_cast<Object*>(Assembler::target_address_at(pc_, host_));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Handle<Object> RelocInfo::target_object_handle(Assembler* origin) {
|
Handle<Object> RelocInfo::target_object_handle(Assembler* origin) {
|
||||||
ASSERT(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT);
|
ASSERT(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT);
|
||||||
return Handle<Object>(reinterpret_cast<Object**>(
|
return Handle<Object>(reinterpret_cast<Object**>(
|
||||||
Assembler::target_address_at(pc_)));
|
Assembler::target_address_at(pc_, host_)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void RelocInfo::set_target_object(Object* target, WriteBarrierMode mode) {
|
void RelocInfo::set_target_object(Object* target, WriteBarrierMode mode) {
|
||||||
ASSERT(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT);
|
ASSERT(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT);
|
||||||
ASSERT(!target->IsConsString());
|
ASSERT(!target->IsConsString());
|
||||||
Assembler::set_target_address_at(pc_, reinterpret_cast<Address>(target));
|
Assembler::set_target_address_at(pc_, host_,
|
||||||
|
reinterpret_cast<Address>(target));
|
||||||
if (mode == UPDATE_WRITE_BARRIER &&
|
if (mode == UPDATE_WRITE_BARRIER &&
|
||||||
host() != NULL &&
|
host() != NULL &&
|
||||||
target->IsHeapObject()) {
|
target->IsHeapObject()) {
|
||||||
@ -211,7 +212,7 @@ void RelocInfo::set_target_object(Object* target, WriteBarrierMode mode) {
|
|||||||
|
|
||||||
Address RelocInfo::target_reference() {
|
Address RelocInfo::target_reference() {
|
||||||
ASSERT(rmode_ == EXTERNAL_REFERENCE);
|
ASSERT(rmode_ == EXTERNAL_REFERENCE);
|
||||||
return Assembler::target_address_at(pc_);
|
return Assembler::target_address_at(pc_, host_);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -266,13 +267,14 @@ Handle<Object> RelocInfo::code_age_stub_handle(Assembler* origin) {
|
|||||||
Code* RelocInfo::code_age_stub() {
|
Code* RelocInfo::code_age_stub() {
|
||||||
ASSERT(rmode_ == RelocInfo::CODE_AGE_SEQUENCE);
|
ASSERT(rmode_ == RelocInfo::CODE_AGE_SEQUENCE);
|
||||||
return Code::GetCodeFromTargetAddress(
|
return Code::GetCodeFromTargetAddress(
|
||||||
Assembler::target_address_at(pc_ + Assembler::kInstrSize));
|
Assembler::target_address_at(pc_ + Assembler::kInstrSize, host_));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void RelocInfo::set_code_age_stub(Code* stub) {
|
void RelocInfo::set_code_age_stub(Code* stub) {
|
||||||
ASSERT(rmode_ == RelocInfo::CODE_AGE_SEQUENCE);
|
ASSERT(rmode_ == RelocInfo::CODE_AGE_SEQUENCE);
|
||||||
Assembler::set_target_address_at(pc_ + Assembler::kInstrSize,
|
Assembler::set_target_address_at(pc_ + Assembler::kInstrSize,
|
||||||
|
host_,
|
||||||
stub->instruction_start());
|
stub->instruction_start());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -283,7 +285,7 @@ Address RelocInfo::call_address() {
|
|||||||
// The pc_ offset of 0 assumes mips patched return sequence per
|
// The pc_ offset of 0 assumes mips patched return sequence per
|
||||||
// debug-mips.cc BreakLocationIterator::SetDebugBreakAtReturn(), or
|
// debug-mips.cc BreakLocationIterator::SetDebugBreakAtReturn(), or
|
||||||
// debug break slot per BreakLocationIterator::SetDebugBreakAtSlot().
|
// debug break slot per BreakLocationIterator::SetDebugBreakAtSlot().
|
||||||
return Assembler::target_address_at(pc_);
|
return Assembler::target_address_at(pc_, host_);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -293,7 +295,7 @@ void RelocInfo::set_call_address(Address target) {
|
|||||||
// The pc_ offset of 0 assumes mips patched return sequence per
|
// The pc_ offset of 0 assumes mips patched return sequence per
|
||||||
// debug-mips.cc BreakLocationIterator::SetDebugBreakAtReturn(), or
|
// debug-mips.cc BreakLocationIterator::SetDebugBreakAtReturn(), or
|
||||||
// debug break slot per BreakLocationIterator::SetDebugBreakAtSlot().
|
// debug break slot per BreakLocationIterator::SetDebugBreakAtSlot().
|
||||||
Assembler::set_target_address_at(pc_, target);
|
Assembler::set_target_address_at(pc_, host_, target);
|
||||||
if (host() != NULL) {
|
if (host() != NULL) {
|
||||||
Object* target_code = Code::GetCodeFromTargetAddress(target);
|
Object* target_code = Code::GetCodeFromTargetAddress(target);
|
||||||
host()->GetHeap()->incremental_marking()->RecordWriteIntoCode(
|
host()->GetHeap()->incremental_marking()->RecordWriteIntoCode(
|
||||||
@ -324,7 +326,7 @@ void RelocInfo::WipeOut() {
|
|||||||
IsCodeTarget(rmode_) ||
|
IsCodeTarget(rmode_) ||
|
||||||
IsRuntimeEntry(rmode_) ||
|
IsRuntimeEntry(rmode_) ||
|
||||||
IsExternalReference(rmode_));
|
IsExternalReference(rmode_));
|
||||||
Assembler::set_target_address_at(pc_, NULL);
|
Assembler::set_target_address_at(pc_, host_, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -526,6 +526,26 @@ class Assembler : public AssemblerBase {
|
|||||||
// Read/Modify the code target address in the branch/call instruction at pc.
|
// Read/Modify the code target address in the branch/call instruction at pc.
|
||||||
static Address target_address_at(Address pc);
|
static Address target_address_at(Address pc);
|
||||||
static void set_target_address_at(Address pc, Address target);
|
static void set_target_address_at(Address pc, Address target);
|
||||||
|
// On MIPS there is no Constant Pool so we skip that parameter.
|
||||||
|
INLINE(static Address target_address_at(Address pc,
|
||||||
|
ConstantPoolArray* constant_pool)) {
|
||||||
|
return target_address_at(pc);
|
||||||
|
}
|
||||||
|
INLINE(static void set_target_address_at(Address pc,
|
||||||
|
ConstantPoolArray* constant_pool,
|
||||||
|
Address target)) {
|
||||||
|
set_target_address_at(pc, 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);
|
||||||
|
}
|
||||||
|
|
||||||
// Return the code target address at a call site from the return address
|
// Return the code target address at a call site from the return address
|
||||||
// of that call in the instruction stream.
|
// of that call in the instruction stream.
|
||||||
@ -539,9 +559,10 @@ class Assembler : public AssemblerBase {
|
|||||||
// This is for calls and branches within generated code. The serializer
|
// This is for calls and branches within generated code. The serializer
|
||||||
// has already deserialized the lui/ori instructions etc.
|
// has already deserialized the lui/ori instructions etc.
|
||||||
inline static void deserialization_set_special_target_at(
|
inline static void deserialization_set_special_target_at(
|
||||||
Address instruction_payload, Address target) {
|
Address instruction_payload, Code* code, Address target) {
|
||||||
set_target_address_at(
|
set_target_address_at(
|
||||||
instruction_payload - kInstructionsFor32BitConstant * kInstrSize,
|
instruction_payload - kInstructionsFor32BitConstant * kInstrSize,
|
||||||
|
code,
|
||||||
target);
|
target);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -176,6 +176,8 @@ class ExitFrameConstants : public AllStatic {
|
|||||||
|
|
||||||
// FP-relative displacement of the caller's SP.
|
// FP-relative displacement of the caller's SP.
|
||||||
static const int kCallerSPDisplacement = +2 * kPointerSize;
|
static const int kCallerSPDisplacement = +2 * kPointerSize;
|
||||||
|
|
||||||
|
static const int kConstantPoolOffset = 0; // Not used.
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user