Index: src/objects-inl.h |
diff --git a/src/objects-inl.h b/src/objects-inl.h |
index a6f87981f62c8962c2b79cf8fa21f2edaafc4054..78aec58cc663f509776e610bdd143497330d2dde 100644 |
--- a/src/objects-inl.h |
+++ b/src/objects-inl.h |
@@ -4376,6 +4376,19 @@ void SharedFunctionInfo::set_code(Code* value, WriteBarrierMode mode) { |
} |
+void SharedFunctionInfo::ReplaceCode(Code* value) { |
+ // If the GC metadata field is already used then the function was |
+ // enqueued as a code flushing candidate and we remove it now. |
+ if (code()->gc_metadata() != NULL) { |
+ CodeFlusher* flusher = GetHeap()->mark_compact_collector()->code_flusher(); |
+ flusher->EvictCandidate(this); |
+ } |
+ |
+ ASSERT(code()->gc_metadata() == NULL && value->gc_metadata() == NULL); |
+ set_code(value); |
+} |
+ |
+ |
ScopeInfo* SharedFunctionInfo::scope_info() { |
return reinterpret_cast<ScopeInfo*>(READ_FIELD(this, kScopeInfoOffset)); |
} |