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

Unified Diff: src/heap/heap.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: Move logic from heap to mark compact Created 4 years, 8 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/heap/heap.h ('k') | src/heap/incremental-marking.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/heap/heap.cc
diff --git a/src/heap/heap.cc b/src/heap/heap.cc
index 1115882c4183177e057c0ae7e3a67b7574a5447a..ef40942f73cf85896eb903f9b71310c7bc270386 100644
--- a/src/heap/heap.cc
+++ b/src/heap/heap.cc
@@ -115,7 +115,6 @@ Heap::Heap()
inline_allocation_disabled_(false),
total_regexp_code_generated_(0),
tracer_(nullptr),
- embedder_heap_tracer_(nullptr),
high_survival_rate_period_length_(0),
promoted_objects_size_(0),
promotion_ratio_(0),
@@ -1548,15 +1547,12 @@ static bool IsUnmodifiedHeapObject(Object** p) {
if (object->IsSmi()) return false;
HeapObject* heap_object = HeapObject::cast(object);
if (!object->IsJSObject()) return false;
- Object* obj_constructor = (JSObject::cast(object))->map()->GetConstructor();
- if (!obj_constructor->IsJSFunction()) return false;
- JSFunction* constructor = JSFunction::cast(obj_constructor);
- if (!constructor->shared()->IsApiFunction()) return false;
- if (constructor != nullptr &&
- constructor->initial_map() == heap_object->map()) {
- return true;
- }
- return false;
+ JSObject* js_object = JSObject::cast(object);
+ if (!js_object->WasConstructedFromApiFunction()) return false;
+ JSFunction* constructor =
+ JSFunction::cast(js_object->map()->GetConstructor());
+
+ return constructor->initial_map() == heap_object->map();
}
@@ -3578,6 +3574,7 @@ AllocationResult Heap::CopyJSObject(JSObject* source, AllocationSite* site) {
CHECK(map->instance_type() == JS_REGEXP_TYPE ||
map->instance_type() == JS_OBJECT_TYPE ||
map->instance_type() == JS_ARRAY_TYPE ||
+ map->instance_type() == JS_API_OBJECT_TYPE ||
map->instance_type() == JS_SPECIAL_API_OBJECT_TYPE);
int object_size = map->instance_size();
@@ -5374,12 +5371,20 @@ void Heap::NotifyDeserializationComplete() {
#endif // DEBUG
}
+void Heap::SetEmbedderHeapTracer(EmbedderHeapTracer* tracer) {
+ mark_compact_collector()->SetEmbedderHeapTracer(tracer);
+}
+
+bool Heap::UsingEmbedderHeapTracer() {
+ return mark_compact_collector()->UsingEmbedderHeapTracer();
+}
+
+void Heap::TracePossibleWrapper(JSObject* js_object) {
+ mark_compact_collector()->TracePossibleWrapper(js_object);
+}
+
void Heap::RegisterExternallyReferencedObject(Object** object) {
- DCHECK(mark_compact_collector()->in_use());
- HeapObject* heap_object = HeapObject::cast(*object);
- DCHECK(Contains(heap_object));
- MarkBit mark_bit = Marking::MarkBitFrom(heap_object);
- mark_compact_collector()->MarkObject(heap_object, mark_bit);
+ mark_compact_collector()->RegisterExternallyReferencedObject(object);
}
void Heap::TearDown() {
@@ -5549,12 +5554,6 @@ void Heap::RemoveGCEpilogueCallback(v8::Isolate::GCCallback callback) {
UNREACHABLE();
}
-void Heap::SetEmbedderHeapTracer(EmbedderHeapTracer* tracer) {
- DCHECK_NOT_NULL(tracer);
- CHECK_NULL(embedder_heap_tracer_);
- embedder_heap_tracer_ = tracer;
-}
-
// TODO(ishell): Find a better place for this.
void Heap::AddWeakObjectToCodeDependency(Handle<HeapObject> obj,
Handle<DependentCode> dep) {
« no previous file with comments | « src/heap/heap.h ('k') | src/heap/incremental-marking.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698