Use GetCodeFromTargetAddress everywhere, uniformly.
Review URL: http://codereview.chromium.org/193111 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@2888 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
parent
91ecc77e5f
commit
e58287a1bb
@ -494,7 +494,7 @@ void RelocInfo::Verify() {
|
||||
Address addr = target_address();
|
||||
ASSERT(addr != NULL);
|
||||
// Check that we can find the right code object.
|
||||
HeapObject* code = HeapObject::FromAddress(addr - Code::kHeaderSize);
|
||||
Code* code = Code::GetCodeFromTargetAddress(addr);
|
||||
Object* found = Heap::FindCodeObject(addr);
|
||||
ASSERT(found->IsCode());
|
||||
ASSERT(code->address() == HeapObject::cast(found)->address());
|
||||
|
@ -279,7 +279,7 @@ class MarkingVisitor : public ObjectVisitor {
|
||||
|
||||
void VisitCodeTarget(RelocInfo* rinfo) {
|
||||
ASSERT(RelocInfo::IsCodeTarget(rinfo->rmode()));
|
||||
Code* code = CodeFromDerivedPointer(rinfo->target_address());
|
||||
Code* code = Code::GetCodeFromTargetAddress(rinfo->target_address());
|
||||
if (FLAG_cleanup_ics_at_gc && code->is_inline_cache_stub()) {
|
||||
IC::Clear(rinfo->pc());
|
||||
// Please note targets for cleared inline cached do not have to be
|
||||
@ -289,7 +289,7 @@ class MarkingVisitor : public ObjectVisitor {
|
||||
}
|
||||
if (IsCompacting()) {
|
||||
// When compacting we convert the target to a real object pointer.
|
||||
code = CodeFromDerivedPointer(rinfo->target_address());
|
||||
code = Code::GetCodeFromTargetAddress(rinfo->target_address());
|
||||
rinfo->set_target_object(code);
|
||||
}
|
||||
}
|
||||
@ -297,7 +297,7 @@ class MarkingVisitor : public ObjectVisitor {
|
||||
void VisitDebugTarget(RelocInfo* rinfo) {
|
||||
ASSERT(RelocInfo::IsJSReturn(rinfo->rmode()) &&
|
||||
rinfo->IsCallInstruction());
|
||||
HeapObject* code = CodeFromDerivedPointer(rinfo->call_address());
|
||||
HeapObject* code = Code::GetCodeFromTargetAddress(rinfo->call_address());
|
||||
MarkCompactCollector::MarkObject(code);
|
||||
// When compacting we convert the call to a real object pointer.
|
||||
if (IsCompacting()) rinfo->set_call_object(code);
|
||||
@ -314,13 +314,6 @@ class MarkingVisitor : public ObjectVisitor {
|
||||
// Tells whether the mark sweep collection will perform compaction.
|
||||
bool IsCompacting() { return MarkCompactCollector::IsCompacting(); }
|
||||
|
||||
// Retrieves the Code pointer from derived code entry.
|
||||
Code* CodeFromDerivedPointer(Address addr) {
|
||||
ASSERT(addr != NULL);
|
||||
return reinterpret_cast<Code*>(
|
||||
HeapObject::FromAddress(addr - Code::kHeaderSize));
|
||||
}
|
||||
|
||||
// Visit an unmarked object.
|
||||
void VisitUnmarkedObject(HeapObject* obj) {
|
||||
#ifdef DEBUG
|
||||
|
@ -4967,7 +4967,7 @@ void Code::ConvertICTargetsFromAddressToObject() {
|
||||
!it.done(); it.next()) {
|
||||
Address ic_addr = it.rinfo()->target_address();
|
||||
ASSERT(ic_addr != NULL);
|
||||
HeapObject* code = HeapObject::FromAddress(ic_addr - Code::kHeaderSize);
|
||||
HeapObject* code = Code::GetCodeFromTargetAddress(ic_addr);
|
||||
ASSERT(code->IsHeapObject());
|
||||
it.rinfo()->set_target_object(code);
|
||||
}
|
||||
@ -4980,7 +4980,7 @@ void Code::ConvertICTargetsFromAddressToObject() {
|
||||
if (it.rinfo()->IsCallInstruction()) {
|
||||
Address addr = it.rinfo()->call_address();
|
||||
ASSERT(addr != NULL);
|
||||
HeapObject* code = HeapObject::FromAddress(addr - Code::kHeaderSize);
|
||||
HeapObject* code = Code::GetCodeFromTargetAddress(addr);
|
||||
ASSERT(code->IsHeapObject());
|
||||
it.rinfo()->set_call_object(code);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user