Commit 21b9394c authored by verwaest@chromium.org's avatar verwaest@chromium.org

Further reduce LookupResult usage

BUG=
R=yangguo@chromium.org

Review URL: https://codereview.chromium.org/488073002

git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@23245 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 9c908bc0
......@@ -2447,11 +2447,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.IsFound() && it.HasProperty()) continue;
HandleScope inner(isolate());
DCHECK(!to->HasFastProperties());
// Add to dictionary.
......@@ -2480,10 +2479,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.IsFound() && it.HasProperty()) continue;
// Set the property.
Handle<Object> value = Handle<Object>(properties->ValueAt(i),
isolate());
......
......@@ -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.
......
......@@ -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);
......
......@@ -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());
......
......@@ -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.IsFound() || !it.HasProperty()) return false;
Handle<PropertyCell> cell = it.GetPropertyCell();
return cell->type()->IsConstant();
}
......
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