Chromium Code Reviews| Index: test/cctest/test-heap.cc |
| diff --git a/test/cctest/test-heap.cc b/test/cctest/test-heap.cc |
| index b3058f764d83331c10a7f3e7589982c0b3d2333c..6e0bc954dc006009901dcb47c92ca2ee5a574692 100644 |
| --- a/test/cctest/test-heap.cc |
| +++ b/test/cctest/test-heap.cc |
| @@ -2004,8 +2004,14 @@ TEST(PrototypeTransitionClearing) { |
| Factory* factory = isolate->factory(); |
| v8::HandleScope scope(CcTest::isolate()); |
| + CompileRun("var base = {};"); |
|
rafaelw
2014/03/05 00:48:46
Note: the way this test was structured was asserti
rossberg
2014/03/06 08:41:35
Sounds plausible, although you never know if there
Toon Verwaest
2014/03/06 13:01:25
Sounds good to me.
On 2014/03/06 08:41:35, rossbe
|
| + Handle<JSObject> baseObject = |
| + v8::Utils::OpenHandle( |
| + *v8::Handle<v8::Object>::Cast( |
| + CcTest::global()->Get(v8_str("base")))); |
| + int initialTransitions = baseObject->map()->NumberOfProtoTransitions(); |
| + |
| CompileRun( |
| - "var base = {};" |
| "var live = [];" |
| "for (var i = 0; i < 10; i++) {" |
| " var object = {};" |
| @@ -2014,25 +2020,22 @@ TEST(PrototypeTransitionClearing) { |
| " if (i >= 3) live.push(object, prototype);" |
| "}"); |
| - Handle<JSObject> baseObject = |
| - v8::Utils::OpenHandle( |
| - *v8::Handle<v8::Object>::Cast( |
| - CcTest::global()->Get(v8_str("base")))); |
| - |
| // Verify that only dead prototype transitions are cleared. |
| - CHECK_EQ(10, baseObject->map()->NumberOfProtoTransitions()); |
| + CHECK_EQ(initialTransitions + 10, |
| + baseObject->map()->NumberOfProtoTransitions()); |
| CcTest::heap()->CollectAllGarbage(Heap::kAbortIncrementalMarkingMask); |
| const int transitions = 10 - 3; |
| - CHECK_EQ(transitions, baseObject->map()->NumberOfProtoTransitions()); |
| + CHECK_EQ(initialTransitions + transitions, |
| + baseObject->map()->NumberOfProtoTransitions()); |
| // Verify that prototype transitions array was compacted. |
| FixedArray* trans = baseObject->map()->GetPrototypeTransitions(); |
| - for (int i = 0; i < transitions; i++) { |
| + for (int i = initialTransitions; i < initialTransitions + transitions; i++) { |
| int j = Map::kProtoTransitionHeaderSize + |
| i * Map::kProtoTransitionElementsPerEntry; |
| CHECK(trans->get(j + Map::kProtoTransitionMapOffset)->IsMap()); |
| Object* proto = trans->get(j + Map::kProtoTransitionPrototypeOffset); |
| - CHECK(proto->IsTheHole() || proto->IsJSObject()); |
|
rafaelw
2014/03/05 00:48:46
It seems like the check for the hole here was actu
|
| + CHECK(proto->IsJSObject()); |
| } |
| // Make sure next prototype is placed on an old-space evacuation candidate. |