Commit 807ae243 authored by vegorov@chromium.org's avatar vegorov@chromium.org

Adjust assertions in UpdateSlot to match UpdatePointer in PointersUpdatingVisitor.

R=erik.corry@gmail.com
BUG=v8:1740

Review URL: http://codereview.chromium.org/8081001

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@9490 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent de7b222e
...@@ -2467,22 +2467,30 @@ class PointersUpdatingVisitor: public ObjectVisitor { ...@@ -2467,22 +2467,30 @@ class PointersUpdatingVisitor: public ObjectVisitor {
rinfo->set_call_address(Code::cast(target)->instruction_start()); rinfo->set_call_address(Code::cast(target)->instruction_start());
} }
private: static inline void UpdateSlot(Heap* heap, Object** slot) {
inline void UpdatePointer(Object** p) { Object* obj = *slot;
if (!(*p)->IsHeapObject()) return;
if (!obj->IsHeapObject()) return;
HeapObject* obj = HeapObject::cast(*p); HeapObject* heap_obj = HeapObject::cast(obj);
MapWord map_word = obj->map_word(); MapWord map_word = heap_obj->map_word();
if (map_word.IsForwardingAddress()) { if (map_word.IsForwardingAddress()) {
ASSERT(heap_->InFromSpace(obj) || ASSERT(heap->InFromSpace(heap_obj) ||
MarkCompactCollector::IsOnEvacuationCandidate(obj)); MarkCompactCollector::IsOnEvacuationCandidate(heap_obj));
*p = obj->map_word().ToForwardingAddress(); HeapObject* target = map_word.ToForwardingAddress();
ASSERT(!heap_->InFromSpace(*p) && *slot = target;
!MarkCompactCollector::IsOnEvacuationCandidate(*p)); ASSERT(!heap->InFromSpace(target) &&
!MarkCompactCollector::IsOnEvacuationCandidate(target));
} }
} }
private:
inline void UpdatePointer(Object** p) {
UpdateSlot(heap_, p);
}
Heap* heap_; Heap* heap_;
}; };
...@@ -2726,21 +2734,6 @@ class EvacuationWeakObjectRetainer : public WeakObjectRetainer { ...@@ -2726,21 +2734,6 @@ class EvacuationWeakObjectRetainer : public WeakObjectRetainer {
}; };
static inline void UpdateSlot(Object** slot) {
Object* obj = *slot;
if (!obj->IsHeapObject()) return;
HeapObject* heap_obj = HeapObject::cast(obj);
MapWord map_word = heap_obj->map_word();
if (map_word.IsForwardingAddress()) {
ASSERT(MarkCompactCollector::IsOnEvacuationCandidate(*slot));
*slot = map_word.ToForwardingAddress();
ASSERT(!MarkCompactCollector::IsOnEvacuationCandidate(*slot));
}
}
static inline void UpdateSlot(ObjectVisitor* v, static inline void UpdateSlot(ObjectVisitor* v,
SlotsBuffer::SlotType slot_type, SlotsBuffer::SlotType slot_type,
Address addr) { Address addr) {
...@@ -3757,7 +3750,7 @@ void SlotsBuffer::UpdateSlots(Heap* heap) { ...@@ -3757,7 +3750,7 @@ void SlotsBuffer::UpdateSlots(Heap* heap) {
for (int slot_idx = 0; slot_idx < idx_; ++slot_idx) { for (int slot_idx = 0; slot_idx < idx_; ++slot_idx) {
ObjectSlot slot = slots_[slot_idx]; ObjectSlot slot = slots_[slot_idx];
if (!IsTypedSlot(slot)) { if (!IsTypedSlot(slot)) {
UpdateSlot(slot); PointersUpdatingVisitor::UpdateSlot(heap, slot);
} else { } else {
++slot_idx; ++slot_idx;
ASSERT(slot_idx < idx_); ASSERT(slot_idx < idx_);
...@@ -3776,7 +3769,7 @@ void SlotsBuffer::UpdateSlotsWithFilter(Heap* heap) { ...@@ -3776,7 +3769,7 @@ void SlotsBuffer::UpdateSlotsWithFilter(Heap* heap) {
ObjectSlot slot = slots_[slot_idx]; ObjectSlot slot = slots_[slot_idx];
if (!IsTypedSlot(slot)) { if (!IsTypedSlot(slot)) {
if (!IsOnInvalidatedCodeObject(reinterpret_cast<Address>(slot))) { if (!IsOnInvalidatedCodeObject(reinterpret_cast<Address>(slot))) {
UpdateSlot(slot); PointersUpdatingVisitor::UpdateSlot(heap, slot);
} }
} else { } else {
++slot_idx; ++slot_idx;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment