| Index: src/objects.cc
|
| diff --git a/src/objects.cc b/src/objects.cc
|
| index fb594fd2d6c9102de48f3da44c002958dd19ba5b..4582ba41c14abec9f816cf980d2abee00186a0a8 100644
|
| --- a/src/objects.cc
|
| +++ b/src/objects.cc
|
| @@ -1925,7 +1925,7 @@ Maybe<bool> JSReceiver::HasInPrototypeChain(Isolate* isolate,
|
| }
|
| }
|
|
|
| -Map* Object::GetRootMap(Isolate* isolate) {
|
| +Map* Object::GetPrototypeChainRootMap(Isolate* isolate) {
|
| DisallowHeapAllocation no_alloc;
|
| if (IsSmi()) {
|
| Context* native_context = isolate->context()->native_context();
|
| @@ -1935,11 +1935,15 @@ Map* Object::GetRootMap(Isolate* isolate) {
|
| // The object is either a number, a string, a symbol, a boolean, a SIMD value,
|
| // a real JS object, or a Harmony proxy.
|
| HeapObject* heap_object = HeapObject::cast(this);
|
| - if (heap_object->IsJSReceiver()) {
|
| - return heap_object->map();
|
| + return heap_object->map()->GetPrototypeChainRootMap(isolate);
|
| +}
|
| +
|
| +Map* Map::GetPrototypeChainRootMap(Isolate* isolate) {
|
| + DisallowHeapAllocation no_alloc;
|
| + if (IsJSReceiverMap()) {
|
| + return this;
|
| }
|
| - int constructor_function_index =
|
| - heap_object->map()->GetConstructorFunctionIndex();
|
| + int constructor_function_index = GetConstructorFunctionIndex();
|
| if (constructor_function_index != Map::kNoConstructorFunctionIndex) {
|
| Context* native_context = isolate->context()->native_context();
|
| JSFunction* constructor_function =
|
| @@ -12728,7 +12732,8 @@ void Map::SetShouldBeFastPrototypeMap(Handle<Map> map, bool value,
|
| // static
|
| Handle<Cell> Map::GetOrCreatePrototypeChainValidityCell(Handle<Map> map,
|
| Isolate* isolate) {
|
| - Handle<Object> maybe_prototype(map->prototype(), isolate);
|
| + Handle<Object> maybe_prototype(
|
| + map->GetPrototypeChainRootMap(isolate)->prototype(), isolate);
|
| if (!maybe_prototype->IsJSObject()) return Handle<Cell>::null();
|
| Handle<JSObject> prototype = Handle<JSObject>::cast(maybe_prototype);
|
| // Ensure the prototype is registered with its own prototypes so its cell
|
|
|