| 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 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 32, ObjectHashTable::cast(weakset->table())->NumberOfDeletedElements()); | 173 32, ObjectHashTable::cast(weakset->table())->NumberOfDeletedElements()); |
| 174 | 174 |
| 175 // Check shrunk capacity. | 175 // Check shrunk capacity. |
| 176 CHECK_EQ(32, ObjectHashTable::cast(weakset->table())->Capacity()); | 176 CHECK_EQ(32, ObjectHashTable::cast(weakset->table())->Capacity()); |
| 177 } | 177 } |
| 178 | 178 |
| 179 | 179 |
| 180 // Test that weak set values on an evacuation candidate which are not reachable | 180 // Test that weak set values on an evacuation candidate which are not reachable |
| 181 // by other paths are correctly recorded in the slots buffer. | 181 // by other paths are correctly recorded in the slots buffer. |
| 182 TEST(WeakSet_Regress2060a) { | 182 TEST(WeakSet_Regress2060a) { |
| 183 if (i::FLAG_never_compact) return; |
| 183 FLAG_always_compact = true; | 184 FLAG_always_compact = true; |
| 184 LocalContext context; | 185 LocalContext context; |
| 185 Isolate* isolate = GetIsolateFrom(&context); | 186 Isolate* isolate = GetIsolateFrom(&context); |
| 186 Factory* factory = isolate->factory(); | 187 Factory* factory = isolate->factory(); |
| 187 Heap* heap = isolate->heap(); | 188 Heap* heap = isolate->heap(); |
| 188 HandleScope scope(isolate); | 189 HandleScope scope(isolate); |
| 189 Handle<JSFunction> function = | 190 Handle<JSFunction> function = |
| 190 factory->NewFunction(factory->function_string(), factory->null_value()); | 191 factory->NewFunction(factory->function_string(), factory->null_value()); |
| 191 Handle<JSObject> key = factory->NewJSObject(function); | 192 Handle<JSObject> key = factory->NewJSObject(function); |
| 192 Handle<JSWeakSet> weakset = AllocateJSWeakSet(isolate); | 193 Handle<JSWeakSet> weakset = AllocateJSWeakSet(isolate); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 208 | 209 |
| 209 // Force compacting garbage collection. | 210 // Force compacting garbage collection. |
| 210 CHECK(FLAG_always_compact); | 211 CHECK(FLAG_always_compact); |
| 211 heap->CollectAllGarbage(Heap::kNoGCFlags); | 212 heap->CollectAllGarbage(Heap::kNoGCFlags); |
| 212 } | 213 } |
| 213 | 214 |
| 214 | 215 |
| 215 // Test that weak set keys on an evacuation candidate which are reachable by | 216 // Test that weak set keys on an evacuation candidate which are reachable by |
| 216 // other strong paths are correctly recorded in the slots buffer. | 217 // other strong paths are correctly recorded in the slots buffer. |
| 217 TEST(WeakSet_Regress2060b) { | 218 TEST(WeakSet_Regress2060b) { |
| 219 if (i::FLAG_never_compact) return; |
| 218 FLAG_always_compact = true; | 220 FLAG_always_compact = true; |
| 219 #ifdef VERIFY_HEAP | 221 #ifdef VERIFY_HEAP |
| 220 FLAG_verify_heap = true; | 222 FLAG_verify_heap = true; |
| 221 #endif | 223 #endif |
| 222 | 224 |
| 223 LocalContext context; | 225 LocalContext context; |
| 224 Isolate* isolate = GetIsolateFrom(&context); | 226 Isolate* isolate = GetIsolateFrom(&context); |
| 225 Factory* factory = isolate->factory(); | 227 Factory* factory = isolate->factory(); |
| 226 Heap* heap = isolate->heap(); | 228 Heap* heap = isolate->heap(); |
| 227 HandleScope scope(isolate); | 229 HandleScope scope(isolate); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 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 } |
| OLD | NEW |