Reviewers: Hannes Payer,
Description:
Merged r19440 into 3.23 branch.
Directly store the transition target on LookupResult in TransitionResult.
BUG=chromium:343964
LOG=N
[email protected]
Please review this at https://codereview.chromium.org/181223002/
SVN Base: https://v8.googlecode.com/svn/branches/3.23
Affected files (+39, -52 lines):
M src/hydrogen-instructions.cc
M src/hydrogen.cc
M src/ic.cc
M src/objects-inl.h
M src/objects.h
M src/property.h
M src/property.cc
M src/transitions-inl.h
M src/version.cc
Index: src/hydrogen-instructions.cc
diff --git a/src/hydrogen-instructions.cc b/src/hydrogen-instructions.cc
index
1323337b024b6718e574dd8a0eb14a010940bd39..d418954aad2a43f1e042bc543a5c8626ec9d0c81
100644
--- a/src/hydrogen-instructions.cc
+++ b/src/hydrogen-instructions.cc
@@ -4296,14 +4296,14 @@ HObjectAccess
HObjectAccess::ForBackingStoreOffset(int offset,
HObjectAccess HObjectAccess::ForField(Handle<Map> map,
LookupResult *lookup, Handle<String> name) {
- ASSERT(lookup->IsField() || lookup->IsTransitionToField(*map));
+ ASSERT(lookup->IsField() || lookup->IsTransitionToField());
int index;
Representation representation;
if (lookup->IsField()) {
index = lookup->GetLocalFieldIndexFromMap(*map);
representation = lookup->representation();
} else {
- Map* transition = lookup->GetTransitionMapFromMap(*map);
+ Map* transition = lookup->GetTransitionTarget();
int descriptor = transition->LastAdded();
index = transition->instance_descriptors()->GetFieldIndex(descriptor) -
map->inobject_properties();
Index: src/hydrogen.cc
diff --git a/src/hydrogen.cc b/src/hydrogen.cc
index
36387fd0af5a60cfa95f2728521b58e2d47c2667..a95f4a49633069888f862b237c145ebc0f91ea95
100644
--- a/src/hydrogen.cc
+++ b/src/hydrogen.cc
@@ -5230,7 +5230,7 @@ HInstruction*
HOptimizedGraphBuilder::BuildStoreNamedField(
}
HObjectAccess field_access = HObjectAccess::ForField(map, lookup, name);
- bool transition_to_field = lookup->IsTransitionToField(*map);
+ bool transition_to_field = lookup->IsTransitionToField();
HStoreNamedField *instr;
if (FLAG_track_double_fields &&
field_access.representation().IsDouble()) {
@@ -5266,7 +5266,7 @@ HInstruction*
HOptimizedGraphBuilder::BuildStoreNamedField(
}
if (transition_to_field) {
- Handle<Map> transition(lookup->GetTransitionMapFromMap(*map));
+ Handle<Map> transition(lookup->GetTransitionTarget());
HConstant* transition_constant = Add<HConstant>(transition);
instr->SetTransition(transition_constant, top_info());
// TODO(fschneider): Record the new map type of the object in the IR to
@@ -5306,7 +5306,7 @@ static bool ComputeStoreField(Handle<Map> type,
if (!lookup_transition) return false;
type->LookupTransition(NULL, *name, lookup);
- return lookup->IsTransitionToField(*type) &&
+ return lookup->IsTransitionToField() &&
(type->unused_property_fields() > 0);
}
Index: src/ic.cc
diff --git a/src/ic.cc b/src/ic.cc
index
08df2261fded944933ef595d3b325924cc1300ab..fc1ca53290e87b3d1028add40440a03e235a1d18
100644
--- a/src/ic.cc
+++ b/src/ic.cc
@@ -1470,8 +1470,7 @@ static bool LookupForWrite(Handle<JSObject> receiver,
// receiver when trying to fetch extra information from the transition.
receiver->map()->LookupTransition(*holder, *name, lookup);
if (!lookup->IsTransition()) return false;
- PropertyDetails target_details =
- lookup->GetTransitionDetails(receiver->map());
+ PropertyDetails target_details = lookup->GetTransitionDetails();
if (target_details.IsReadOnly()) return false;
// If the value that's being stored does not fit in the field that the
@@ -1482,7 +1481,7 @@ static bool LookupForWrite(Handle<JSObject> receiver,
// transition target.
ASSERT(!receiver->map()->is_deprecated());
if (!value->FitsRepresentation(target_details.representation())) {
- Handle<Map> target(lookup->GetTransitionMapFromMap(receiver->map()));
+ Handle<Map> target(lookup->GetTransitionTarget());
Map::GeneralizeRepresentation(
target, target->LastAdded(),
value->OptimalRepresentation(), FORCE_FIELD);
@@ -1629,12 +1628,8 @@ Handle<Code> StoreIC::CompileHandler(LookupResult*
lookup,
case TRANSITION: {
// Explicitly pass in the receiver map since LookupForWrite may have
// stored something else than the receiver in the holder.
- Handle<Map> transition(
- lookup->GetTransitionTarget(receiver->map()), isolate());
- int descriptor = transition->LastAdded();
-
- DescriptorArray* target_descriptors =
transition->instance_descriptors();
- PropertyDetails details = target_descriptors->GetDetails(descriptor);
+ Handle<Map> transition(lookup->GetTransitionTarget());
+ PropertyDetails details = transition->GetLastDescriptorDetails();
if (details.type() == CALLBACKS || details.attributes() != NONE)
break;
Index: src/objects-inl.h
diff --git a/src/objects-inl.h b/src/objects-inl.h
index
0e72ec1b004812e8dc4a822756c10394f4b50a09..2db3c04f1f292d55bfc7aa927830e6a93beb90e6
100644
--- a/src/objects-inl.h
+++ b/src/objects-inl.h
@@ -2345,6 +2345,11 @@ int DescriptorArray::SearchWithCache(Name* name,
Map* map) {
}
+PropertyDetails Map::GetLastDescriptorDetails() {
+ return instance_descriptors()->GetDetails(LastAdded());
+}
+
+
void Map::LookupDescriptor(JSObject* holder,
Name* name,
LookupResult* result) {
@@ -2362,7 +2367,8 @@ void Map::LookupTransition(JSObject* holder,
TransitionArray* transition_array = transitions();
int number = transition_array->Search(name);
if (number != TransitionArray::kNotFound) {
- return result->TransitionResult(holder, number);
+ return result->TransitionResult(
+ holder, transition_array->GetTarget(number));
}
}
result->NotFound();
Index: src/objects.h
diff --git a/src/objects.h b/src/objects.h
index
5216657347936a09038d2e6527fdcbdc3329d1fa..a7f01d1856992d5c8c7d02605fbc807cd0f27b79
100644
--- a/src/objects.h
+++ b/src/objects.h
@@ -5990,6 +5990,8 @@ class Map: public HeapObject {
Name* name,
LookupResult* result);
+ inline PropertyDetails GetLastDescriptorDetails();
+
// The size of transition arrays are limited so they do not end up in
large
// object space. Otherwise ClearNonLiveTransitions would leak memory
while
// applying in-place right trimming.
Index: src/property.cc
diff --git a/src/property.cc b/src/property.cc
index
83a6a365b874675df7e58213f6049a23e8aef9e5..2f72eec48ec6626dd06bde01efc7007920d92d9e
100644
--- a/src/property.cc
+++ b/src/property.cc
@@ -35,6 +35,7 @@ void LookupResult::Iterate(ObjectVisitor* visitor) {
LookupResult* current = this; // Could be NULL.
while (current != NULL) {
visitor->VisitPointer(BitCast<Object**>(¤t->holder_));
+ visitor->VisitPointer(BitCast<Object**>(¤t->transition_));
current = current->next_;
}
}
@@ -82,13 +83,13 @@ void LookupResult::Print(FILE* out) {
case FIELD:
PrintF(out, " -type = map transition\n");
PrintF(out, " -map:\n");
- GetTransitionMap()->Print(out);
+ GetTransitionTarget()->Print(out);
PrintF(out, "\n");
return;
case CONSTANT:
PrintF(out, " -type = constant property transition\n");
PrintF(out, " -map:\n");
- GetTransitionMap()->Print(out);
+ GetTransitionTarget()->Print(out);
PrintF(out, "\n");
return;
case CALLBACKS:
Index: src/property.h
diff --git a/src/property.h b/src/property.h
index
0f78ba478ec8512e8d94fd57a502a42a470c582a..da772dc86c3cca30c2bbf9355b95a059c55e33fd
100644
--- a/src/property.h
+++ b/src/property.h
@@ -184,6 +184,7 @@ class LookupResult BASE_EMBEDDED {
next_(isolate->top_lookup_result()),
lookup_type_(NOT_FOUND),
holder_(NULL),
+ transition_(NULL),
cacheable_(true),
details_(NONE, NONEXISTENT, Representation::None()) {
isolate->SetTopLookupResult(this);
@@ -201,6 +202,7 @@ class LookupResult BASE_EMBEDDED {
holder_ = holder;
details_ = details;
number_ = number;
+ transition_ = NULL;
}
bool CanHoldValue(Handle<Object> value) {
@@ -209,16 +211,18 @@ class LookupResult BASE_EMBEDDED {
return value->FitsRepresentation(details_.representation());
}
- void TransitionResult(JSObject* holder, int number) {
+ void TransitionResult(JSObject* holder, Map* target) {
lookup_type_ = TRANSITION_TYPE;
details_ = PropertyDetails(NONE, TRANSITION, Representation::None());
holder_ = holder;
- number_ = number;
+ transition_ = target;
+ number_ = 0xAAAA;
}
void DictionaryResult(JSObject* holder, int entry) {
lookup_type_ = DICTIONARY_TYPE;
holder_ = holder;
+ transition_ = NULL;
details_ = holder->property_dictionary()->DetailsAt(entry);
number_ = entry;
}
@@ -226,6 +230,7 @@ class LookupResult BASE_EMBEDDED {
void HandlerResult(JSProxy* proxy) {
lookup_type_ = HANDLER_TYPE;
holder_ = proxy;
+ transition_ = NULL;
details_ = PropertyDetails(NONE, HANDLER, Representation::Tagged());
cacheable_ = false;
}
@@ -233,6 +238,7 @@ class LookupResult BASE_EMBEDDED {
void InterceptorResult(JSObject* holder) {
lookup_type_ = INTERCEPTOR_TYPE;
holder_ = holder;
+ transition_ = NULL;
details_ = PropertyDetails(NONE, INTERCEPTOR,
Representation::Tagged());
}
@@ -248,7 +254,7 @@ class LookupResult BASE_EMBEDDED {
}
JSProxy* proxy() {
- ASSERT(IsFound());
+ ASSERT(IsHandler());
return JSProxy::cast(holder_);
}
@@ -373,42 +379,20 @@ class LookupResult BASE_EMBEDDED {
return NULL;
}
- Map* GetTransitionTarget(Map* map) {
- ASSERT(IsTransition());
- TransitionArray* transitions = map->transitions();
- return transitions->GetTarget(number_);
- }
-
Map* GetTransitionTarget() {
- return GetTransitionTarget(holder()->map());
- }
-
- PropertyDetails GetTransitionDetails(Map* map) {
- ASSERT(IsTransition());
- TransitionArray* transitions = map->transitions();
- return transitions->GetTargetDetails(number_);
+ return transition_;
}
PropertyDetails GetTransitionDetails() {
- return GetTransitionDetails(holder()->map());
- }
-
- bool IsTransitionToField(Map* map) {
- return IsTransition() && GetTransitionDetails(map).type() == FIELD;
+ return transition_->GetLastDescriptorDetails();
}
- bool IsTransitionToConstant(Map* map) {
- return IsTransition() && GetTransitionDetails(map).type() == CONSTANT;
+ bool IsTransitionToField() {
+ return IsTransition() && GetTransitionDetails().type() == FIELD;
}
- Map* GetTransitionMap() {
- ASSERT(IsTransition());
- return Map::cast(GetValue());
- }
-
- Map* GetTransitionMapFromMap(Map* map) {
- ASSERT(IsTransition());
- return map->transitions()->GetTarget(number_);
+ bool IsTransitionToConstant() {
+ return IsTransition() && GetTransitionDetails().type() == CONSTANT;
}
int GetTransitionIndex() {
@@ -501,6 +485,7 @@ class LookupResult BASE_EMBEDDED {
} lookup_type_;
JSReceiver* holder_;
+ Map* transition_;
int number_;
bool cacheable_;
PropertyDetails details_;
Index: src/transitions-inl.h
diff --git a/src/transitions-inl.h b/src/transitions-inl.h
index
c4825fcf734a590dc6dbe114355fa3fc08fede2a..5c7c28b6e5d2de4717b3bb3389b676d2c7369248
100644
--- a/src/transitions-inl.h
+++ b/src/transitions-inl.h
@@ -162,9 +162,7 @@ void TransitionArray::SetTarget(int transition_number,
Map* value) {
PropertyDetails TransitionArray::GetTargetDetails(int transition_number) {
Map* map = GetTarget(transition_number);
- DescriptorArray* descriptors = map->instance_descriptors();
- int descriptor = map->LastAdded();
- return descriptors->GetDetails(descriptor);
+ return map->GetLastDescriptorDetails();
}
Index: src/version.cc
diff --git a/src/version.cc b/src/version.cc
index
d0570ba75b7234914938b7b97f8f5776d7771e28..1d0337564023cbe2dd1163efb68cba23ab04c837
100644
--- a/src/version.cc
+++ b/src/version.cc
@@ -35,7 +35,7 @@
#define MAJOR_VERSION 3
#define MINOR_VERSION 23
#define BUILD_NUMBER 17
-#define PATCH_LEVEL 14
+#define PATCH_LEVEL 15
// Use 1 for candidates and 0 otherwise.
// (Boolean macro values are not supported by all preprocessors.)
#define IS_CANDIDATE_VERSION 0
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.