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/ast/scopeinfo.h" | 9 #include "src/ast/scopeinfo.h" |
10 #include "src/base/bits.h" | 10 #include "src/base/bits.h" |
(...skipping 1563 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1574 Page* p = Page::FromAllocationTop(reinterpret_cast<Address>(rear_)); | 1574 Page* p = Page::FromAllocationTop(reinterpret_cast<Address>(rear_)); |
1575 intptr_t* head_start = rear_; | 1575 intptr_t* head_start = rear_; |
1576 intptr_t* head_end = Min(front_, reinterpret_cast<intptr_t*>(p->area_end())); | 1576 intptr_t* head_end = Min(front_, reinterpret_cast<intptr_t*>(p->area_end())); |
1577 | 1577 |
1578 int entries_count = | 1578 int entries_count = |
1579 static_cast<int>(head_end - head_start) / kEntrySizeInWords; | 1579 static_cast<int>(head_end - head_start) / kEntrySizeInWords; |
1580 | 1580 |
1581 emergency_stack_ = new List<Entry>(2 * entries_count); | 1581 emergency_stack_ = new List<Entry>(2 * entries_count); |
1582 | 1582 |
1583 while (head_start != head_end) { | 1583 while (head_start != head_end) { |
1584 int size = static_cast<int>(*(head_start++)); | 1584 struct Entry* entry = reinterpret_cast<struct Entry*>(head_start); |
ulan
2016/03/11 12:16:55
I think we need to increment head_start here.
Hannes Payer (out of office)
2016/03/11 12:23:19
Done.
| |
1585 HeapObject* obj = reinterpret_cast<HeapObject*>(*(head_start++)); | |
1586 // New space allocation in SemiSpaceCopyObject marked the region | 1585 // New space allocation in SemiSpaceCopyObject marked the region |
1587 // overlapping with promotion queue as uninitialized. | 1586 // overlapping with promotion queue as uninitialized. |
1588 MSAN_MEMORY_IS_INITIALIZED(&size, sizeof(size)); | 1587 MSAN_MEMORY_IS_INITIALIZED(&entry->size_, sizeof(size)); |
1589 MSAN_MEMORY_IS_INITIALIZED(&obj, sizeof(obj)); | 1588 MSAN_MEMORY_IS_INITIALIZED(&entry->obj_, sizeof(obj)); |
1590 emergency_stack_->Add(Entry(obj, size)); | 1589 emergency_stack_->Add(*entry); |
1591 } | 1590 } |
1592 rear_ = head_end; | 1591 rear_ = head_end; |
1593 } | 1592 } |
1594 | 1593 |
1595 | 1594 |
1596 class ScavengeWeakObjectRetainer : public WeakObjectRetainer { | 1595 class ScavengeWeakObjectRetainer : public WeakObjectRetainer { |
1597 public: | 1596 public: |
1598 explicit ScavengeWeakObjectRetainer(Heap* heap) : heap_(heap) {} | 1597 explicit ScavengeWeakObjectRetainer(Heap* heap) : heap_(heap) {} |
1599 | 1598 |
1600 virtual Object* RetainAs(Object* object) { | 1599 virtual Object* RetainAs(Object* object) { |
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1938 } else { | 1937 } else { |
1939 new_space_front = | 1938 new_space_front = |
1940 NewSpacePage::FromLimit(new_space_front)->next_page()->area_start(); | 1939 NewSpacePage::FromLimit(new_space_front)->next_page()->area_start(); |
1941 } | 1940 } |
1942 } | 1941 } |
1943 | 1942 |
1944 // Promote and process all the to-be-promoted objects. | 1943 // Promote and process all the to-be-promoted objects. |
1945 { | 1944 { |
1946 while (!promotion_queue()->is_empty()) { | 1945 while (!promotion_queue()->is_empty()) { |
1947 HeapObject* target; | 1946 HeapObject* target; |
1948 int size; | 1947 intptr_t size; |
1949 promotion_queue()->remove(&target, &size); | 1948 promotion_queue()->remove(&target, &size); |
1950 | 1949 |
1951 // Promoted object might be already partially visited | 1950 // Promoted object might be already partially visited |
1952 // during old space pointer iteration. Thus we search specifically | 1951 // during old space pointer iteration. Thus we search specifically |
1953 // for pointers to from semispace instead of looking for pointers | 1952 // for pointers to from semispace instead of looking for pointers |
1954 // to new space. | 1953 // to new space. |
1955 DCHECK(!target->IsMap()); | 1954 DCHECK(!target->IsMap()); |
1956 | 1955 |
1957 IteratePointersToFromSpace(target, size, &Scavenger::ScavengeObject); | 1956 IteratePointersToFromSpace(target, static_cast<int>(size), |
1957 &Scavenger::ScavengeObject); | |
1958 } | 1958 } |
1959 } | 1959 } |
1960 | 1960 |
1961 // Take another spin if there are now unswept objects in new space | 1961 // Take another spin if there are now unswept objects in new space |
1962 // (there are currently no more unswept promoted objects). | 1962 // (there are currently no more unswept promoted objects). |
1963 } while (new_space_front != new_space_.top()); | 1963 } while (new_space_front != new_space_.top()); |
1964 | 1964 |
1965 return new_space_front; | 1965 return new_space_front; |
1966 } | 1966 } |
1967 | 1967 |
(...skipping 4381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6349 } | 6349 } |
6350 | 6350 |
6351 | 6351 |
6352 // static | 6352 // static |
6353 int Heap::GetStaticVisitorIdForMap(Map* map) { | 6353 int Heap::GetStaticVisitorIdForMap(Map* map) { |
6354 return StaticVisitorBase::GetVisitorId(map); | 6354 return StaticVisitorBase::GetVisitorId(map); |
6355 } | 6355 } |
6356 | 6356 |
6357 } // namespace internal | 6357 } // namespace internal |
6358 } // namespace v8 | 6358 } // namespace v8 |
OLD | NEW |