Use FixedTypedArrayBase's body descriptor for static visiting

BUG=none
R=ishell@chromium.org,hpayer@chromium.org
LOG=n

Review URL: https://codereview.chromium.org/1488053002

Cr-Commit-Position: refs/heads/master@{#32618}
This commit is contained in:
jochen 2015-12-04 06:42:21 -08:00 committed by Commit bot
parent f0f707d832
commit 2ce0e87fb2
5 changed files with 27 additions and 27 deletions

View File

@ -44,8 +44,15 @@ void StaticNewSpaceVisitor<StaticVisitor>::Initialize() {
FixedArray::BodyDescriptor, int>::Visit);
table_.Register(kVisitFixedDoubleArray, &VisitFixedDoubleArray);
table_.Register(kVisitFixedTypedArray, &VisitFixedTypedArray);
table_.Register(kVisitFixedFloat64Array, &VisitFixedTypedArray);
table_.Register(
kVisitFixedTypedArray,
&FlexibleBodyVisitor<StaticVisitor, FixedTypedArrayBase::BodyDescriptor,
int>::Visit);
table_.Register(
kVisitFixedFloat64Array,
&FlexibleBodyVisitor<StaticVisitor, FixedTypedArrayBase::BodyDescriptor,
int>::Visit);
table_.Register(
kVisitNativeContext,
@ -135,9 +142,15 @@ void StaticMarkingVisitor<StaticVisitor>::Initialize() {
table_.Register(kVisitFixedDoubleArray, &DataObjectVisitor::Visit);
table_.Register(kVisitFixedTypedArray, &DataObjectVisitor::Visit);
table_.Register(
kVisitFixedTypedArray,
&FlexibleBodyVisitor<StaticVisitor, FixedTypedArrayBase::BodyDescriptor,
void>::Visit);
table_.Register(kVisitFixedFloat64Array, &DataObjectVisitor::Visit);
table_.Register(
kVisitFixedFloat64Array,
&FlexibleBodyVisitor<StaticVisitor, FixedTypedArrayBase::BodyDescriptor,
void>::Visit);
table_.Register(kVisitNativeContext, &VisitNativeContext);

View File

@ -248,7 +248,9 @@ class StaticNewSpaceVisitor : public StaticVisitorBase {
INLINE(static void VisitPointers(Heap* heap, HeapObject* object,
Object** start, Object** end)) {
for (Object** p = start; p < end; p++) StaticVisitor::VisitPointer(heap, p);
for (Object** p = start; p < end; p++) {
StaticVisitor::VisitPointer(heap, object, p);
}
}
// Although we are using the JSFunction body descriptor which does not
@ -269,10 +271,6 @@ class StaticNewSpaceVisitor : public StaticVisitorBase {
return FixedDoubleArray::SizeFor(length);
}
INLINE(static int VisitFixedTypedArray(Map* map, HeapObject* object)) {
return reinterpret_cast<FixedTypedArrayBase*>(object)->size();
}
INLINE(static int VisitJSObject(Map* map, HeapObject* object)) {
return JSObjectVisitor::Visit(map, object);
}

View File

@ -38,7 +38,8 @@ void Scavenger::ScavengeObject(HeapObject** p, HeapObject* object) {
// static
void StaticScavengeVisitor::VisitPointer(Heap* heap, Object** p) {
void StaticScavengeVisitor::VisitPointer(Heap* heap, HeapObject* obj,
Object** p) {
Object* object = *p;
if (!heap->InNewSpace(object)) return;
Scavenger::ScavengeObject(reinterpret_cast<HeapObject**>(p),

View File

@ -267,28 +267,16 @@ class ScavengingVisitor : public StaticVisitorBase {
static inline void EvacuateFixedTypedArray(Map* map, HeapObject** slot,
HeapObject* object) {
int object_size = reinterpret_cast<FixedTypedArrayBase*>(object)->size();
EvacuateObject<DATA_OBJECT, kWordAligned>(map, slot, object, object_size);
MapWord map_word = object->map_word();
DCHECK(map_word.IsForwardingAddress());
FixedTypedArrayBase* target =
reinterpret_cast<FixedTypedArrayBase*>(map_word.ToForwardingAddress());
if (target->base_pointer() != Smi::FromInt(0))
target->set_base_pointer(target, SKIP_WRITE_BARRIER);
EvacuateObject<POINTER_OBJECT, kWordAligned>(map, slot, object,
object_size);
}
static inline void EvacuateFixedFloat64Array(Map* map, HeapObject** slot,
HeapObject* object) {
int object_size = reinterpret_cast<FixedFloat64Array*>(object)->size();
EvacuateObject<DATA_OBJECT, kDoubleAligned>(map, slot, object, object_size);
MapWord map_word = object->map_word();
DCHECK(map_word.IsForwardingAddress());
FixedTypedArrayBase* target =
reinterpret_cast<FixedTypedArrayBase*>(map_word.ToForwardingAddress());
if (target->base_pointer() != Smi::FromInt(0))
target->set_base_pointer(target, SKIP_WRITE_BARRIER);
EvacuateObject<POINTER_OBJECT, kDoubleAligned>(map, slot, object,
object_size);
}

View File

@ -63,7 +63,7 @@ class ScavengeVisitor : public ObjectVisitor {
class StaticScavengeVisitor
: public StaticNewSpaceVisitor<StaticScavengeVisitor> {
public:
static inline void VisitPointer(Heap* heap, Object** p);
static inline void VisitPointer(Heap* heap, HeapObject* object, Object** p);
};
} // namespace internal