Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 "src/heap/heap.h" | 5 #include "src/heap/heap.h" |
| 6 | 6 |
| 7 #include "src/accessors.h" | 7 #include "src/accessors.h" |
| 8 #include "src/api.h" | 8 #include "src/api.h" |
| 9 #include "src/base/bits.h" | 9 #include "src/base/bits.h" |
| 10 #include "src/base/once.h" | 10 #include "src/base/once.h" |
| (...skipping 1433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1444 } | 1444 } |
| 1445 } | 1445 } |
| 1446 | 1446 |
| 1447 | 1447 |
| 1448 static bool IsUnscavengedHeapObject(Heap* heap, Object** p) { | 1448 static bool IsUnscavengedHeapObject(Heap* heap, Object** p) { |
| 1449 return heap->InNewSpace(*p) && | 1449 return heap->InNewSpace(*p) && |
| 1450 !HeapObject::cast(*p)->map_word().IsForwardingAddress(); | 1450 !HeapObject::cast(*p)->map_word().IsForwardingAddress(); |
| 1451 } | 1451 } |
| 1452 | 1452 |
| 1453 | 1453 |
| 1454 static bool IsUnModifiedNewSpaceObject(Object** p) { | |
| 1455 Object* object = *p; | |
| 1456 DCHECK(object->IsHeapObject()); | |
| 1457 HeapObject* heap_object = HeapObject::cast(object); | |
| 1458 if (!heap_object->GetIsolate()->heap()->InFromSpace(heap_object)) return true; | |
| 1459 if (heap_object->map_word().IsForwardingAddress()) return true; | |
| 1460 if (!object->IsJSObject()) { | |
| 1461 DCHECK(object->IsName()); | |
| 1462 return false; | |
| 1463 } | |
| 1464 // if (heap_object->map()->GetBackPointer()->IsUndefined()) return true; | |
| 1465 JSFunction* constructor = | |
| 1466 JSFunction::cast((JSObject::cast(object))->map()->GetConstructor()); | |
| 1467 if (constructor->initial_map() == heap_object->map()) return true; | |
|
mythria
2015/09/22 10:45:07
I modified the check and I still have the same pro
| |
| 1468 return false; | |
| 1469 } | |
| 1470 | |
| 1471 | |
| 1454 void Heap::ScavengeStoreBufferCallback(Heap* heap, MemoryChunk* page, | 1472 void Heap::ScavengeStoreBufferCallback(Heap* heap, MemoryChunk* page, |
| 1455 StoreBufferEvent event) { | 1473 StoreBufferEvent event) { |
| 1456 heap->store_buffer_rebuilder_.Callback(page, event); | 1474 heap->store_buffer_rebuilder_.Callback(page, event); |
| 1457 } | 1475 } |
| 1458 | 1476 |
| 1459 | 1477 |
| 1460 void PromotionQueue::Initialize() { | 1478 void PromotionQueue::Initialize() { |
| 1461 // The last to-space page may be used for promotion queue. On promotion | 1479 // The last to-space page may be used for promotion queue. On promotion |
| 1462 // conflict, we use the emergency stack. | 1480 // conflict, we use the emergency stack. |
| 1463 DCHECK((Page::kPageSize - MemoryChunk::kBodyOffset) % (2 * kPointerSize) == | 1481 DCHECK((Page::kPageSize - MemoryChunk::kBodyOffset) % (2 * kPointerSize) == |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1600 if (collector->is_code_flushing_enabled()) { | 1618 if (collector->is_code_flushing_enabled()) { |
| 1601 collector->code_flusher()->IteratePointersToFromSpace(&scavenge_visitor); | 1619 collector->code_flusher()->IteratePointersToFromSpace(&scavenge_visitor); |
| 1602 } | 1620 } |
| 1603 } | 1621 } |
| 1604 | 1622 |
| 1605 { | 1623 { |
| 1606 GCTracer::Scope gc_scope(tracer(), GCTracer::Scope::SCAVENGER_SEMISPACE); | 1624 GCTracer::Scope gc_scope(tracer(), GCTracer::Scope::SCAVENGER_SEMISPACE); |
| 1607 new_space_front = DoScavenge(&scavenge_visitor, new_space_front); | 1625 new_space_front = DoScavenge(&scavenge_visitor, new_space_front); |
| 1608 } | 1626 } |
| 1609 | 1627 |
| 1610 { | 1628 if (FLAG_scavenge_remove_unmodified_objects) { |
| 1629 isolate()->global_handles()->IterateNewSpaceWeakRoots( | |
| 1630 &scavenge_visitor, &IsUnModifiedNewSpaceObject); | |
| 1631 new_space_front = DoScavenge(&scavenge_visitor, new_space_front); | |
| 1632 } else { | |
| 1611 GCTracer::Scope gc_scope(tracer(), | 1633 GCTracer::Scope gc_scope(tracer(), |
| 1612 GCTracer::Scope::SCAVENGER_OBJECT_GROUPS); | 1634 GCTracer::Scope::SCAVENGER_OBJECT_GROUPS); |
| 1613 while (isolate()->global_handles()->IterateObjectGroups( | 1635 while (isolate()->global_handles()->IterateObjectGroups( |
| 1614 &scavenge_visitor, &IsUnscavengedHeapObject)) { | 1636 &scavenge_visitor, &IsUnscavengedHeapObject)) { |
| 1615 new_space_front = DoScavenge(&scavenge_visitor, new_space_front); | 1637 new_space_front = DoScavenge(&scavenge_visitor, new_space_front); |
| 1616 } | 1638 } |
| 1617 isolate()->global_handles()->RemoveObjectGroups(); | 1639 isolate()->global_handles()->RemoveObjectGroups(); |
| 1618 isolate()->global_handles()->RemoveImplicitRefGroups(); | 1640 isolate()->global_handles()->RemoveImplicitRefGroups(); |
| 1619 } | 1641 } |
| 1620 | 1642 |
| (...skipping 4484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6105 } | 6127 } |
| 6106 | 6128 |
| 6107 | 6129 |
| 6108 // static | 6130 // static |
| 6109 int Heap::GetStaticVisitorIdForMap(Map* map) { | 6131 int Heap::GetStaticVisitorIdForMap(Map* map) { |
| 6110 return StaticVisitorBase::GetVisitorId(map); | 6132 return StaticVisitorBase::GetVisitorId(map); |
| 6111 } | 6133 } |
| 6112 | 6134 |
| 6113 } // namespace internal | 6135 } // namespace internal |
| 6114 } // namespace v8 | 6136 } // namespace v8 |
| OLD | NEW |