| OLD | NEW |
| 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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 Object* table_obj = ObjectHashTable::Allocate(heap, 1)->ToObjectChecked(); | 49 Object* table_obj = ObjectHashTable::Allocate(heap, 1)->ToObjectChecked(); |
| 50 ObjectHashTable* table = ObjectHashTable::cast(table_obj); | 50 ObjectHashTable* table = ObjectHashTable::cast(table_obj); |
| 51 weakset->set_table(table); | 51 weakset->set_table(table); |
| 52 weakset->set_next(Smi::FromInt(0)); | 52 weakset->set_next(Smi::FromInt(0)); |
| 53 return weakset; | 53 return weakset; |
| 54 } | 54 } |
| 55 | 55 |
| 56 static void PutIntoWeakSet(Handle<JSWeakSet> weakset, | 56 static void PutIntoWeakSet(Handle<JSWeakSet> weakset, |
| 57 Handle<JSObject> key, | 57 Handle<JSObject> key, |
| 58 Handle<Object> value) { | 58 Handle<Object> value) { |
| 59 Handle<ObjectHashTable> table = PutIntoObjectHashTable( | 59 Handle<ObjectHashTable> table = ObjectHashTable::Put( |
| 60 Handle<ObjectHashTable>(ObjectHashTable::cast(weakset->table())), | 60 Handle<ObjectHashTable>(ObjectHashTable::cast(weakset->table())), |
| 61 Handle<JSObject>(JSObject::cast(*key)), | 61 Handle<JSObject>(JSObject::cast(*key)), |
| 62 value); | 62 value); |
| 63 weakset->set_table(*table); | 63 weakset->set_table(*table); |
| 64 } | 64 } |
| 65 | 65 |
| 66 static int NumberOfWeakCalls = 0; | 66 static int NumberOfWeakCalls = 0; |
| 67 static void WeakPointerCallback(v8::Isolate* isolate, | 67 static void WeakPointerCallback(v8::Isolate* isolate, |
| 68 v8::Persistent<v8::Value>* handle, | 68 v8::Persistent<v8::Value>* handle, |
| 69 void* id) { | 69 void* id) { |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 241 Handle<Smi>(Smi::FromInt(i), isolate)); | 241 Handle<Smi>(Smi::FromInt(i), isolate)); |
| 242 } | 242 } |
| 243 | 243 |
| 244 // Force compacting garbage collection. The subsequent collections are used | 244 // Force compacting garbage collection. The subsequent collections are used |
| 245 // to verify that key references were actually updated. | 245 // to verify that key references were actually updated. |
| 246 CHECK(FLAG_always_compact); | 246 CHECK(FLAG_always_compact); |
| 247 heap->CollectAllGarbage(Heap::kNoGCFlags); | 247 heap->CollectAllGarbage(Heap::kNoGCFlags); |
| 248 heap->CollectAllGarbage(Heap::kNoGCFlags); | 248 heap->CollectAllGarbage(Heap::kNoGCFlags); |
| 249 heap->CollectAllGarbage(Heap::kNoGCFlags); | 249 heap->CollectAllGarbage(Heap::kNoGCFlags); |
| 250 } | 250 } |
| OLD | NEW |