Index: src/objects-inl.h |
diff --git a/src/objects-inl.h b/src/objects-inl.h |
index a7795a6c37238d4c2662a9e80a2ab890342c2b70..9ac35fd1cf743c6dffe136c245ef7e8cff82b710 100644 |
--- a/src/objects-inl.h |
+++ b/src/objects-inl.h |
@@ -1144,6 +1144,20 @@ MUST_USE_RESULT MaybeHandle<FixedArray> JSReceiver::OwnPropertyKeys( |
GetKeysConversion::kConvertToString); |
} |
+bool JSObject::PrototypeHasNoElements(Isolate* isolate, JSObject* object) { |
+ DisallowHeapAllocation no_gc; |
+ HeapObject* prototype = HeapObject::cast(object->map()->prototype()); |
+ HeapObject* null = isolate->heap()->null_value(); |
+ HeapObject* empty = isolate->heap()->empty_fixed_array(); |
+ while (prototype != null) { |
+ Map* map = prototype->map(); |
+ if (map->instance_type() <= LAST_CUSTOM_ELEMENTS_RECEIVER) return false; |
+ if (JSObject::cast(prototype)->elements() != empty) return false; |
+ prototype = HeapObject::cast(map->prototype()); |
+ } |
+ return true; |
+} |
+ |
#define FIELD_ADDR(p, offset) \ |
(reinterpret_cast<byte*>(p) + offset - kHeapObjectTag) |