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.
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());
}
-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.
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);
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);
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());
}
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();
}