diff options
author | isaacs <i@izs.me> | 2012-09-18 15:20:38 -0700 |
---|---|---|
committer | Bert Belder <bertbelder@gmail.com> | 2012-09-21 01:52:24 +0200 |
commit | 3411a03dd114d635800cc50749d2351cd734eb2a (patch) | |
tree | 0ba1e52ab2236286894b33400302181ece91b63a /deps/v8/test/cctest/test-dictionary.cc | |
parent | cc1b09d6b7c3cc6b8729804cbf644634ba5d0815 (diff) | |
download | android-node-v8-3411a03dd114d635800cc50749d2351cd734eb2a.tar.gz android-node-v8-3411a03dd114d635800cc50749d2351cd734eb2a.tar.bz2 android-node-v8-3411a03dd114d635800cc50749d2351cd734eb2a.zip |
V8: Upgrade to 3.13.7.1
Diffstat (limited to 'deps/v8/test/cctest/test-dictionary.cc')
-rw-r--r-- | deps/v8/test/cctest/test-dictionary.cc | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/deps/v8/test/cctest/test-dictionary.cc b/deps/v8/test/cctest/test-dictionary.cc index 793e228a97..00e38333fc 100644 --- a/deps/v8/test/cctest/test-dictionary.cc +++ b/deps/v8/test/cctest/test-dictionary.cc @@ -48,24 +48,24 @@ TEST(ObjectHashTable) { table = PutIntoObjectHashTable(table, a, b); CHECK_EQ(table->NumberOfElements(), 1); CHECK_EQ(table->Lookup(*a), *b); - CHECK_EQ(table->Lookup(*b), HEAP->undefined_value()); + CHECK_EQ(table->Lookup(*b), HEAP->the_hole_value()); // Keys still have to be valid after objects were moved. HEAP->CollectGarbage(NEW_SPACE); CHECK_EQ(table->NumberOfElements(), 1); CHECK_EQ(table->Lookup(*a), *b); - CHECK_EQ(table->Lookup(*b), HEAP->undefined_value()); + CHECK_EQ(table->Lookup(*b), HEAP->the_hole_value()); // Keys that are overwritten should not change number of elements. table = PutIntoObjectHashTable(table, a, FACTORY->NewJSArray(13)); CHECK_EQ(table->NumberOfElements(), 1); CHECK_NE(table->Lookup(*a), *b); - // Keys mapped to undefined should be removed permanently. - table = PutIntoObjectHashTable(table, a, FACTORY->undefined_value()); + // Keys mapped to the hole should be removed permanently. + table = PutIntoObjectHashTable(table, a, FACTORY->the_hole_value()); CHECK_EQ(table->NumberOfElements(), 0); CHECK_EQ(table->NumberOfDeletedElements(), 1); - CHECK_EQ(table->Lookup(*a), HEAP->undefined_value()); + CHECK_EQ(table->Lookup(*a), HEAP->the_hole_value()); // Keys should map back to their respective values and also should get // an identity hash code generated. @@ -85,7 +85,7 @@ TEST(ObjectHashTable) { Handle<JSObject> key = FACTORY->NewJSArray(7); CHECK(key->GetIdentityHash(ALLOW_CREATION)->ToObjectChecked()->IsSmi()); CHECK_EQ(table->FindEntry(*key), ObjectHashTable::kNotFound); - CHECK_EQ(table->Lookup(*key), HEAP->undefined_value()); + CHECK_EQ(table->Lookup(*key), HEAP->the_hole_value()); CHECK(key->GetIdentityHash(OMIT_CREATION)->ToObjectChecked()->IsSmi()); } @@ -93,7 +93,7 @@ TEST(ObjectHashTable) { // should not get an identity hash code generated. for (int i = 0; i < 100; i++) { Handle<JSObject> key = FACTORY->NewJSArray(7); - CHECK_EQ(table->Lookup(*key), HEAP->undefined_value()); + CHECK_EQ(table->Lookup(*key), HEAP->the_hole_value()); CHECK_EQ(key->GetIdentityHash(OMIT_CREATION), HEAP->undefined_value()); } } @@ -105,6 +105,12 @@ TEST(ObjectHashSetCausesGC) { LocalContext context; Handle<ObjectHashSet> table = FACTORY->NewObjectHashSet(1); Handle<JSObject> key = FACTORY->NewJSArray(0); + v8::Handle<v8::Object> key_obj = v8::Utils::ToLocal(key); + + // Force allocation of hash table backing store for hidden properties. + key_obj->SetHiddenValue(v8_str("key 1"), v8_str("val 1")); + key_obj->SetHiddenValue(v8_str("key 2"), v8_str("val 2")); + key_obj->SetHiddenValue(v8_str("key 3"), v8_str("val 3")); // Simulate a full heap so that generating an identity hash code // in subsequent calls will request GC. @@ -128,13 +134,19 @@ TEST(ObjectHashTableCausesGC) { LocalContext context; Handle<ObjectHashTable> table = FACTORY->NewObjectHashTable(1); Handle<JSObject> key = FACTORY->NewJSArray(0); + v8::Handle<v8::Object> key_obj = v8::Utils::ToLocal(key); + + // Force allocation of hash table backing store for hidden properties. + key_obj->SetHiddenValue(v8_str("key 1"), v8_str("val 1")); + key_obj->SetHiddenValue(v8_str("key 2"), v8_str("val 2")); + key_obj->SetHiddenValue(v8_str("key 3"), v8_str("val 3")); // Simulate a full heap so that generating an identity hash code // in subsequent calls will request GC. FLAG_gc_interval = 0; // Calling Lookup() should not cause GC ever. - CHECK(table->Lookup(*key)->IsUndefined()); + CHECK(table->Lookup(*key)->IsTheHole()); // Calling Put() should request GC by returning a failure. CHECK(table->Put(*key, *key)->IsRetryAfterGC()); |