Chromium Code Reviews| Index: src/hydrogen.cc |
| diff --git a/src/hydrogen.cc b/src/hydrogen.cc |
| index 41f17223ad504c202c70175d56c318fd36076a86..62b3ef547e1ce8dbaf4aa8d11eb276ed0ecc75fd 100644 |
| --- a/src/hydrogen.cc |
| +++ b/src/hydrogen.cc |
| @@ -3326,12 +3326,20 @@ void HGraphBuilder::HandlePropertyAssignment(Assignment* expr) { |
| HValue* key = Pop(); |
| HValue* object = Pop(); |
| - bool is_fast_elements = expr->IsMonomorphic() && |
| - expr->GetMonomorphicReceiverType()->has_fast_elements(); |
| - |
| - instr = is_fast_elements |
| - ? BuildStoreKeyedFastElement(object, key, value, expr) |
| - : BuildStoreKeyedGeneric(object, key, value); |
| + if (expr->IsMonomorphic()) { |
| + Handle<Map> receiver_type(expr->GetMonomorphicReceiverType()); |
| + // An object has either fast elements or pixel array elements, but never |
| + // both. Pixel array maps that are assigned to pixel array elements are |
| + // always created with the fast elements flag cleared. |
| + if (receiver_type->has_pixel_array_elements()) { |
| + instr = BuildStoreKeyedPixelArrayElement(object, key, value, expr); |
| + } else if (receiver_type->has_fast_elements()) { |
| + instr = BuildStoreKeyedFastElement(object, key, value, expr); |
| + } |
| + } |
| + if (instr == NULL) { |
| + instr = BuildStoreKeyedGeneric(object, key, value); |
| + } |
| } |
| Push(value); |
| @@ -3750,6 +3758,27 @@ HInstruction* HGraphBuilder::BuildStoreKeyedFastElement(HValue* object, |
| } |
| +HInstruction* HGraphBuilder::BuildStoreKeyedPixelArrayElement(HValue* object, |
| + HValue* key, |
| + HValue* val, |
| + Expression* expr) { |
| + ASSERT(expr->IsMonomorphic()); |
| + AddInstruction(new HCheckNonSmi(object)); |
| + Handle<Map> map = expr->GetMonomorphicReceiverType(); |
| + ASSERT(!map->has_fast_elements()); |
| + ASSERT(map->has_pixel_array_elements()); |
| + AddInstruction(new HCheckMap(object, map)); |
| + HLoadElements* elements = new HLoadElements(object); |
| + AddInstruction(elements); |
| + HInstruction* length = AddInstruction(new HPixelArrayLength(elements)); |
|
Kevin Millikin (Chromium)
2011/02/16 08:51:25
Wow, AddInstruction returns a value and we usually
danno
2011/02/16 13:54:22
Done.
|
| + AddInstruction(new HBoundsCheck(key, length)); |
| + HLoadPixelArrayExternalPointer* external_elements = |
| + new HLoadPixelArrayExternalPointer(elements); |
| + AddInstruction(external_elements); |
| + return new HStorePixelArrayElement(external_elements, key, val); |
| +} |
| + |
| + |
| bool HGraphBuilder::TryArgumentsAccess(Property* expr) { |
| VariableProxy* proxy = expr->obj()->AsVariableProxy(); |
| if (proxy == NULL) return false; |