Commit dd54b0ac authored by verwaest@chromium.org's avatar verwaest@chromium.org

ClearNonLiveTransitions indepedent of ContentArray

Review URL: https://chromiumcodereview.appspot.com/10387231

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@11693 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent c8a99c22
......@@ -1943,6 +1943,12 @@ Object* DescriptorArray::GetValue(int descriptor_number) {
}
void DescriptorArray::SetNullValueUnchecked(int descriptor_number, Heap* heap) {
ASSERT(descriptor_number < number_of_descriptors());
GetContentArray()->set_null_unchecked(heap, ToValueIndex(descriptor_number));
}
PropertyDetails DescriptorArray::GetDetails(int descriptor_number) {
ASSERT(descriptor_number < number_of_descriptors());
Object* details = GetContentArray()->get(ToDetailsIndex(descriptor_number));
......@@ -1950,6 +1956,12 @@ PropertyDetails DescriptorArray::GetDetails(int descriptor_number) {
}
void DescriptorArray::SetDetailsUnchecked(int descriptor_number, Smi* value) {
ASSERT(descriptor_number < number_of_descriptors());
GetContentArray()->set_unchecked(ToDetailsIndex(descriptor_number), value);
}
PropertyType DescriptorArray::GetType(int descriptor_number) {
return GetDetails(descriptor_number).type();
}
......
......@@ -7440,23 +7440,20 @@ void Map::ClearNonLiveTransitions(Heap* heap) {
if (d->IsEmpty()) return;
Smi* NullDescriptorDetails =
PropertyDetails(NONE, NULL_DESCRIPTOR).AsSmi();
FixedArray* contents = FixedArray::cast(
d->get(DescriptorArray::kContentArrayIndex));
ASSERT(contents->length() >= 2);
for (int i = 0; i < contents->length(); i += 2) {
for (int i = 0; i < d->number_of_descriptors(); ++i) {
// If the pair (value, details) is a map transition, check if the target is
// live. If not, null the descriptor. Also drop the back pointer for that
// map transition, so that this map is not reached again by following a back
// pointer from that non-live map.
bool keep_entry = false;
PropertyDetails details(Smi::cast(contents->get(i + 1)));
PropertyDetails details(d->GetDetails(i));
switch (details.type()) {
case MAP_TRANSITION:
case CONSTANT_TRANSITION:
ClearBackPointer(heap, contents->get(i), &keep_entry);
ClearBackPointer(heap, d->GetValue(i), &keep_entry);
break;
case ELEMENTS_TRANSITION: {
Object* object = contents->get(i);
Object* object = d->GetValue(i);
if (object->IsMap()) {
ClearBackPointer(heap, object, &keep_entry);
} else {
......@@ -7470,7 +7467,7 @@ void Map::ClearNonLiveTransitions(Heap* heap) {
break;
}
case CALLBACKS: {
Object* object = contents->get(i);
Object* object = d->GetValue(i);
if (object->IsAccessorPair()) {
AccessorPair* accessors = AccessorPair::cast(object);
if (ClearBackPointer(heap, accessors->getter(), &keep_entry)) {
......@@ -7497,8 +7494,8 @@ void Map::ClearNonLiveTransitions(Heap* heap) {
// What we *really* want to do here is removing this entry completely, but
// for technical reasons we can't do this, so we zero it out instead.
if (!keep_entry) {
contents->set_unchecked(i + 1, NullDescriptorDetails);
contents->set_null_unchecked(heap, i);
d->SetDetailsUnchecked(i, NullDescriptorDetails);
d->SetNullValueUnchecked(i, heap);
}
}
}
......
......@@ -2451,7 +2451,9 @@ class DescriptorArray: public FixedArray {
inline String* GetKey(int descriptor_number);
inline Object* GetValue(int descriptor_number);
inline Object** GetValueSlot(int descriptor_number);
inline void SetNullValueUnchecked(int descriptor_number, Heap* heap);
inline PropertyDetails GetDetails(int descriptor_number);
inline void SetDetailsUnchecked(int descriptor_number, Smi* value);
inline PropertyType GetType(int descriptor_number);
inline int GetFieldIndex(int descriptor_number);
inline JSFunction* GetConstantFunction(int descriptor_number);
......
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