| Index: src/hydrogen.cc
|
| diff --git a/src/hydrogen.cc b/src/hydrogen.cc
|
| index 41f17223ad504c202c70175d56c318fd36076a86..9346c5f2a3b8d33d5bfff4298e6fa81f4a0af684 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);
|
| @@ -3707,7 +3715,8 @@ HInstruction* HGraphBuilder::BuildLoadKeyedPixelArrayElement(HValue* object,
|
| AddInstruction(new HCheckMap(object, map));
|
| HLoadElements* elements = new HLoadElements(object);
|
| AddInstruction(elements);
|
| - HInstruction* length = AddInstruction(new HPixelArrayLength(elements));
|
| + HInstruction* length = new HPixelArrayLength(elements);
|
| + AddInstruction(length);
|
| AddInstruction(new HBoundsCheck(key, length));
|
| HLoadPixelArrayExternalPointer* external_elements =
|
| new HLoadPixelArrayExternalPointer(elements);
|
| @@ -3750,6 +3759,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));
|
| + 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;
|
|
|