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

Side by Side Diff: test/cctest/test-weaksets.cc

Issue 301553003: Make incremental marker post-process JSWeakCollection. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Hide some visitor functions. Created 6 years, 6 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « test/cctest/test-weakmaps.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 28 matching lines...) Expand all
39 static Isolate* GetIsolateFrom(LocalContext* context) { 39 static Isolate* GetIsolateFrom(LocalContext* context) {
40 return reinterpret_cast<Isolate*>((*context)->GetIsolate()); 40 return reinterpret_cast<Isolate*>((*context)->GetIsolate());
41 } 41 }
42 42
43 43
44 static Handle<JSWeakSet> AllocateJSWeakSet(Isolate* isolate) { 44 static Handle<JSWeakSet> AllocateJSWeakSet(Isolate* isolate) {
45 Factory* factory = isolate->factory(); 45 Factory* factory = isolate->factory();
46 Handle<Map> map = factory->NewMap(JS_WEAK_SET_TYPE, JSWeakSet::kSize); 46 Handle<Map> map = factory->NewMap(JS_WEAK_SET_TYPE, JSWeakSet::kSize);
47 Handle<JSObject> weakset_obj = factory->NewJSObjectFromMap(map); 47 Handle<JSObject> weakset_obj = factory->NewJSObjectFromMap(map);
48 Handle<JSWeakSet> weakset(JSWeakSet::cast(*weakset_obj)); 48 Handle<JSWeakSet> weakset(JSWeakSet::cast(*weakset_obj));
49 // Do not use handles for the hash table, it would make entries strong. 49 // Do not leak handles for the hash table, it would make entries strong.
50 Handle<ObjectHashTable> table = ObjectHashTable::New(isolate, 1); 50 {
51 weakset->set_table(*table); 51 HandleScope scope(isolate);
52 weakset->set_next(Smi::FromInt(0)); 52 Handle<ObjectHashTable> table = ObjectHashTable::New(isolate, 1);
53 weakset->set_table(*table);
54 }
53 return weakset; 55 return weakset;
54 } 56 }
55 57
56 static void PutIntoWeakSet(Handle<JSWeakSet> weakset, 58 static void PutIntoWeakSet(Handle<JSWeakSet> weakset,
57 Handle<JSObject> key, 59 Handle<JSObject> key,
58 Handle<Object> value) { 60 Handle<Object> value) {
59 Handle<ObjectHashTable> table = ObjectHashTable::Put( 61 Handle<ObjectHashTable> table = ObjectHashTable::Put(
60 Handle<ObjectHashTable>(ObjectHashTable::cast(weakset->table())), 62 Handle<ObjectHashTable>(ObjectHashTable::cast(weakset->table())),
61 Handle<JSObject>(JSObject::cast(*key)), 63 Handle<JSObject>(JSObject::cast(*key)),
62 value); 64 value);
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 Handle<Smi>(Smi::FromInt(i), isolate)); 248 Handle<Smi>(Smi::FromInt(i), isolate));
247 } 249 }
248 250
249 // Force compacting garbage collection. The subsequent collections are used 251 // Force compacting garbage collection. The subsequent collections are used
250 // to verify that key references were actually updated. 252 // to verify that key references were actually updated.
251 CHECK(FLAG_always_compact); 253 CHECK(FLAG_always_compact);
252 heap->CollectAllGarbage(Heap::kNoGCFlags); 254 heap->CollectAllGarbage(Heap::kNoGCFlags);
253 heap->CollectAllGarbage(Heap::kNoGCFlags); 255 heap->CollectAllGarbage(Heap::kNoGCFlags);
254 heap->CollectAllGarbage(Heap::kNoGCFlags); 256 heap->CollectAllGarbage(Heap::kNoGCFlags);
255 } 257 }
OLDNEW
« no previous file with comments | « test/cctest/test-weakmaps.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698