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

Unified Diff: src/mark-compact.cc

Issue 3197010: Version 2.3.10... (Closed) Base URL: http://v8.googlecode.com/svn/trunk/
Patch Set: Created 10 years, 4 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/liveedit.cc ('k') | src/objects.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/mark-compact.cc
===================================================================
--- src/mark-compact.cc (revision 5316)
+++ src/mark-compact.cc (working copy)
@@ -255,10 +255,9 @@
static void EnableCodeFlushing(bool enabled) {
if (enabled) {
+ table_.Register(kVisitJSFunction, &VisitJSFunctionAndFlushCode);
+ } else {
table_.Register(kVisitJSFunction, &VisitJSFunction);
- } else {
- table_.Register(kVisitJSFunction,
- &JSObjectVisitor::VisitSpecialized<JSFunction::kSize>);
}
}
@@ -299,7 +298,7 @@
table_.Register(kVisitCode, &VisitCode);
- table_.Register(kVisitJSFunction, &VisitJSFunction);
+ table_.Register(kVisitJSFunction, &VisitJSFunctionAndFlushCode);
table_.Register(kVisitPropertyCell,
&FixedBodyVisitor<StaticMarkingVisitor,
@@ -534,17 +533,43 @@
}
- static void VisitJSFunction(Map* map, HeapObject* object) {
+ static void 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();
+ }
+ }
+
+
+ static void VisitJSFunctionAndFlushCode(Map* map, HeapObject* object) {
JSFunction* jsfunction = reinterpret_cast<JSFunction*>(object);
-
// The function must have a valid context and not be a builtin.
if (IsValidNotBuiltinContext(jsfunction->unchecked_context())) {
FlushCodeForFunction(jsfunction);
}
+ VisitJSFunction(map, object);
+ }
- JSObjectVisitor::VisitSpecialized<JSFunction::kSize>(map, object);
+
+ static void VisitJSFunction(Map* map, HeapObject* object) {
+#define SLOT_ADDR(obj, offset) \
+ reinterpret_cast<Object**>((obj)->address() + offset)
+
+ VisitPointers(SLOT_ADDR(object, JSFunction::kPropertiesOffset),
+ SLOT_ADDR(object, JSFunction::kCodeEntryOffset));
+
+ VisitCodeEntry(object->address() + JSFunction::kCodeEntryOffset);
+
+ VisitPointers(SLOT_ADDR(object,
+ JSFunction::kCodeEntryOffset + kPointerSize),
+ SLOT_ADDR(object, JSFunction::kSize));
+#undef SLOT_ADDR
}
+
typedef void (*Callback)(Map* map, HeapObject* object);
static VisitorDispatchTable<Callback> table_;
« no previous file with comments | « src/liveedit.cc ('k') | src/objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698