Index: test/cctest/test-weakmaps.cc |
diff --git a/test/cctest/test-weakmaps.cc b/test/cctest/test-weakmaps.cc |
index 04f41b9aee979161b05a6ebb2c74e5b6792c7459..c3b0c2efd1b3596cff4fefb3500b3762fcd3c20d 100644 |
--- a/test/cctest/test-weakmaps.cc |
+++ b/test/cctest/test-weakmaps.cc |
@@ -52,6 +52,12 @@ |
return weakmap; |
} |
+static void PutIntoWeakMap(Handle<JSWeakMap> weakmap, |
+ Handle<JSObject> key, |
+ Handle<Object> value) { |
+ Runtime::WeakCollectionSet(weakmap, key, value); |
+} |
+ |
static int NumberOfWeakCalls = 0; |
static void WeakPointerCallback( |
const v8::WeakCallbackData<v8::Value, void>& data) { |
@@ -89,9 +95,8 @@ |
HandleScope scope(isolate); |
Handle<Map> map = factory->NewMap(JS_OBJECT_TYPE, JSObject::kHeaderSize); |
Handle<JSObject> object = factory->NewJSObjectFromMap(map); |
- Handle<Smi> smi(Smi::FromInt(23), isolate); |
- Runtime::WeakCollectionSet(weakmap, key, object); |
- Runtime::WeakCollectionSet(weakmap, object, smi); |
+ PutIntoWeakMap(weakmap, Handle<JSObject>(JSObject::cast(*key)), object); |
+ PutIntoWeakMap(weakmap, object, Handle<Smi>(Smi::FromInt(23), isolate)); |
} |
CHECK_EQ(2, ObjectHashTable::cast(weakmap->table())->NumberOfElements()); |
@@ -145,8 +150,7 @@ |
Handle<Map> map = factory->NewMap(JS_OBJECT_TYPE, JSObject::kHeaderSize); |
for (int i = 0; i < 32; i++) { |
Handle<JSObject> object = factory->NewJSObjectFromMap(map); |
- Handle<Smi> smi(Smi::FromInt(i), isolate); |
- Runtime::WeakCollectionSet(weakmap, object, smi); |
+ PutIntoWeakMap(weakmap, object, Handle<Smi>(Smi::FromInt(i), isolate)); |
} |
} |
@@ -193,7 +197,7 @@ |
Handle<JSObject> object = factory->NewJSObject(function, TENURED); |
CHECK(!heap->InNewSpace(object->address())); |
CHECK(!first_page->Contains(object->address())); |
- Runtime::WeakCollectionSet(weakmap, key, object); |
+ PutIntoWeakMap(weakmap, key, object); |
} |
} |
@@ -233,8 +237,9 @@ |
} |
Handle<JSWeakMap> weakmap = AllocateJSWeakMap(isolate); |
for (int i = 0; i < 32; i++) { |
- Handle<Smi> smi(Smi::FromInt(i), isolate); |
- Runtime::WeakCollectionSet(weakmap, keys[i], smi); |
+ PutIntoWeakMap(weakmap, |
+ keys[i], |
+ Handle<Smi>(Smi::FromInt(i), isolate)); |
} |
// Force compacting garbage collection. The subsequent collections are used |