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

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

Issue 1493393002: Revert "Use WeakCells in the optimized code map rather than traversing in pause." (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years 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/heap/objects-visiting.h ('k') | src/objects.cc » ('j') | 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 80f3a37f921f77523d1558e8a045b07b284a63b6..0e025b22f2af61dabef81bca9136b518c162fc2d 100644
--- a/src/heap/objects-visiting-inl.h
+++ b/src/heap/objects-visiting-inl.h
@@ -442,6 +442,14 @@ void StaticMarkingVisitor<StaticVisitor>::VisitSharedFunctionInfo(
// Always flush the optimized code map if requested by flag.
shared->ClearOptimizedCodeMap();
}
+ } else {
+ if (!shared->OptimizedCodeMapIsCleared()) {
+ // Treat some references within the code map weakly by marking the
+ // code map itself but not pushing it onto the marking deque. The
+ // map will be processed after marking.
+ FixedArray* code_map = shared->optimized_code_map();
+ MarkOptimizedCodeMap(heap, code_map);
+ }
}
MarkCompactCollector* collector = heap->mark_compact_collector();
if (collector->is_code_flushing_enabled()) {
@@ -581,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,
+ 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
« no previous file with comments | « src/heap/objects-visiting.h ('k') | src/objects.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698