OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include <algorithm> | 5 #include <algorithm> |
6 | 6 |
7 #include "src/v8.h" | 7 #include "src/v8.h" |
8 | 8 |
9 #include "src/base/atomicops.h" | 9 #include "src/base/atomicops.h" |
10 #include "src/counters.h" | 10 #include "src/counters.h" |
(...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
374 if (FLAG_verify_heap) { | 374 if (FLAG_verify_heap) { |
375 Verify(); | 375 Verify(); |
376 } | 376 } |
377 #endif | 377 #endif |
378 } | 378 } |
379 | 379 |
380 | 380 |
381 void StoreBuffer::ProcessOldToNewSlot(Address slot_address, | 381 void StoreBuffer::ProcessOldToNewSlot(Address slot_address, |
382 ObjectSlotCallback slot_callback, | 382 ObjectSlotCallback slot_callback, |
383 bool clear_maps) { | 383 bool clear_maps) { |
| 384 printf("process %p\n", slot_address); |
384 Object** slot = reinterpret_cast<Object**>(slot_address); | 385 Object** slot = reinterpret_cast<Object**>(slot_address); |
385 Object* object = reinterpret_cast<Object*>( | 386 Object* object = reinterpret_cast<Object*>( |
386 base::NoBarrier_Load(reinterpret_cast<base::AtomicWord*>(slot))); | 387 base::NoBarrier_Load(reinterpret_cast<base::AtomicWord*>(slot))); |
387 | 388 |
388 // If the object is not in from space, it must be a duplicate store buffer | 389 // If the object is not in from space, it must be a duplicate store buffer |
389 // entry and the slot was already updated. | 390 // entry and the slot was already updated. |
390 if (heap_->InFromSpace(object)) { | 391 if (heap_->InFromSpace(object)) { |
391 HeapObject* heap_object = reinterpret_cast<HeapObject*>(object); | 392 HeapObject* heap_object = reinterpret_cast<HeapObject*>(object); |
392 DCHECK(heap_object->IsHeapObject()); | 393 DCHECK(heap_object->IsHeapObject()); |
393 // The new space object was not promoted if it still contains a map | 394 // The new space object was not promoted if it still contains a map |
394 // pointer. Clear the map field now lazily (during full GC). | 395 // pointer. Clear the map field now lazily (during full GC). |
395 if (clear_maps) ClearDeadObject(heap_object); | 396 if (clear_maps) ClearDeadObject(heap_object); |
396 slot_callback(reinterpret_cast<HeapObject**>(slot), heap_object); | 397 slot_callback(reinterpret_cast<HeapObject**>(slot), heap_object); |
397 object = reinterpret_cast<Object*>( | 398 object = reinterpret_cast<Object*>( |
398 base::NoBarrier_Load(reinterpret_cast<base::AtomicWord*>(slot))); | 399 base::NoBarrier_Load(reinterpret_cast<base::AtomicWord*>(slot))); |
399 // If the object was in from space before and is after executing the | 400 // If the object was in from space before and is after executing the |
400 // callback in to space, the object is still live. | 401 // callback in to space, the object is still live. |
401 // Unfortunately, we do not know about the slot. It could be in a | 402 // Unfortunately, we do not know about the slot. It could be in a |
402 // just freed free space object. | 403 // just freed free space object. |
403 if (heap_->InToSpace(object)) { | 404 if (heap_->InToSpace(object)) { |
| 405 printf("enter directly %p\n", slot); |
404 EnterDirectlyIntoStoreBuffer(reinterpret_cast<Address>(slot)); | 406 EnterDirectlyIntoStoreBuffer(reinterpret_cast<Address>(slot)); |
405 } | 407 } |
406 } | 408 } |
407 } | 409 } |
408 | 410 |
409 | 411 |
410 void StoreBuffer::FindPointersToNewSpaceInRegion( | 412 void StoreBuffer::FindPointersToNewSpaceInRegion( |
411 Address start, Address end, ObjectSlotCallback slot_callback, | 413 Address start, Address end, ObjectSlotCallback slot_callback, |
412 bool clear_maps) { | 414 bool clear_maps) { |
413 for (Address slot_address = start; slot_address < end; | 415 for (Address slot_address = start; slot_address < end; |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
612 } | 614 } |
613 old_buffer_is_sorted_ = false; | 615 old_buffer_is_sorted_ = false; |
614 old_buffer_is_filtered_ = false; | 616 old_buffer_is_filtered_ = false; |
615 *old_top_++ = reinterpret_cast<Address>(int_addr << kPointerSizeLog2); | 617 *old_top_++ = reinterpret_cast<Address>(int_addr << kPointerSizeLog2); |
616 DCHECK(old_top_ <= old_limit_); | 618 DCHECK(old_top_ <= old_limit_); |
617 } | 619 } |
618 heap_->isolate()->counters()->store_buffer_compactions()->Increment(); | 620 heap_->isolate()->counters()->store_buffer_compactions()->Increment(); |
619 } | 621 } |
620 } | 622 } |
621 } // namespace v8::internal | 623 } // namespace v8::internal |
OLD | NEW |