Index: test/cctest/test-heap.cc |
diff --git a/test/cctest/test-heap.cc b/test/cctest/test-heap.cc |
index 3157f3e538515b7f29d95afb47bd69bd1d4ed8b4..933172e2dc01007f7367ab0bc1bb484ebd92af81 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 = {};"); |
+ 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()); |
+ CHECK(proto->IsJSObject()); |
} |
// Make sure next prototype is placed on an old-space evacuation candidate. |