OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
2 | 2 |
3 #include <stdlib.h> | 3 #include <stdlib.h> |
4 | 4 |
5 #include "v8.h" | 5 #include "v8.h" |
6 | 6 |
7 #include "execution.h" | 7 #include "execution.h" |
8 #include "factory.h" | 8 #include "factory.h" |
9 #include "macro-assembler.h" | 9 #include "macro-assembler.h" |
10 #include "global-handles.h" | 10 #include "global-handles.h" |
(...skipping 1588 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1599 CHECK_EQ(10 - 3, baseObject->map()->NumberOfProtoTransitions()); | 1599 CHECK_EQ(10 - 3, baseObject->map()->NumberOfProtoTransitions()); |
1600 | 1600 |
1601 // Verify that prototype transitions array was compacted. | 1601 // Verify that prototype transitions array was compacted. |
1602 FixedArray* trans = baseObject->map()->prototype_transitions(); | 1602 FixedArray* trans = baseObject->map()->prototype_transitions(); |
1603 for (int i = 0; i < 10 - 3; i++) { | 1603 for (int i = 0; i < 10 - 3; i++) { |
1604 int j = Map::kProtoTransitionHeaderSize + | 1604 int j = Map::kProtoTransitionHeaderSize + |
1605 i * Map::kProtoTransitionElementsPerEntry; | 1605 i * Map::kProtoTransitionElementsPerEntry; |
1606 CHECK(trans->get(j + Map::kProtoTransitionMapOffset)->IsMap()); | 1606 CHECK(trans->get(j + Map::kProtoTransitionMapOffset)->IsMap()); |
1607 CHECK(trans->get(j + Map::kProtoTransitionPrototypeOffset)->IsJSObject()); | 1607 CHECK(trans->get(j + Map::kProtoTransitionPrototypeOffset)->IsJSObject()); |
1608 } | 1608 } |
| 1609 |
| 1610 // Make sure next prototype is placed on an old-space evacuation candidate. |
| 1611 Handle<JSObject> prototype; |
| 1612 PagedSpace* space = HEAP->old_pointer_space(); |
| 1613 do { |
| 1614 prototype = FACTORY->NewJSArray(32 * KB, TENURED); |
| 1615 } while (space->FirstPage() == space->LastPage() || |
| 1616 !space->LastPage()->Contains(prototype->address())); |
| 1617 |
| 1618 // Add a prototype on an evacuation candidate and verify that transition |
| 1619 // clearing correctly records slots in prototype transition array. |
| 1620 i::FLAG_always_compact = true; |
| 1621 Handle<Map> map(baseObject->map()); |
| 1622 CHECK(!space->LastPage()->Contains(map->prototype_transitions()->address())); |
| 1623 CHECK(space->LastPage()->Contains(prototype->address())); |
| 1624 baseObject->SetPrototype(*prototype, false)->ToObjectChecked(); |
| 1625 CHECK(map->GetPrototypeTransition(*prototype)->IsMap()); |
| 1626 HEAP->CollectAllGarbage(Heap::kNoGCFlags); |
| 1627 CHECK(map->GetPrototypeTransition(*prototype)->IsMap()); |
1609 } | 1628 } |
OLD | NEW |