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

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

Issue 886473005: Add WeakMap to v8.h (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Moved constructor&destructor to api.cc Created 5 years, 11 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 6c19cb8e47d5caa1c92b96d9704e23653424b9e5..c3b0c2efd1b3596cff4fefb3500b3762fcd3c20d 100644
--- a/test/cctest/test-weakmaps.cc
+++ b/test/cctest/test-weakmaps.cc
@@ -42,10 +42,7 @@ static Isolate* GetIsolateFrom(LocalContext* context) {
static Handle<JSWeakMap> AllocateJSWeakMap(Isolate* isolate) {
- 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));
+ Handle<JSWeakMap> weakmap = isolate->factory()->NewJSWeakMap();
// Do not leak handles for the hash table, it would make entries strong.
{
HandleScope scope(isolate);
@@ -58,11 +55,7 @@ static Handle<JSWeakMap> AllocateJSWeakMap(Isolate* isolate) {
static void PutIntoWeakMap(Handle<JSWeakMap> weakmap,
Handle<JSObject> key,
Handle<Object> value) {
- Handle<ObjectHashTable> table = ObjectHashTable::Put(
- Handle<ObjectHashTable>(ObjectHashTable::cast(weakmap->table())),
- Handle<JSObject>(JSObject::cast(*key)),
- value);
- weakmap->set_table(*table);
+ Runtime::WeakCollectionSet(weakmap, key, value);
}
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