Reviewers: Jakob,
Message:
PTAL.
Description:
Remove LookupTransitionOrDescriptor altogether.
Please review this at https://chromiumcodereview.appspot.com/10778011/
SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge
Affected files:
M src/arm/lithium-codegen-arm.cc
M src/hydrogen-instructions.cc
M src/ia32/lithium-codegen-ia32.cc
M src/objects.h
M src/objects.cc
Index: src/arm/lithium-codegen-arm.cc
diff --git a/src/arm/lithium-codegen-arm.cc b/src/arm/lithium-codegen-arm.cc
index
fb687f7941404729c148968398f7f4a2d4852b7f..3b83d90486c650074da5b0d1591c63ede71738e6
100644
--- a/src/arm/lithium-codegen-arm.cc
+++ b/src/arm/lithium-codegen-arm.cc
@@ -2579,7 +2579,7 @@ void
LCodeGen::EmitLoadFieldOrConstantFunction(Register result,
Handle<String> name,
LEnvironment* env) {
LookupResult lookup(isolate());
- type->LookupTransitionOrDescriptor(NULL, *name, &lookup);
+ type->LookupDescriptor(NULL, *name, &lookup);
ASSERT(lookup.IsFound() || lookup.IsCacheable());
if (lookup.IsField()) {
int index = lookup.GetLocalFieldIndexFromMap(*type);
Index: src/hydrogen-instructions.cc
diff --git a/src/hydrogen-instructions.cc b/src/hydrogen-instructions.cc
index
d76c1d7c130db1cef50791602def1fac02431b1e..50a5335a0ffa9ce5edaea9f4b8cf289bd5d8a689
100644
--- a/src/hydrogen-instructions.cc
+++ b/src/hydrogen-instructions.cc
@@ -1670,8 +1670,8 @@ void HLoadNamedField::PrintDataTo(StringStream*
stream) {
// Returns true if an instance of this map can never find a property with
this
-// name in its prototype chain. This means all prototypes up to the top
are
-// fast and don't have the name in them. It would be good if we could
optimize
+// name in its prototype chain. This means all prototypes up to the top
are fast
+// and don't have the name in them. It would be good if we could optimize
// polymorphic loads where the property is sometimes found in the prototype
// chain.
static bool PrototypeChainCanNeverResolve(
@@ -1689,13 +1689,9 @@ static bool PrototypeChainCanNeverResolve(
LookupResult lookup(isolate);
Map* map = JSObject::cast(current)->map();
- map->LookupTransitionOrDescriptor(NULL, *name, &lookup);
- if (lookup.IsFound()) {
- if (!lookup.IsTransition()) return false;
- } else if (!lookup.IsCacheable()) {
- return false;
- }
-
+ map->LookupDescriptor(NULL, *name, &lookup);
+ if (lookup.IsFound()) return false;
+ if (!lookup.IsCacheable()) return false;
current = JSObject::cast(current)->GetPrototype();
}
return true;
@@ -1720,7 +1716,7 @@
HLoadNamedFieldPolymorphic::HLoadNamedFieldPolymorphic(HValue* context,
++i) {
Handle<Map> map = types->at(i);
LookupResult lookup(map->GetIsolate());
- map->LookupTransitionOrDescriptor(NULL, *name, &lookup);
+ map->LookupDescriptor(NULL, *name, &lookup);
if (lookup.IsFound()) {
switch (lookup.type()) {
case FIELD: {
@@ -1739,10 +1735,6 @@
HLoadNamedFieldPolymorphic::HLoadNamedFieldPolymorphic(HValue* context,
case CALLBACKS:
break;
case TRANSITION:
- if (PrototypeChainCanNeverResolve(map, name)) {
- negative_lookups.Add(types->at(i), zone);
- }
- break;
case INTERCEPTOR:
case NONEXISTENT:
case NORMAL:
@@ -1750,10 +1742,9 @@
HLoadNamedFieldPolymorphic::HLoadNamedFieldPolymorphic(HValue* context,
UNREACHABLE();
break;
}
- } else if (lookup.IsCacheable()) {
- if (PrototypeChainCanNeverResolve(map, name)) {
- negative_lookups.Add(types->at(i), zone);
- }
+ } else if (lookup.IsCacheable() &&
+ PrototypeChainCanNeverResolve(map, name)) {
+ negative_lookups.Add(types->at(i), zone);
}
}
Index: src/ia32/lithium-codegen-ia32.cc
diff --git a/src/ia32/lithium-codegen-ia32.cc
b/src/ia32/lithium-codegen-ia32.cc
index
6317a54a2b400385c2c75ff3c59b6fac8ca36deb..5ec2bfa5da0eb925316b12ea52de47865165e4ba
100644
--- a/src/ia32/lithium-codegen-ia32.cc
+++ b/src/ia32/lithium-codegen-ia32.cc
@@ -2410,7 +2410,7 @@ void
LCodeGen::EmitLoadFieldOrConstantFunction(Register result,
Handle<String> name,
LEnvironment* env) {
LookupResult lookup(isolate());
- type->LookupTransitionOrDescriptor(NULL, *name, &lookup);
+ type->LookupDescriptor(NULL, *name, &lookup);
ASSERT(lookup.IsFound() || lookup.IsCacheable());
if (lookup.IsField()) {
int index = lookup.GetLocalFieldIndexFromMap(*type);
Index: src/objects.cc
diff --git a/src/objects.cc b/src/objects.cc
index
ccb56cc7884a48492d6889c6664632225c51fa1f..92de5443c748d2356e8170eac31672b9ed80a44f
100644
--- a/src/objects.cc
+++ b/src/objects.cc
@@ -2150,20 +2150,6 @@ void Map::LookupTransition(JSObject* holder,
}
-void Map::LookupTransitionOrDescriptor(JSObject* holder,
- String* name,
- LookupResult* result) {
- // AccessorPairs containing both a Descriptor and a Transition are shared
- // between the DescriptorArray and the Transition array. This is why
looking
- // up the AccessorPair solely in the DescriptorArray works.
- // TODO(verwaest) This should be implemented differently so the
- // DescriptorArray is free of transitions; and so we can freely share it.
- this->LookupDescriptor(holder, name, result);
- if (result->IsFound()) return;
- this->LookupTransition(holder, name, result);
-}
-
-
static bool ContainsMap(MapHandleList* maps, Handle<Map> map) {
ASSERT(!map.is_null());
for (int i = 0; i < maps->length(); ++i) {
@@ -4202,8 +4188,7 @@ void JSReceiver::LocalLookup(String* name,
LookupResult* result) {
}
-void JSReceiver::Lookup(String* name,
- LookupResult* result) {
+void JSReceiver::Lookup(String* name, LookupResult* result) {
// Ecma-262 3rd 8.6.2.4
Heap* heap = GetHeap();
for (Object* current = this;
@@ -12545,10 +12530,9 @@ MaybeObject*
StringDictionary::TransformPropertiesToFastFor(
// Allocate the fixed array for the fields.
Object* fields;
- { MaybeObject* maybe_fields =
- heap->AllocateFixedArray(number_of_allocated_fields);
- if (!maybe_fields->ToObject(&fields)) return maybe_fields;
- }
+ MaybeObject* maybe_fields =
+ heap->AllocateFixedArray(number_of_allocated_fields);
+ if (!maybe_fields->ToObject(&fields)) return maybe_fields;
// Fill in the instance descriptor and the fields.
int next_descriptor = 0;
Index: src/objects.h
diff --git a/src/objects.h b/src/objects.h
index
24d86fd72a0013cebd7bd4c3aa555acb8cdc3f70..d4e4027d18e3e171af249b6bff810dc3d10e8d2a
100644
--- a/src/objects.h
+++ b/src/objects.h
@@ -4905,10 +4905,6 @@ class Map: public HeapObject {
String* name,
LookupResult* result);
- void LookupTransitionOrDescriptor(JSObject* holder,
- String* name,
- LookupResult* result);
-
MUST_USE_RESULT MaybeObject* RawCopy(int instance_size);
MUST_USE_RESULT MaybeObject* CopyWithPreallocatedFieldDescriptors();
MUST_USE_RESULT MaybeObject* CopyDropDescriptors();
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev