Index: src/objects-inl.h |
diff --git a/src/objects-inl.h b/src/objects-inl.h |
index 0f7660a71a295e820c9073ef0c6fff457ac930bc..cfd744cbd9847d83cf6794404784aea1b2608d17 100644 |
--- a/src/objects-inl.h |
+++ b/src/objects-inl.h |
@@ -1134,6 +1134,20 @@ MUST_USE_RESULT MaybeHandle<FixedArray> JSReceiver::OwnPropertyKeys( |
GetKeysConversion::kConvertToString); |
} |
+bool JSObject::PrototypeHasNoElements(Isolate* isolate, JSObject* object) { |
Camillo Bruni
2016/07/21 08:01:55
indeed makes more sense here :)
|
+ 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) |