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

Unified Diff: src/heap/objects-visiting-inl.h

Issue 1252463002: [turbofan] Preserve cached code across GCs. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@local_opt-code-map-8
Patch Set: Flip default to "off", in our moment of triumph. Created 5 years, 5 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
« src/flag-definitions.h ('K') | « src/heap/objects-visiting.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/heap/objects-visiting-inl.h
diff --git a/src/heap/objects-visiting-inl.h b/src/heap/objects-visiting-inl.h
index e3e8e710203ea03bdb376d97a03d6ba6722326bb..05aa375bcdb042f30e1d9c672e6c3876283f30f5 100644
--- a/src/heap/objects-visiting-inl.h
+++ b/src/heap/objects-visiting-inl.h
@@ -419,10 +419,10 @@ void StaticMarkingVisitor<StaticVisitor>::VisitSharedFunctionInfo(
// Add the shared function info holding an optimized code map to
// the code flusher for processing of code maps after marking.
collector->code_flusher()->AddOptimizedCodeMap(shared);
- // Treat all references within the code map weakly by marking the
+ // Treat some references within the code map weakly by marking the
// code map itself but not pushing it onto the marking deque.
FixedArray* code_map = FixedArray::cast(shared->optimized_code_map());
- StaticVisitor::MarkObjectWithoutPush(heap, code_map);
+ MarkOptimizedCodeMap(heap, code_map);
}
if (IsFlushable(heap, shared)) {
// This function's code looks flushable. But we have to postpone
@@ -589,6 +589,23 @@ void StaticMarkingVisitor<StaticVisitor>::MarkTransitionArray(
template <typename StaticVisitor>
+void StaticMarkingVisitor<StaticVisitor>::MarkOptimizedCodeMap(
+ Heap* heap, FixedArray* code_map) {
+ if (!StaticVisitor::MarkObjectWithoutPush(heap, code_map)) return;
+
+ // Mark the context-independent entry in the optimized code map. Depending on
+ // the age of the code object, we treat it as a strong or a weak reference.
+ Object* shared_object = code_map->get(SharedFunctionInfo::kSharedCodeIndex);
+ if (FLAG_turbo_preserve_shared_code && shared_object->IsCode() &&
+ FLAG_age_code && !Code::cast(shared_object)->IsOld()) {
+ StaticVisitor::VisitPointer(
+ heap,
+ code_map->RawFieldOfElementAt(SharedFunctionInfo::kSharedCodeIndex));
+ }
+}
+
+
+template <typename StaticVisitor>
void StaticMarkingVisitor<StaticVisitor>::MarkInlinedFunctionsCode(Heap* heap,
Code* code) {
// For optimized functions we should retain both non-optimized version
« src/flag-definitions.h ('K') | « src/heap/objects-visiting.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698