| Index: src/objects.cc
|
| diff --git a/src/objects.cc b/src/objects.cc
|
| index f4d22188b68fa747ae837d0367ab5d9050fb5cc8..aabb65816aefa3c24bd013da62030f42d8574ef7 100644
|
| --- a/src/objects.cc
|
| +++ b/src/objects.cc
|
| @@ -3417,6 +3417,12 @@ bool Map::IsMapInArrayPrototypeChain() {
|
| }
|
|
|
|
|
| +Handle<WeakCell> Map::WeakCellForMap(Handle<Map> map) {
|
| + // TODO(ulan): Cache the weak cell and avoid many allocations.
|
| + return map->GetIsolate()->factory()->NewWeakCell(map);
|
| +}
|
| +
|
| +
|
| static Handle<Map> AddMissingElementsTransitions(Handle<Map> map,
|
| ElementsKind to_kind) {
|
| DCHECK(IsTransitionElementsKind(map->elements_kind()));
|
| @@ -10541,6 +10547,7 @@ Object* Code::FindNthObject(int n, Map* match_map) {
|
| for (RelocIterator it(this, mask); !it.done(); it.next()) {
|
| RelocInfo* info = it.rinfo();
|
| Object* object = info->target_object();
|
| + if (object->IsWeakCell()) object = WeakCell::cast(object)->value();
|
| if (object->IsHeapObject()) {
|
| if (HeapObject::cast(object)->map() == match_map) {
|
| if (--n == 0) return object;
|
| @@ -10573,6 +10580,7 @@ void Code::FindAndReplace(const FindAndReplacePattern& pattern) {
|
| RelocInfo* info = it.rinfo();
|
| Object* object = info->target_object();
|
| if (object->IsHeapObject()) {
|
| + DCHECK(!object->IsWeakCell());
|
| Map* map = HeapObject::cast(object)->map();
|
| if (map == *pattern.find_[current_pattern]) {
|
| info->set_target_object(*pattern.replace_[current_pattern]);
|
| @@ -10591,6 +10599,7 @@ void Code::FindAllMaps(MapHandleList* maps) {
|
| for (RelocIterator it(this, mask); !it.done(); it.next()) {
|
| RelocInfo* info = it.rinfo();
|
| Object* object = info->target_object();
|
| + if (object->IsWeakCell()) object = WeakCell::cast(object)->value();
|
| if (object->IsMap()) maps->Add(handle(Map::cast(object)));
|
| }
|
| }
|
| @@ -10637,6 +10646,7 @@ MaybeHandle<Code> Code::FindHandlerForMap(Map* map) {
|
| RelocInfo* info = it.rinfo();
|
| if (info->rmode() == RelocInfo::EMBEDDED_OBJECT) {
|
| Object* object = info->target_object();
|
| + if (object->IsWeakCell()) object = WeakCell::cast(object)->value();
|
| if (object == map) return_next = true;
|
| } else if (return_next) {
|
| Code* code = Code::GetCodeFromTargetAddress(info->target_address());
|
|
|