| Index: src/objects.cc
|
| diff --git a/src/objects.cc b/src/objects.cc
|
| index ef5185145a1ae55148e816a9c486600c6ab2ec15..369df4c96c58a2187592d83adc0a44e7b4476e67 100644
|
| --- a/src/objects.cc
|
| +++ b/src/objects.cc
|
| @@ -5123,6 +5123,47 @@ void Map::ClearNonLiveTransitions(Object* real_prototype) {
|
| }
|
|
|
|
|
| +void Map::TraverseTransitionTree() {
|
| + Map* current = this;
|
| + while (current != Heap::meta_map()) {
|
| + DescriptorArray* d = reinterpret_cast<DescriptorArray*>(
|
| + *RawField(current, Map::kInstanceDescriptorsOffset));
|
| + if (d == Heap::empty_descriptor_array()) {
|
| + Map* prev = current->map();
|
| + current->set_map(Heap::meta_map());
|
| + current->Print();
|
| + current = prev;
|
| + continue;
|
| + }
|
| + FixedArray* contents = reinterpret_cast<FixedArray*>(
|
| + d->get(DescriptorArray::kContentArrayIndex));
|
| + Object** map_or_index_field = RawField(contents, HeapObject::kMapOffset);
|
| + Object* map_or_index = *map_or_index_field;
|
| + ASSERT(map_or_index->IsSmi() || map_or_index == Heap::fixed_array_map());
|
| + bool map_done = true;
|
| + for (int i = map_or_index->IsSmi() ? Smi::cast(map_or_index)->value() : 0;
|
| + i < contents->length();
|
| + i += 2) {
|
| + PropertyDetails details(Smi::cast(contents->get(i + 1)));
|
| + if (details.IsTransition()) {
|
| + Map* next = Map::cast(contents->get(i));
|
| + next->set_map(current);
|
| + *map_or_index_field = Smi::FromInt(i + 2);
|
| + current = next;
|
| + map_done = false;
|
| + break;
|
| + }
|
| + }
|
| + if (!map_done) continue;
|
| + *map_or_index_field = Heap::fixed_array_map();
|
| + Map* prev = current->map();
|
| + current->set_map(Heap::meta_map());
|
| + current->Print();
|
| + current = prev;
|
| + }
|
| +}
|
| +
|
| +
|
| void JSFunction::JSFunctionIterateBody(int object_size, ObjectVisitor* v) {
|
| // Iterate over all fields in the body but take care in dealing with
|
| // the code entry.
|
|
|