Index: src/heap/heap.cc |
diff --git a/src/heap/heap.cc b/src/heap/heap.cc |
index 506a723796a7da2737030661e9137fde9398d7ef..a46e5dd0bd33f45f619339b2952fe6919b331d31 100644 |
--- a/src/heap/heap.cc |
+++ b/src/heap/heap.cc |
@@ -1557,15 +1557,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(); |
} |