| Index: src/objects.cc
|
| diff --git a/src/objects.cc b/src/objects.cc
|
| index ad2f679f4d86e2ea5275f821e90a81a21c05bc3c..a4a7022ed8bbbc14b7988bb64b216fe7545b8ba3 100644
|
| --- a/src/objects.cc
|
| +++ b/src/objects.cc
|
| @@ -12732,6 +12732,24 @@ Handle<Cell> Map::GetOrCreatePrototypeChainValidityCell(Handle<Map> map,
|
| return cell;
|
| }
|
|
|
| +// static
|
| +Handle<WeakCell> Map::GetOrCreatePrototypeWeakCell(Handle<JSObject> prototype,
|
| + Isolate* isolate) {
|
| + DCHECK(!prototype.is_null());
|
| + Handle<PrototypeInfo> proto_info =
|
| + GetOrCreatePrototypeInfo(prototype, isolate);
|
| + Object* maybe_cell = proto_info->weak_cell();
|
| + // Return existing cell if it's already created.
|
| + if (maybe_cell->IsWeakCell()) {
|
| + Handle<WeakCell> cell(WeakCell::cast(maybe_cell), isolate);
|
| + DCHECK(!cell->cleared());
|
| + return cell;
|
| + }
|
| + // Otherwise create a new cell.
|
| + Handle<WeakCell> cell = isolate->factory()->NewWeakCell(prototype);
|
| + proto_info->set_weak_cell(*cell);
|
| + return cell;
|
| +}
|
|
|
| // static
|
| void Map::SetPrototype(Handle<Map> map, Handle<Object> prototype,
|
|
|