Chromium Code Reviews| Index: src/hydrogen-instructions.cc |
| diff --git a/src/hydrogen-instructions.cc b/src/hydrogen-instructions.cc |
| index b0045b8751b06258f0a241416e54615924ea910f..d745e5164664c9894c49492854981183f7ee2597 100644 |
| --- a/src/hydrogen-instructions.cc |
| +++ b/src/hydrogen-instructions.cc |
| @@ -3884,13 +3884,16 @@ HObjectAccess HObjectAccess::ForBackingStoreOffset(int offset, |
| HObjectAccess HObjectAccess::ForField(Handle<Map> map, |
| - LookupResult *lookup, Handle<String> name) { |
| + LookupResult *lookup, |
| + Handle<String> name) { |
| ASSERT(lookup->IsField() || lookup->IsTransitionToField(*map)); |
| int index; |
| Representation representation; |
| + FieldType field_type; |
| if (lookup->IsField()) { |
| index = lookup->GetLocalFieldIndexFromMap(*map); |
| representation = lookup->representation(); |
| + field_type = MUTABLE; |
| } else { |
| Map* transition = lookup->GetTransitionMapFromMap(*map); |
| int descriptor = transition->LastAdded(); |
| @@ -3899,17 +3902,21 @@ HObjectAccess HObjectAccess::ForField(Handle<Map> map, |
| PropertyDetails details = |
| transition->instance_descriptors()->GetDetails(descriptor); |
| representation = details.representation(); |
| + field_type = CONSTANT; |
| } |
| + int offset = index * kPointerSize; |
| + Portion portion; |
| if (index < 0) { |
| - // Negative property indices are in-object properties, indexed |
| - // from the end of the fixed part of the object. |
| - int offset = (index * kPointerSize) + map->instance_size(); |
| - return HObjectAccess(kInobject, offset, representation); |
| + // Negative property indices are in-object properties, indexed from the end |
| + // of the fixed part of the object. |
| + offset += map->instance_size(); |
| + portion = kInobject; |
| } else { |
| // Non-negative property indices are in the properties array. |
| - int offset = (index * kPointerSize) + FixedArray::kHeaderSize; |
| - return HObjectAccess(kBackingStore, offset, representation, name); |
| + offset += FixedArray::kHeaderSize; |
| + portion = kBackingStore; |
| } |
| + return HObjectAccess(portion, offset, representation, name, field_type); |
| } |
| @@ -3927,11 +3934,11 @@ void HObjectAccess::SetGVNFlags(HValue *instr, bool is_store) { |
| instr->SetGVNFlag(kDependsOnNewSpacePromotion); |
| instr->SetFlag(HValue::kTrackSideEffectDominators); |
| } else { |
| - // try to GVN loads, but don't hoist above map changes |
| instr->SetFlag(HValue::kUseGVN); |
| - instr->SetGVNFlag(kDependsOnMaps); |
| } |
| + if (FieldTypeField::decode(value_) == CONSTANT) return; |
|
titzer
2013/08/26 15:33:47
Mmmm, this is starting to make me feel uncomfortab
|
| + |
| switch (portion()) { |
| case kArrayLengths: |
| instr->SetGVNFlag(is_store |