Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(672)

Unified Diff: src/objects.cc

Issue 203070: Stop "cooking" targets of jumps and calls in code objects. Do not convert ju... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 11 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/objects.h ('k') | src/objects-debug.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/objects.cc
===================================================================
--- src/objects.cc (revision 2940)
+++ src/objects.cc (working copy)
@@ -4955,60 +4955,25 @@
}
-void ObjectVisitor::BeginCodeIteration(Code* code) {
- ASSERT(code->ic_flag() == Code::IC_TARGET_IS_OBJECT);
-}
-
-
void ObjectVisitor::VisitCodeTarget(RelocInfo* rinfo) {
ASSERT(RelocInfo::IsCodeTarget(rinfo->rmode()));
- VisitPointer(rinfo->target_object_address());
+ Object* target = Code::GetCodeFromTargetAddress(rinfo->target_address());
+ Object* old_target = target;
+ VisitPointer(&target);
+ CHECK_EQ(target, old_target); // VisitPointer doesn't change Code* *target.
}
void ObjectVisitor::VisitDebugTarget(RelocInfo* rinfo) {
ASSERT(RelocInfo::IsJSReturn(rinfo->rmode()) && rinfo->IsCallInstruction());
- VisitPointer(rinfo->call_object_address());
+ Object* target = Code::GetCodeFromTargetAddress(rinfo->call_address());
+ Object* old_target = target;
+ VisitPointer(&target);
+ CHECK_EQ(target, old_target); // VisitPointer doesn't change Code* *target.
}
-// Convert relocatable targets from address to code object address. This is
-// mainly IC call targets but for debugging straight-line code can be replaced
-// with a call instruction which also has to be relocated.
-void Code::ConvertICTargetsFromAddressToObject() {
- ASSERT(ic_flag() == IC_TARGET_IS_ADDRESS);
-
- for (RelocIterator it(this, RelocInfo::kCodeTargetMask);
- !it.done(); it.next()) {
- Address ic_addr = it.rinfo()->target_address();
- ASSERT(ic_addr != NULL);
- HeapObject* code = Code::GetCodeFromTargetAddress(ic_addr);
- ASSERT(code->IsHeapObject());
- it.rinfo()->set_target_object(code);
- }
-
-#ifdef ENABLE_DEBUGGER_SUPPORT
- if (Debug::has_break_points()) {
- for (RelocIterator it(this, RelocInfo::ModeMask(RelocInfo::JS_RETURN));
- !it.done();
- it.next()) {
- if (it.rinfo()->IsCallInstruction()) {
- Address addr = it.rinfo()->call_address();
- ASSERT(addr != NULL);
- HeapObject* code = Code::GetCodeFromTargetAddress(addr);
- ASSERT(code->IsHeapObject());
- it.rinfo()->set_call_object(code);
- }
- }
- }
-#endif
- set_ic_flag(IC_TARGET_IS_OBJECT);
-}
-
-
void Code::CodeIterateBody(ObjectVisitor* v) {
- v->BeginCodeIteration(this);
-
int mode_mask = RelocInfo::kCodeTargetMask |
RelocInfo::ModeMask(RelocInfo::EMBEDDED_OBJECT) |
RelocInfo::ModeMask(RelocInfo::EXTERNAL_REFERENCE) |
@@ -5035,41 +5000,9 @@
}
ScopeInfo<>::IterateScopeInfo(this, v);
-
- v->EndCodeIteration(this);
}
-void Code::ConvertICTargetsFromObjectToAddress() {
- ASSERT(ic_flag() == IC_TARGET_IS_OBJECT);
-
- for (RelocIterator it(this, RelocInfo::kCodeTargetMask);
- !it.done(); it.next()) {
- // We cannot use the safe cast (Code::cast) here, because we may be in
- // the middle of relocating old objects during GC and the map pointer in
- // the code object may be mangled
- Code* code = reinterpret_cast<Code*>(it.rinfo()->target_object());
- ASSERT((code != NULL) && code->IsHeapObject());
- it.rinfo()->set_target_address(code->instruction_start());
- }
-
-#ifdef ENABLE_DEBUGGER_SUPPORT
- if (Debug::has_break_points()) {
- for (RelocIterator it(this, RelocInfo::ModeMask(RelocInfo::JS_RETURN));
- !it.done();
- it.next()) {
- if (it.rinfo()->IsCallInstruction()) {
- Code* code = reinterpret_cast<Code*>(it.rinfo()->call_object());
- ASSERT((code != NULL) && code->IsHeapObject());
- it.rinfo()->set_call_address(code->instruction_start());
- }
- }
- }
-#endif
- set_ic_flag(IC_TARGET_IS_ADDRESS);
-}
-
-
void Code::Relocate(int delta) {
for (RelocIterator it(this, RelocInfo::kApplyMask); !it.done(); it.next()) {
it.rinfo()->apply(delta);
« no previous file with comments | « src/objects.h ('k') | src/objects-debug.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698