Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1562)

Unified Diff: test/cctest/test-weakmaps.cc

Issue 903463002: Simplify WeakMap and WeakSet tests slightly. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | test/cctest/test-weaksets.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/test-weakmaps.cc
diff --git a/test/cctest/test-weakmaps.cc b/test/cctest/test-weakmaps.cc
index c3b0c2efd1b3596cff4fefb3500b3762fcd3c20d..04f41b9aee979161b05a6ebb2c74e5b6792c7459 100644
--- a/test/cctest/test-weakmaps.cc
+++ b/test/cctest/test-weakmaps.cc
@@ -52,12 +52,6 @@ static Handle<JSWeakMap> AllocateJSWeakMap(Isolate* isolate) {
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) {
@@ -95,8 +89,9 @@ TEST(Weakness) {
HandleScope scope(isolate);
Handle<Map> map = factory->NewMap(JS_OBJECT_TYPE, JSObject::kHeaderSize);
Handle<JSObject> object = factory->NewJSObjectFromMap(map);
- PutIntoWeakMap(weakmap, Handle<JSObject>(JSObject::cast(*key)), object);
- PutIntoWeakMap(weakmap, object, Handle<Smi>(Smi::FromInt(23), isolate));
+ Handle<Smi> smi(Smi::FromInt(23), isolate);
+ Runtime::WeakCollectionSet(weakmap, key, object);
+ Runtime::WeakCollectionSet(weakmap, object, smi);
}
CHECK_EQ(2, ObjectHashTable::cast(weakmap->table())->NumberOfElements());
@@ -150,7 +145,8 @@ TEST(Shrinking) {
Handle<Map> map = factory->NewMap(JS_OBJECT_TYPE, JSObject::kHeaderSize);
for (int i = 0; i < 32; i++) {
Handle<JSObject> object = factory->NewJSObjectFromMap(map);
- PutIntoWeakMap(weakmap, object, Handle<Smi>(Smi::FromInt(i), isolate));
+ Handle<Smi> smi(Smi::FromInt(i), isolate);
+ Runtime::WeakCollectionSet(weakmap, object, smi);
}
}
@@ -197,7 +193,7 @@ TEST(Regress2060a) {
Handle<JSObject> object = factory->NewJSObject(function, TENURED);
CHECK(!heap->InNewSpace(object->address()));
CHECK(!first_page->Contains(object->address()));
- PutIntoWeakMap(weakmap, key, object);
+ Runtime::WeakCollectionSet(weakmap, key, object);
}
}
@@ -237,9 +233,8 @@ TEST(Regress2060b) {
}
Handle<JSWeakMap> weakmap = AllocateJSWeakMap(isolate);
for (int i = 0; i < 32; i++) {
- PutIntoWeakMap(weakmap,
- keys[i],
- Handle<Smi>(Smi::FromInt(i), isolate));
+ Handle<Smi> smi(Smi::FromInt(i), isolate);
+ Runtime::WeakCollectionSet(weakmap, keys[i], smi);
}
// Force compacting garbage collection. The subsequent collections are used
« no previous file with comments | « no previous file | test/cctest/test-weaksets.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698