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

Unified Diff: src/heap/mark-compact.cc

Issue 1844413002: Use EmbedderHeapTracer instead of object grouping when trace_embedder_heap flag is set (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 9 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
Index: src/heap/mark-compact.cc
diff --git a/src/heap/mark-compact.cc b/src/heap/mark-compact.cc
index 65ca4c3165359892dece9c134988c2661d5a917f..0d50da8a04edc3708366d9656768e4d72004e88a 100644
--- a/src/heap/mark-compact.cc
+++ b/src/heap/mark-compact.cc
@@ -1916,6 +1916,17 @@ void MarkCompactCollector::EmptyMarkingDeque() {
MarkBit map_mark = Marking::MarkBitFrom(map);
MarkObject(map, map_mark);
+ if (UsingEmbedderHeapTracer() && object->IsJSObject()) {
+ JSObject* js_object = JSObject::cast(object);
+
+ if (js_object->GetInternalFieldCount() >= 2 &&
+ js_object->WasConstructedFromApiFunction()) {
jochen (gone - plz use gerrit) 2016/04/01 08:49:12 eventually, we should add a flag to the FunctionTe
Marcel Hlopko 2016/04/01 09:24:31 Noted.
+ wrappers_to_trace().push_back(std::pair<void*, void*>(
+ reinterpret_cast<void*>(js_object->GetInternalField(0)),
jochen (gone - plz use gerrit) 2016/04/01 08:49:12 these can be potentially "undefined_value()", righ
Marcel Hlopko 2016/04/01 09:24:32 Yes, I guarded against that in blink side, here it
+ reinterpret_cast<void*>(js_object->GetInternalField(1))));
+ }
+ }
+
MarkCompactMarkingVisitor::IterateBody(map, object);
}
}
@@ -1962,6 +1973,9 @@ void MarkCompactCollector::ProcessMarkingDeque() {
}
}
+bool MarkCompactCollector::UsingEmbedderHeapTracer() const {
+ return FLAG_trace_embedder_heap && heap_->embedder_heap_tracer();
+}
// Mark all objects reachable (transitively) from objects on the marking
// stack including references only considered in the atomic marking pause.
@@ -1969,16 +1983,29 @@ void MarkCompactCollector::ProcessEphemeralMarking(
ObjectVisitor* visitor, bool only_process_harmony_weak_collections) {
bool work_to_do = true;
DCHECK(marking_deque_.IsEmpty() && !marking_deque_.overflowed());
+ v8::Isolate* api_isolate = reinterpret_cast<v8::Isolate*>(isolate());
+ if (!only_process_harmony_weak_collections && UsingEmbedderHeapTracer()) {
+ heap()->embedder_heap_tracer()->TraceRoots(api_isolate);
+ }
while (work_to_do) {
if (!only_process_harmony_weak_collections) {
- isolate()->global_handles()->IterateObjectGroups(
- visitor, &IsUnmarkedHeapObjectWithHeap);
- MarkImplicitRefGroups(&MarkCompactMarkingVisitor::MarkObject);
+ if (UsingEmbedderHeapTracer()) {
+ heap_->embedder_heap_tracer()->TraceWrappableFrom(api_isolate,
+ wrappers_to_trace_);
+ wrappers_to_trace_.clear();
+ } else {
+ isolate()->global_handles()->IterateObjectGroups(
+ visitor, &IsUnmarkedHeapObjectWithHeap);
+ MarkImplicitRefGroups(&MarkCompactMarkingVisitor::MarkObject);
+ }
}
ProcessWeakCollections();
work_to_do = !marking_deque_.IsEmpty();
ProcessMarkingDeque();
}
+ if (!only_process_harmony_weak_collections && UsingEmbedderHeapTracer()) {
+ heap()->embedder_heap_tracer()->ClearTracingMarks(api_isolate);
+ }
}

Powered by Google App Engine
This is Rietveld 408576698