Chromium Code Reviews| 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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 58 | 58 |
| 59 static int NumberOfWeakCalls = 0; | 59 static int NumberOfWeakCalls = 0; |
| 60 static void WeakPointerCallback(v8::Persistent<v8::Value> handle, void* id) { | 60 static void WeakPointerCallback(v8::Persistent<v8::Value> handle, void* id) { |
| 61 ASSERT(id == reinterpret_cast<void*>(1234)); | 61 ASSERT(id == reinterpret_cast<void*>(1234)); |
| 62 NumberOfWeakCalls++; | 62 NumberOfWeakCalls++; |
| 63 handle.Dispose(); | 63 handle.Dispose(); |
| 64 } | 64 } |
| 65 | 65 |
| 66 | 66 |
| 67 TEST(Weakness) { | 67 TEST(Weakness) { |
| 68 FLAG_incremental_marking = false; | |
|
Vyacheslav Egorov (Chromium)
2012/04/19 10:25:43
do we want some sort of todo referencing an issue
| |
| 68 LocalContext context; | 69 LocalContext context; |
| 69 v8::HandleScope scope; | 70 v8::HandleScope scope; |
| 70 Handle<JSWeakMap> weakmap = AllocateJSWeakMap(); | 71 Handle<JSWeakMap> weakmap = AllocateJSWeakMap(); |
| 71 GlobalHandles* global_handles = Isolate::Current()->global_handles(); | 72 GlobalHandles* global_handles = Isolate::Current()->global_handles(); |
| 72 | 73 |
| 73 // Keep global reference to the key. | 74 // Keep global reference to the key. |
| 74 Handle<Object> key; | 75 Handle<Object> key; |
| 75 { | 76 { |
| 76 v8::HandleScope scope; | 77 v8::HandleScope scope; |
| 77 Handle<Map> map = FACTORY->NewMap(JS_OBJECT_TYPE, JSObject::kHeaderSize); | 78 Handle<Map> map = FACTORY->NewMap(JS_OBJECT_TYPE, JSObject::kHeaderSize); |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 216 PutIntoWeakMap(weakmap, keys[i], Handle<Smi>(Smi::FromInt(i))); | 217 PutIntoWeakMap(weakmap, keys[i], Handle<Smi>(Smi::FromInt(i))); |
| 217 } | 218 } |
| 218 | 219 |
| 219 // Force compacting garbage collection. The subsequent collections are used | 220 // Force compacting garbage collection. The subsequent collections are used |
| 220 // to verify that key references were actually updated. | 221 // to verify that key references were actually updated. |
| 221 CHECK(FLAG_always_compact); | 222 CHECK(FLAG_always_compact); |
| 222 HEAP->CollectAllGarbage(Heap::kNoGCFlags); | 223 HEAP->CollectAllGarbage(Heap::kNoGCFlags); |
| 223 HEAP->CollectAllGarbage(Heap::kNoGCFlags); | 224 HEAP->CollectAllGarbage(Heap::kNoGCFlags); |
| 224 HEAP->CollectAllGarbage(Heap::kNoGCFlags); | 225 HEAP->CollectAllGarbage(Heap::kNoGCFlags); |
| 225 } | 226 } |
| OLD | NEW |