| OLD | NEW |
| 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 237 CHECK_EQ(0, gc_starts); | 237 CHECK_EQ(0, gc_starts); |
| 238 CHECK_EQ(gc_ends, gc_starts); | 238 CHECK_EQ(gc_ends, gc_starts); |
| 239 | 239 |
| 240 CHECK(Heap::CollectGarbage(0, OLD_POINTER_SPACE)); | 240 CHECK(Heap::CollectGarbage(0, OLD_POINTER_SPACE)); |
| 241 CHECK_EQ(1, gc_starts); | 241 CHECK_EQ(1, gc_starts); |
| 242 CHECK_EQ(gc_ends, gc_starts); | 242 CHECK_EQ(gc_ends, gc_starts); |
| 243 } | 243 } |
| 244 | 244 |
| 245 | 245 |
| 246 static int NumberOfWeakCalls = 0; | 246 static int NumberOfWeakCalls = 0; |
| 247 static void WeakPointerCallback(v8::Persistent<v8::Object> handle, void* id) { | 247 static void WeakPointerCallback(v8::Persistent<v8::Value> handle, void* id) { |
| 248 NumberOfWeakCalls++; | 248 NumberOfWeakCalls++; |
| 249 } | 249 } |
| 250 | 250 |
| 251 TEST(ObjectGroups) { | 251 TEST(ObjectGroups) { |
| 252 InitializeVM(); | 252 InitializeVM(); |
| 253 | 253 |
| 254 NumberOfWeakCalls = 0; | 254 NumberOfWeakCalls = 0; |
| 255 v8::HandleScope handle_scope; | 255 v8::HandleScope handle_scope; |
| 256 | 256 |
| 257 Handle<Object> g1s1 = | 257 Handle<Object> g1s1 = |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 301 GlobalHandles::AddToGroup(reinterpret_cast<void*>(1), g1s1.location()); | 301 GlobalHandles::AddToGroup(reinterpret_cast<void*>(1), g1s1.location()); |
| 302 GlobalHandles::AddToGroup(reinterpret_cast<void*>(1), g1s2.location()); | 302 GlobalHandles::AddToGroup(reinterpret_cast<void*>(1), g1s2.location()); |
| 303 GlobalHandles::AddToGroup(reinterpret_cast<void*>(2), g2s1.location()); | 303 GlobalHandles::AddToGroup(reinterpret_cast<void*>(2), g2s1.location()); |
| 304 GlobalHandles::AddToGroup(reinterpret_cast<void*>(2), g2s2.location()); | 304 GlobalHandles::AddToGroup(reinterpret_cast<void*>(2), g2s2.location()); |
| 305 | 305 |
| 306 CHECK(Heap::CollectGarbage(0, OLD_POINTER_SPACE)); | 306 CHECK(Heap::CollectGarbage(0, OLD_POINTER_SPACE)); |
| 307 | 307 |
| 308 // All objects should be gone. 5 global handles in total. | 308 // All objects should be gone. 5 global handles in total. |
| 309 CHECK_EQ(5, NumberOfWeakCalls); | 309 CHECK_EQ(5, NumberOfWeakCalls); |
| 310 } | 310 } |
| OLD | NEW |