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 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 | 186 |
187 // Start second old-space page so that values land on evacuation candidate. | 187 // Start second old-space page so that values land on evacuation candidate. |
188 Page* first_page = heap->old_space()->anchor()->next_page(); | 188 Page* first_page = heap->old_space()->anchor()->next_page(); |
189 SimulateFullSpace(heap->old_space()); | 189 SimulateFullSpace(heap->old_space()); |
190 | 190 |
191 // Fill up weak map with values on an evacuation candidate. | 191 // Fill up weak map with values on an evacuation candidate. |
192 { | 192 { |
193 HandleScope scope(isolate); | 193 HandleScope scope(isolate); |
194 for (int i = 0; i < 32; i++) { | 194 for (int i = 0; i < 32; i++) { |
195 Handle<JSObject> object = factory->NewJSObject(function, TENURED); | 195 Handle<JSObject> object = factory->NewJSObject(function, TENURED); |
196 CHECK(!heap->InNewSpace(object->address())); | 196 CHECK(!heap->InNewSpace(*object)); |
197 CHECK(!first_page->Contains(object->address())); | 197 CHECK(!first_page->Contains(object->address())); |
198 int32_t hash = Object::GetOrCreateHash(isolate, key)->value(); | 198 int32_t hash = Object::GetOrCreateHash(isolate, key)->value(); |
199 JSWeakCollection::Set(weakmap, key, object, hash); | 199 JSWeakCollection::Set(weakmap, key, object, hash); |
200 } | 200 } |
201 } | 201 } |
202 | 202 |
203 // Force compacting garbage collection. | 203 // Force compacting garbage collection. |
204 CHECK(FLAG_always_compact); | 204 CHECK(FLAG_always_compact); |
205 heap->CollectAllGarbage(); | 205 heap->CollectAllGarbage(); |
206 } | 206 } |
(...skipping 17 matching lines...) Expand all Loading... |
224 factory->function_string()); | 224 factory->function_string()); |
225 | 225 |
226 // Start second old-space page so that keys land on evacuation candidate. | 226 // Start second old-space page so that keys land on evacuation candidate. |
227 Page* first_page = heap->old_space()->anchor()->next_page(); | 227 Page* first_page = heap->old_space()->anchor()->next_page(); |
228 SimulateFullSpace(heap->old_space()); | 228 SimulateFullSpace(heap->old_space()); |
229 | 229 |
230 // Fill up weak map with keys on an evacuation candidate. | 230 // Fill up weak map with keys on an evacuation candidate. |
231 Handle<JSObject> keys[32]; | 231 Handle<JSObject> keys[32]; |
232 for (int i = 0; i < 32; i++) { | 232 for (int i = 0; i < 32; i++) { |
233 keys[i] = factory->NewJSObject(function, TENURED); | 233 keys[i] = factory->NewJSObject(function, TENURED); |
234 CHECK(!heap->InNewSpace(keys[i]->address())); | 234 CHECK(!heap->InNewSpace(*keys[i])); |
235 CHECK(!first_page->Contains(keys[i]->address())); | 235 CHECK(!first_page->Contains(keys[i]->address())); |
236 } | 236 } |
237 Handle<JSWeakMap> weakmap = AllocateJSWeakMap(isolate); | 237 Handle<JSWeakMap> weakmap = AllocateJSWeakMap(isolate); |
238 for (int i = 0; i < 32; i++) { | 238 for (int i = 0; i < 32; i++) { |
239 Handle<Smi> smi(Smi::FromInt(i), isolate); | 239 Handle<Smi> smi(Smi::FromInt(i), isolate); |
240 int32_t hash = Object::GetOrCreateHash(isolate, keys[i])->value(); | 240 int32_t hash = Object::GetOrCreateHash(isolate, keys[i])->value(); |
241 JSWeakCollection::Set(weakmap, keys[i], smi, hash); | 241 JSWeakCollection::Set(weakmap, keys[i], smi, hash); |
242 } | 242 } |
243 | 243 |
244 // Force compacting garbage collection. The subsequent collections are used | 244 // Force compacting garbage collection. The subsequent collections are used |
(...skipping 13 matching lines...) Expand all Loading... |
258 { | 258 { |
259 HandleScope scope(isolate); | 259 HandleScope scope(isolate); |
260 AllocateJSWeakMap(isolate); | 260 AllocateJSWeakMap(isolate); |
261 SimulateIncrementalMarking(heap); | 261 SimulateIncrementalMarking(heap); |
262 } | 262 } |
263 // The weak map is marked black here but leaving the handle scope will make | 263 // The weak map is marked black here but leaving the handle scope will make |
264 // the object unreachable. Aborting incremental marking will clear all the | 264 // the object unreachable. Aborting incremental marking will clear all the |
265 // marking bits which makes the weak map garbage. | 265 // marking bits which makes the weak map garbage. |
266 heap->CollectAllGarbage(); | 266 heap->CollectAllGarbage(); |
267 } | 267 } |
OLD | NEW |