OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 3170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3181 } else { | 3181 } else { |
3182 // Keyed store. | 3182 // Keyed store. |
3183 VISIT_FOR_VALUE(prop->key()); | 3183 VISIT_FOR_VALUE(prop->key()); |
3184 VISIT_FOR_VALUE(expr->value()); | 3184 VISIT_FOR_VALUE(expr->value()); |
3185 value = Pop(); | 3185 value = Pop(); |
3186 HValue* key = Pop(); | 3186 HValue* key = Pop(); |
3187 HValue* object = Pop(); | 3187 HValue* object = Pop(); |
3188 | 3188 |
3189 if (expr->IsMonomorphic()) { | 3189 if (expr->IsMonomorphic()) { |
3190 Handle<Map> receiver_type(expr->GetMonomorphicReceiverType()); | 3190 Handle<Map> receiver_type(expr->GetMonomorphicReceiverType()); |
3191 // An object has either fast elements or pixel array elements, but never | 3191 // An object has either fast elements or external array elements, but |
3192 // both. Pixel array maps that are assigned to pixel array elements are | 3192 // never both. Pixel array maps that are assigned to pixel array elements |
3193 // always created with the fast elements flag cleared. | 3193 // are always created with the fast elements flag cleared. |
3194 if (receiver_type->has_pixel_array_elements()) { | 3194 if (receiver_type->has_external_array_elements()) { |
3195 instr = BuildStoreKeyedPixelArrayElement(object, key, value, expr); | 3195 if (expr->GetExternalArrayType() == kExternalPixelArray) { |
| 3196 instr = BuildStoreKeyedPixelArrayElement(object, key, value, expr); |
| 3197 } |
3196 } else if (receiver_type->has_fast_elements()) { | 3198 } else if (receiver_type->has_fast_elements()) { |
3197 instr = BuildStoreKeyedFastElement(object, key, value, expr); | 3199 instr = BuildStoreKeyedFastElement(object, key, value, expr); |
3198 } | 3200 } |
3199 } | 3201 } |
3200 if (instr == NULL) { | 3202 if (instr == NULL) { |
3201 instr = BuildStoreKeyedGeneric(object, key, value); | 3203 instr = BuildStoreKeyedGeneric(object, key, value); |
3202 } | 3204 } |
3203 } | 3205 } |
3204 | 3206 |
3205 Push(value); | 3207 Push(value); |
(...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3568 } | 3570 } |
3569 | 3571 |
3570 | 3572 |
3571 HInstruction* HGraphBuilder::BuildLoadKeyedPixelArrayElement(HValue* object, | 3573 HInstruction* HGraphBuilder::BuildLoadKeyedPixelArrayElement(HValue* object, |
3572 HValue* key, | 3574 HValue* key, |
3573 Property* expr) { | 3575 Property* expr) { |
3574 ASSERT(!expr->key()->IsPropertyName() && expr->IsMonomorphic()); | 3576 ASSERT(!expr->key()->IsPropertyName() && expr->IsMonomorphic()); |
3575 AddInstruction(new HCheckNonSmi(object)); | 3577 AddInstruction(new HCheckNonSmi(object)); |
3576 Handle<Map> map = expr->GetMonomorphicReceiverType(); | 3578 Handle<Map> map = expr->GetMonomorphicReceiverType(); |
3577 ASSERT(!map->has_fast_elements()); | 3579 ASSERT(!map->has_fast_elements()); |
3578 ASSERT(map->has_pixel_array_elements()); | 3580 ASSERT(map->has_external_array_elements()); |
3579 AddInstruction(new HCheckMap(object, map)); | 3581 AddInstruction(new HCheckMap(object, map)); |
3580 HLoadElements* elements = new HLoadElements(object); | 3582 HLoadElements* elements = new HLoadElements(object); |
3581 AddInstruction(elements); | 3583 AddInstruction(elements); |
3582 HInstruction* length = new HPixelArrayLength(elements); | 3584 HInstruction* length = new HExternalArrayLength(elements); |
3583 AddInstruction(length); | 3585 AddInstruction(length); |
3584 AddInstruction(new HBoundsCheck(key, length)); | 3586 AddInstruction(new HBoundsCheck(key, length)); |
3585 HLoadPixelArrayExternalPointer* external_elements = | 3587 HLoadExternalArrayPointer* external_elements = |
3586 new HLoadPixelArrayExternalPointer(elements); | 3588 new HLoadExternalArrayPointer(elements); |
3587 AddInstruction(external_elements); | 3589 AddInstruction(external_elements); |
3588 HLoadPixelArrayElement* pixel_array_value = | 3590 HLoadPixelArrayElement* pixel_array_value = |
3589 new HLoadPixelArrayElement(external_elements, key); | 3591 new HLoadPixelArrayElement(external_elements, key); |
3590 return pixel_array_value; | 3592 return pixel_array_value; |
3591 } | 3593 } |
3592 | 3594 |
3593 | 3595 |
3594 HInstruction* HGraphBuilder::BuildStoreKeyedGeneric(HValue* object, | 3596 HInstruction* HGraphBuilder::BuildStoreKeyedGeneric(HValue* object, |
3595 HValue* key, | 3597 HValue* key, |
3596 HValue* value) { | 3598 HValue* value) { |
(...skipping 28 matching lines...) Expand all Loading... |
3625 | 3627 |
3626 HInstruction* HGraphBuilder::BuildStoreKeyedPixelArrayElement( | 3628 HInstruction* HGraphBuilder::BuildStoreKeyedPixelArrayElement( |
3627 HValue* object, | 3629 HValue* object, |
3628 HValue* key, | 3630 HValue* key, |
3629 HValue* val, | 3631 HValue* val, |
3630 Expression* expr) { | 3632 Expression* expr) { |
3631 ASSERT(expr->IsMonomorphic()); | 3633 ASSERT(expr->IsMonomorphic()); |
3632 AddInstruction(new HCheckNonSmi(object)); | 3634 AddInstruction(new HCheckNonSmi(object)); |
3633 Handle<Map> map = expr->GetMonomorphicReceiverType(); | 3635 Handle<Map> map = expr->GetMonomorphicReceiverType(); |
3634 ASSERT(!map->has_fast_elements()); | 3636 ASSERT(!map->has_fast_elements()); |
3635 ASSERT(map->has_pixel_array_elements()); | 3637 ASSERT(map->has_external_array_elements()); |
3636 AddInstruction(new HCheckMap(object, map)); | 3638 AddInstruction(new HCheckMap(object, map)); |
3637 HLoadElements* elements = new HLoadElements(object); | 3639 HLoadElements* elements = new HLoadElements(object); |
3638 AddInstruction(elements); | 3640 AddInstruction(elements); |
3639 HInstruction* length = AddInstruction(new HPixelArrayLength(elements)); | 3641 HInstruction* length = AddInstruction(new HExternalArrayLength(elements)); |
3640 AddInstruction(new HBoundsCheck(key, length)); | 3642 AddInstruction(new HBoundsCheck(key, length)); |
3641 HLoadPixelArrayExternalPointer* external_elements = | 3643 HLoadExternalArrayPointer* external_elements = |
3642 new HLoadPixelArrayExternalPointer(elements); | 3644 new HLoadExternalArrayPointer(elements); |
3643 AddInstruction(external_elements); | 3645 AddInstruction(external_elements); |
3644 return new HStorePixelArrayElement(external_elements, key, val); | 3646 return new HStorePixelArrayElement(external_elements, key, val); |
3645 } | 3647 } |
3646 | 3648 |
3647 | 3649 |
3648 bool HGraphBuilder::TryArgumentsAccess(Property* expr) { | 3650 bool HGraphBuilder::TryArgumentsAccess(Property* expr) { |
3649 VariableProxy* proxy = expr->obj()->AsVariableProxy(); | 3651 VariableProxy* proxy = expr->obj()->AsVariableProxy(); |
3650 if (proxy == NULL) return false; | 3652 if (proxy == NULL) return false; |
3651 if (!proxy->var()->IsStackAllocated()) return false; | 3653 if (!proxy->var()->IsStackAllocated()) return false; |
3652 if (!environment()->Lookup(proxy->var())->CheckFlag(HValue::kIsArguments)) { | 3654 if (!environment()->Lookup(proxy->var())->CheckFlag(HValue::kIsArguments)) { |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3722 VISIT_FOR_VALUE(expr->key()); | 3724 VISIT_FOR_VALUE(expr->key()); |
3723 | 3725 |
3724 HValue* key = Pop(); | 3726 HValue* key = Pop(); |
3725 HValue* obj = Pop(); | 3727 HValue* obj = Pop(); |
3726 | 3728 |
3727 if (expr->IsMonomorphic()) { | 3729 if (expr->IsMonomorphic()) { |
3728 Handle<Map> receiver_type(expr->GetMonomorphicReceiverType()); | 3730 Handle<Map> receiver_type(expr->GetMonomorphicReceiverType()); |
3729 // An object has either fast elements or pixel array elements, but never | 3731 // An object has either fast elements or pixel array elements, but never |
3730 // both. Pixel array maps that are assigned to pixel array elements are | 3732 // both. Pixel array maps that are assigned to pixel array elements are |
3731 // always created with the fast elements flag cleared. | 3733 // always created with the fast elements flag cleared. |
3732 if (receiver_type->has_pixel_array_elements()) { | 3734 if (receiver_type->has_external_array_elements()) { |
3733 instr = BuildLoadKeyedPixelArrayElement(obj, key, expr); | 3735 if (expr->GetExternalArrayType() == kExternalPixelArray) { |
| 3736 instr = BuildLoadKeyedPixelArrayElement(obj, key, expr); |
| 3737 } |
3734 } else if (receiver_type->has_fast_elements()) { | 3738 } else if (receiver_type->has_fast_elements()) { |
3735 instr = BuildLoadKeyedFastElement(obj, key, expr); | 3739 instr = BuildLoadKeyedFastElement(obj, key, expr); |
3736 } | 3740 } |
3737 } | 3741 } |
3738 if (instr == NULL) { | 3742 if (instr == NULL) { |
3739 instr = BuildLoadKeyedGeneric(obj, key); | 3743 instr = BuildLoadKeyedGeneric(obj, key); |
3740 } | 3744 } |
3741 } | 3745 } |
3742 instr->set_position(expr->position()); | 3746 instr->set_position(expr->position()); |
3743 ast_context()->ReturnInstruction(instr, expr->id()); | 3747 ast_context()->ReturnInstruction(instr, expr->id()); |
(...skipping 2146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5890 } | 5894 } |
5891 } | 5895 } |
5892 | 5896 |
5893 #ifdef DEBUG | 5897 #ifdef DEBUG |
5894 if (graph_ != NULL) graph_->Verify(); | 5898 if (graph_ != NULL) graph_->Verify(); |
5895 if (allocator_ != NULL) allocator_->Verify(); | 5899 if (allocator_ != NULL) allocator_->Verify(); |
5896 #endif | 5900 #endif |
5897 } | 5901 } |
5898 | 5902 |
5899 } } // namespace v8::internal | 5903 } } // namespace v8::internal |
OLD | NEW |