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

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

Issue 901663002: Revert of Add WeakKeyMap to v8.h (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 | « test/cctest/test-api.cc ('k') | 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..6c19cb8e47d5caa1c92b96d9704e23653424b9e5 100644
--- a/test/cctest/test-weakmaps.cc
+++ b/test/cctest/test-weakmaps.cc
@@ -42,7 +42,10 @@
static Handle<JSWeakMap> AllocateJSWeakMap(Isolate* isolate) {
- Handle<JSWeakMap> weakmap = isolate->factory()->NewJSWeakMap();
+ Factory* factory = isolate->factory();
+ Handle<Map> map = factory->NewMap(JS_WEAK_MAP_TYPE, JSWeakMap::kSize);
+ Handle<JSObject> weakmap_obj = factory->NewJSObjectFromMap(map);
+ Handle<JSWeakMap> weakmap(JSWeakMap::cast(*weakmap_obj));
// Do not leak handles for the hash table, it would make entries strong.
{
HandleScope scope(isolate);
@@ -55,7 +58,11 @@
static void PutIntoWeakMap(Handle<JSWeakMap> weakmap,
Handle<JSObject> key,
Handle<Object> value) {
- Runtime::WeakCollectionSet(weakmap, key, value);
+ Handle<ObjectHashTable> table = ObjectHashTable::Put(
+ Handle<ObjectHashTable>(ObjectHashTable::cast(weakmap->table())),
+ Handle<JSObject>(JSObject::cast(*key)),
+ value);
+ weakmap->set_table(*table);
}
static int NumberOfWeakCalls = 0;
« no previous file with comments | « test/cctest/test-api.cc ('k') | test/cctest/test-weaksets.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698