Index: src/objects.cc |
=================================================================== |
--- src/objects.cc (revision 5298) |
+++ src/objects.cc (working copy) |
@@ -1098,12 +1098,15 @@ |
case JS_VALUE_TYPE: |
case JS_ARRAY_TYPE: |
case JS_REGEXP_TYPE: |
- case JS_FUNCTION_TYPE: |
case JS_GLOBAL_PROXY_TYPE: |
case JS_GLOBAL_OBJECT_TYPE: |
case JS_BUILTINS_OBJECT_TYPE: |
JSObject::BodyDescriptor::IterateBody(this, object_size, v); |
break; |
+ case JS_FUNCTION_TYPE: |
+ reinterpret_cast<JSFunction*>(this) |
+ ->JSFunctionIterateBody(object_size, v); |
+ break; |
case ODDBALL_TYPE: |
Oddball::BodyDescriptor::IterateBody(this, v); |
break; |
@@ -5025,6 +5028,15 @@ |
} |
+void JSFunction::JSFunctionIterateBody(int object_size, ObjectVisitor* v) { |
+ // Iterate over all fields in the body but take care in dealing with |
+ // the code entry. |
+ IteratePointers(v, kPropertiesOffset, kCodeEntryOffset); |
+ v->VisitCodeEntry(this->address() + kCodeEntryOffset); |
+ IteratePointers(v, kCodeEntryOffset + kPointerSize, object_size); |
+} |
+ |
+ |
Object* JSFunction::SetInstancePrototype(Object* value) { |
ASSERT(value->IsJSObject()); |
@@ -5041,7 +5053,6 @@ |
} |
- |
Object* JSFunction::SetPrototype(Object* value) { |
ASSERT(should_have_prototype()); |
Object* construct_prototype = value; |
@@ -5269,6 +5280,16 @@ |
} |
+void ObjectVisitor::VisitCodeEntry(Address entry_address) { |
+ Object* code = Code::GetObjectFromEntryAddress(entry_address); |
+ Object* old_code = code; |
+ VisitPointer(&code); |
+ if (code != old_code) { |
+ Memory::Address_at(entry_address) = reinterpret_cast<Code*>(code)->entry(); |
+ } |
+} |
+ |
+ |
void ObjectVisitor::VisitDebugTarget(RelocInfo* rinfo) { |
ASSERT((RelocInfo::IsJSReturn(rinfo->rmode()) && |
rinfo->IsPatchedReturnSequence()) || |