Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(45)

Unified Diff: src/objects.cc

Issue 10447033: Revert r11665, r11666 and r11667 due to slowness. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/objects.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/objects.cc
diff --git a/src/objects.cc b/src/objects.cc
index 1eed39c65bc14971fcb4231bb764de57634d0b56..a8970584d8b3e206d6dc0abc89084d8046b5887e 100644
--- a/src/objects.cc
+++ b/src/objects.cc
@@ -5088,40 +5088,39 @@ class IntrusiveMapTransitionIterator {
void Start() {
ASSERT(!IsIterating());
- if (HasDescriptors()) *DescriptorArrayHeader() = Smi::FromInt(0);
+ if (HasContentArray()) *ContentHeader() = Smi::FromInt(0);
}
bool IsIterating() {
- return HasDescriptors() && (*DescriptorArrayHeader())->IsSmi();
+ return HasContentArray() && (*ContentHeader())->IsSmi();
}
Map* Next() {
ASSERT(IsIterating());
- // Attention, tricky index manipulation ahead: Two consecutive indices are
- // assigned to each descriptor. Most descriptors directly advance to the
- // next descriptor by adding 2 to the index. The exceptions are the
- // CALLBACKS entries: An even index means we look at its getter, and an odd
- // index means we look at its setter.
- int raw_index = Smi::cast(*DescriptorArrayHeader())->value();
- int index = raw_index / 2;
- while (index < descriptor_array_->number_of_descriptors()) {
- PropertyDetails details(RawGetDetails(index));
+ FixedArray* contents = ContentArray();
+ // Attention, tricky index manipulation ahead: Every entry in the contents
+ // array consists of a value/details pair, so the index is typically even.
+ // An exception is made for CALLBACKS entries: An even index means we look
+ // at its getter, and an odd index means we look at its setter.
+ int index = Smi::cast(*ContentHeader())->value();
+ while (index < contents->length()) {
+ PropertyDetails details(Smi::cast(contents->get(index | 1)));
switch (details.type()) {
case MAP_TRANSITION:
case CONSTANT_TRANSITION:
case ELEMENTS_TRANSITION:
// We definitely have a map transition.
- *DescriptorArrayHeader() = Smi::FromInt(raw_index + 2);
- return static_cast<Map*>(RawGetValue(index));
+ *ContentHeader() = Smi::FromInt(index + 2);
+ return static_cast<Map*>(contents->get(index));
case CALLBACKS: {
// We might have a map transition in a getter or in a setter.
AccessorPair* accessors =
- static_cast<AccessorPair*>(RawGetValue(index));
- Object* accessor = ((raw_index & 1) == 0)
- ? accessors->getter()
- : accessors->setter();
+ static_cast<AccessorPair*>(contents->get(index & ~1));
+ Object* accessor =
+ ((index & 1) == 0) ? accessors->getter() : accessors->setter();
+ index++;
if (accessor->IsMap()) {
- *DescriptorArrayHeader() = Smi::FromInt(raw_index + 1);
+ *ContentHeader() = Smi::FromInt(index);
return static_cast<Map*>(accessor);
}
break;
@@ -5133,42 +5132,28 @@ class IntrusiveMapTransitionIterator {
case INTERCEPTOR:
case NULL_DESCRIPTOR:
// We definitely have no map transition.
- raw_index += 2;
- ++index;
+ index += 2;
break;
}
}
- *DescriptorArrayHeader() = descriptor_array_->GetHeap()->fixed_array_map();
+ *ContentHeader() = descriptor_array_->GetHeap()->fixed_array_map();
return NULL;
}
private:
- bool HasDescriptors() {
- return descriptor_array_-> length() > DescriptorArray::kFirstIndex;
+ bool HasContentArray() {
+ return descriptor_array_-> length() > DescriptorArray::kContentArrayIndex;
}
- Object** DescriptorArrayHeader() {
- return HeapObject::RawField(descriptor_array_, DescriptorArray::kMapOffset);
+ FixedArray* ContentArray() {
+ Object* array = descriptor_array_->get(DescriptorArray::kContentArrayIndex);
+ return static_cast<FixedArray*>(array);
}
- FixedArray* RawGetContentArray() {
- Object* array =
- descriptor_array_->get(DescriptorArray::kContentArrayIndex);
- return static_cast<FixedArray*>(array);
+ Object** ContentHeader() {
+ return HeapObject::RawField(ContentArray(), DescriptorArray::kMapOffset);
}
- Object* RawGetValue(int descriptor_number) {
- return RawGetContentArray()->get(
- DescriptorArray::ToValueIndex(descriptor_number));
- }
-
- PropertyDetails RawGetDetails(int descriptor_number) {
- Object* details = RawGetContentArray()->get(
- DescriptorArray::ToDetailsIndex(descriptor_number));
- return PropertyDetails(Smi::cast(details));
- }
-
-
DescriptorArray* descriptor_array_;
};
@@ -5267,22 +5252,6 @@ class TraversableMap : public Map {
return old_parent;
}
- // Can either be Smi (no instance descriptors), or a descriptor array with the
- // header overwritten as a Smi (thus iterating).
- DescriptorArray* MutatedInstanceDescriptors() {
- Object* object =
- *HeapObject::RawField(this, kInstanceDescriptorsOrBitField3Offset);
- if (object->IsSmi()) {
- return GetHeap()->empty_descriptor_array();
- } else {
- DescriptorArray* descriptor_array =
- static_cast<DescriptorArray*>(object);
- ASSERT((*HeapObject::RawField(descriptor_array,
- DescriptorArray::kMapOffset))->IsSmi());
- return descriptor_array;
- }
- }
-
// Start iterating over this map's children, possibly destroying a FixedArray
// map (see explanation above).
void ChildIteratorStart() {
@@ -5294,18 +5263,17 @@ class TraversableMap : public Map {
// If we have an unvisited child map, return that one and advance. If we have
// none, return NULL and reset any destroyed FixedArray maps.
TraversableMap* ChildIteratorNext() {
+ IntrusiveMapTransitionIterator descriptor_iterator(instance_descriptors());
+ if (descriptor_iterator.IsIterating()) {
+ Map* next = descriptor_iterator.Next();
+ if (next != NULL) return static_cast<TraversableMap*>(next);
+ }
IntrusivePrototypeTransitionIterator
proto_iterator(unchecked_prototype_transitions());
if (proto_iterator.IsIterating()) {
Map* next = proto_iterator.Next();
if (next != NULL) return static_cast<TraversableMap*>(next);
}
- IntrusiveMapTransitionIterator
- descriptor_iterator(MutatedInstanceDescriptors());
- if (descriptor_iterator.IsIterating()) {
- Map* next = descriptor_iterator.Next();
- if (next != NULL) return static_cast<TraversableMap*>(next);
- }
return NULL;
}
};
« no previous file with comments | « src/objects.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698