Reviewers: Jakob,
Message:
PTAL
Description:
Further reduce LookupResult usage
BUG=
Please review this at https://codereview.chromium.org/488073002/
SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge
Affected files (+25, -33 lines):
M src/bootstrapper.cc
M src/hydrogen.cc
M src/hydrogen-instructions.h
M src/hydrogen-instructions.cc
M src/ic.cc
Index: src/bootstrapper.cc
diff --git a/src/bootstrapper.cc b/src/bootstrapper.cc
index
bfd9f5e918fd247778372daf947a722e83ab1064..15e6fb09b0d7114c1bb56fcc274d559d03662ca9
100644
--- a/src/bootstrapper.cc
+++ b/src/bootstrapper.cc
@@ -2445,11 +2445,10 @@ void
Genesis::TransferNamedProperties(Handle<JSObject> from,
break;
}
case CALLBACKS: {
- LookupResult result(isolate());
- Handle<Name> key(Name::cast(descs->GetKey(i)), isolate());
- to->LookupOwn(key, &result);
+ Handle<Name> key(descs->GetKey(i));
+ LookupIterator it(to, key, LookupIterator::CHECK_PROPERTY);
// If the property is already there we skip it
- if (result.IsFound()) continue;
+ if (it.HasProperty()) continue;
HandleScope inner(isolate());
DCHECK(!to->HasFastProperties());
// Add to dictionary.
@@ -2478,10 +2477,9 @@ void
Genesis::TransferNamedProperties(Handle<JSObject> from,
if (properties->IsKey(raw_key)) {
DCHECK(raw_key->IsName());
// If the property is already there we skip it.
- LookupResult result(isolate());
Handle<Name> key(Name::cast(raw_key));
- to->LookupOwn(key, &result);
- if (result.IsFound()) continue;
+ LookupIterator it(to, key, LookupIterator::CHECK_PROPERTY);
+ if (it.HasProperty()) continue;
// Set the property.
Handle<Object> value = Handle<Object>(properties->ValueAt(i),
isolate());
Index: src/hydrogen-instructions.cc
diff --git a/src/hydrogen-instructions.cc b/src/hydrogen-instructions.cc
index
896efcf65f68c1d75ec5a19c9c6823d1541daf69..87860be6738c0c4d14b895243f95644938275b5a
100644
--- a/src/hydrogen-instructions.cc
+++ b/src/hydrogen-instructions.cc
@@ -4642,24 +4642,9 @@ HObjectAccess
HObjectAccess::ForBackingStoreOffset(int offset,
}
-HObjectAccess HObjectAccess::ForField(Handle<Map> map,
- LookupResult* lookup,
+HObjectAccess HObjectAccess::ForField(Handle<Map> map, int index,
+ Representation representation,
Handle<String> name) {
- DCHECK(lookup->IsField() || lookup->IsTransitionToField());
- int index;
- Representation representation;
- if (lookup->IsField()) {
- index = lookup->GetLocalFieldIndexFromMap(*map);
- representation = lookup->representation();
- } else {
- Map* transition = lookup->GetTransitionTarget();
- int descriptor = transition->LastAdded();
- index = transition->instance_descriptors()->GetFieldIndex(descriptor) -
- map->inobject_properties();
- PropertyDetails details =
- transition->instance_descriptors()->GetDetails(descriptor);
- representation = details.representation();
- }
if (index < 0) {
// Negative property indices are in-object properties, indexed
// from the end of the fixed part of the object.
Index: src/hydrogen-instructions.h
diff --git a/src/hydrogen-instructions.h b/src/hydrogen-instructions.h
index
ed1243507c8b125199157216c169bbc342789303..4c29e34d40510f54765641c02abdca3425bb41d0
100644
--- a/src/hydrogen-instructions.h
+++ b/src/hydrogen-instructions.h
@@ -6192,8 +6192,9 @@ class HObjectAccess V8_FINAL {
Representation representation = Representation::Tagged());
// Create an access to a resolved field (in-object or backing store).
- static HObjectAccess ForField(Handle<Map> map,
- LookupResult *lookup, Handle<String> name = Handle<String>::null());
+ static HObjectAccess ForField(Handle<Map> map, int index,
+ Representation representation,
+ Handle<String> name);
// Create an access for the payload of a Cell or JSGlobalPropertyCell.
static HObjectAccess ForCellPayload(Isolate* isolate);
Index: src/hydrogen.cc
diff --git a/src/hydrogen.cc b/src/hydrogen.cc
index
6096c248970e2e0b0f1950cd8ae238f1b62b7d99..59d3bb909314f89320c5dbbad48a2dc104b5b442
100644
--- a/src/hydrogen.cc
+++ b/src/hydrogen.cc
@@ -5977,7 +5977,9 @@ bool
HOptimizedGraphBuilder::PropertyAccessInfo::LoadResult(Handle<Map> map) {
if (lookup_.IsField()) {
// Construct the object field access.
- access_ = HObjectAccess::ForField(map, &lookup_, name_);
+ int index = lookup_.GetLocalFieldIndexFromMap(*map);
+ Representation representation = lookup_.representation();
+ access_ = HObjectAccess::ForField(map, index, representation, name_);
// Load field map for heap objects.
LoadFieldMaps(map);
@@ -6087,7 +6089,14 @@ bool
HOptimizedGraphBuilder::PropertyAccessInfo::CanAccessMonomorphic() {
map->LookupTransition(NULL, *name_, &lookup_);
if (lookup_.IsTransitionToField() && map->unused_property_fields() > 0) {
// Construct the object field access.
- access_ = HObjectAccess::ForField(map, &lookup_, name_);
+ int descriptor = transition()->LastAdded();
+ int index =
+ transition()->instance_descriptors()->GetFieldIndex(descriptor) -
+ map->inobject_properties();
+ PropertyDetails details =
+ transition()->instance_descriptors()->GetDetails(descriptor);
+ Representation representation = details.representation();
+ access_ = HObjectAccess::ForField(map, index, representation, name_);
// Load field map for heap objects.
LoadFieldMaps(transition());
Index: src/ic.cc
diff --git a/src/ic.cc b/src/ic.cc
index
b080a316531bd333622b67309286d9cefe4ee957..c5002fa5322c10b19a8a5642456c54a68087003c
100644
--- a/src/ic.cc
+++ b/src/ic.cc
@@ -278,11 +278,10 @@ bool
IC::TryRemoveInvalidPrototypeDependentStub(Handle<Object> receiver,
}
if (receiver->IsGlobalObject()) {
- LookupResult lookup(isolate());
- GlobalObject* global = GlobalObject::cast(*receiver);
- global->LookupOwnRealNamedProperty(name, &lookup);
- if (!lookup.IsFound()) return false;
- PropertyCell* cell = global->GetPropertyCell(&lookup);
+ Handle<GlobalObject> global = Handle<GlobalObject>::cast(receiver);
+ LookupIterator it(global, name, LookupIterator::CHECK_PROPERTY);
+ if (!it.HasProperty()) return false;
+ Handle<PropertyCell> cell = it.GetPropertyCell();
return cell->type()->IsConstant();
}
--
--
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/d/optout.