| 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 3288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3299 } else { | 3299 } else { |
| 3300 // Keyed store. | 3300 // Keyed store. |
| 3301 VISIT_FOR_VALUE(prop->key()); | 3301 VISIT_FOR_VALUE(prop->key()); |
| 3302 VISIT_FOR_VALUE(expr->value()); | 3302 VISIT_FOR_VALUE(expr->value()); |
| 3303 value = Pop(); | 3303 value = Pop(); |
| 3304 HValue* key = Pop(); | 3304 HValue* key = Pop(); |
| 3305 HValue* object = Pop(); | 3305 HValue* object = Pop(); |
| 3306 | 3306 |
| 3307 if (expr->IsMonomorphic()) { | 3307 if (expr->IsMonomorphic()) { |
| 3308 Handle<Map> receiver_type(expr->GetMonomorphicReceiverType()); | 3308 Handle<Map> receiver_type(expr->GetMonomorphicReceiverType()); |
| 3309 // An object has either fast elements or pixel array elements, but never | 3309 // An object has either fast elements or external array elements, but |
| 3310 // both. Pixel array maps that are assigned to pixel array elements are | 3310 // never both. Pixel array maps that are assigned to pixel array elements |
| 3311 // always created with the fast elements flag cleared. | 3311 // are always created with the fast elements flag cleared. |
| 3312 if (receiver_type->has_pixel_array_elements()) { | 3312 if (receiver_type->has_external_array_elements()) { |
| 3313 instr = BuildStoreKeyedPixelArrayElement(object, key, value, expr); | 3313 if (expr->GetExternalArrayType() == kExternalPixelArray) { |
| 3314 instr = BuildStoreKeyedPixelArrayElement(object, key, value, expr); |
| 3315 } |
| 3314 } else if (receiver_type->has_fast_elements()) { | 3316 } else if (receiver_type->has_fast_elements()) { |
| 3315 instr = BuildStoreKeyedFastElement(object, key, value, expr); | 3317 instr = BuildStoreKeyedFastElement(object, key, value, expr); |
| 3316 } | 3318 } |
| 3317 } | 3319 } |
| 3318 if (instr == NULL) { | 3320 if (instr == NULL) { |
| 3319 instr = BuildStoreKeyedGeneric(object, key, value); | 3321 instr = BuildStoreKeyedGeneric(object, key, value); |
| 3320 } | 3322 } |
| 3321 } | 3323 } |
| 3322 | 3324 |
| 3323 Push(value); | 3325 Push(value); |
| (...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3686 } | 3688 } |
| 3687 | 3689 |
| 3688 | 3690 |
| 3689 HInstruction* HGraphBuilder::BuildLoadKeyedPixelArrayElement(HValue* object, | 3691 HInstruction* HGraphBuilder::BuildLoadKeyedPixelArrayElement(HValue* object, |
| 3690 HValue* key, | 3692 HValue* key, |
| 3691 Property* expr) { | 3693 Property* expr) { |
| 3692 ASSERT(!expr->key()->IsPropertyName() && expr->IsMonomorphic()); | 3694 ASSERT(!expr->key()->IsPropertyName() && expr->IsMonomorphic()); |
| 3693 AddInstruction(new HCheckNonSmi(object)); | 3695 AddInstruction(new HCheckNonSmi(object)); |
| 3694 Handle<Map> map = expr->GetMonomorphicReceiverType(); | 3696 Handle<Map> map = expr->GetMonomorphicReceiverType(); |
| 3695 ASSERT(!map->has_fast_elements()); | 3697 ASSERT(!map->has_fast_elements()); |
| 3696 ASSERT(map->has_pixel_array_elements()); | 3698 ASSERT(map->has_external_array_elements()); |
| 3697 AddInstruction(new HCheckMap(object, map)); | 3699 AddInstruction(new HCheckMap(object, map)); |
| 3698 HLoadElements* elements = new HLoadElements(object); | 3700 HLoadElements* elements = new HLoadElements(object); |
| 3699 AddInstruction(elements); | 3701 AddInstruction(elements); |
| 3700 HInstruction* length = new HPixelArrayLength(elements); | 3702 HInstruction* length = new HExternalArrayLength(elements); |
| 3701 AddInstruction(length); | 3703 AddInstruction(length); |
| 3702 AddInstruction(new HBoundsCheck(key, length)); | 3704 AddInstruction(new HBoundsCheck(key, length)); |
| 3703 HLoadPixelArrayExternalPointer* external_elements = | 3705 HLoadExternalArrayPointer* external_elements = |
| 3704 new HLoadPixelArrayExternalPointer(elements); | 3706 new HLoadExternalArrayPointer(elements); |
| 3705 AddInstruction(external_elements); | 3707 AddInstruction(external_elements); |
| 3706 HLoadPixelArrayElement* pixel_array_value = | 3708 HLoadPixelArrayElement* pixel_array_value = |
| 3707 new HLoadPixelArrayElement(external_elements, key); | 3709 new HLoadPixelArrayElement(external_elements, key); |
| 3708 return pixel_array_value; | 3710 return pixel_array_value; |
| 3709 } | 3711 } |
| 3710 | 3712 |
| 3711 | 3713 |
| 3712 HInstruction* HGraphBuilder::BuildStoreKeyedGeneric(HValue* object, | 3714 HInstruction* HGraphBuilder::BuildStoreKeyedGeneric(HValue* object, |
| 3713 HValue* key, | 3715 HValue* key, |
| 3714 HValue* value) { | 3716 HValue* value) { |
| (...skipping 28 matching lines...) Expand all Loading... |
| 3743 | 3745 |
| 3744 HInstruction* HGraphBuilder::BuildStoreKeyedPixelArrayElement( | 3746 HInstruction* HGraphBuilder::BuildStoreKeyedPixelArrayElement( |
| 3745 HValue* object, | 3747 HValue* object, |
| 3746 HValue* key, | 3748 HValue* key, |
| 3747 HValue* val, | 3749 HValue* val, |
| 3748 Expression* expr) { | 3750 Expression* expr) { |
| 3749 ASSERT(expr->IsMonomorphic()); | 3751 ASSERT(expr->IsMonomorphic()); |
| 3750 AddInstruction(new HCheckNonSmi(object)); | 3752 AddInstruction(new HCheckNonSmi(object)); |
| 3751 Handle<Map> map = expr->GetMonomorphicReceiverType(); | 3753 Handle<Map> map = expr->GetMonomorphicReceiverType(); |
| 3752 ASSERT(!map->has_fast_elements()); | 3754 ASSERT(!map->has_fast_elements()); |
| 3753 ASSERT(map->has_pixel_array_elements()); | 3755 ASSERT(map->has_external_array_elements()); |
| 3754 AddInstruction(new HCheckMap(object, map)); | 3756 AddInstruction(new HCheckMap(object, map)); |
| 3755 HLoadElements* elements = new HLoadElements(object); | 3757 HLoadElements* elements = new HLoadElements(object); |
| 3756 AddInstruction(elements); | 3758 AddInstruction(elements); |
| 3757 HInstruction* length = AddInstruction(new HPixelArrayLength(elements)); | 3759 HInstruction* length = AddInstruction(new HExternalArrayLength(elements)); |
| 3758 AddInstruction(new HBoundsCheck(key, length)); | 3760 AddInstruction(new HBoundsCheck(key, length)); |
| 3759 HLoadPixelArrayExternalPointer* external_elements = | 3761 HLoadExternalArrayPointer* external_elements = |
| 3760 new HLoadPixelArrayExternalPointer(elements); | 3762 new HLoadExternalArrayPointer(elements); |
| 3761 AddInstruction(external_elements); | 3763 AddInstruction(external_elements); |
| 3762 return new HStorePixelArrayElement(external_elements, key, val); | 3764 return new HStorePixelArrayElement(external_elements, key, val); |
| 3763 } | 3765 } |
| 3764 | 3766 |
| 3765 | 3767 |
| 3766 bool HGraphBuilder::TryArgumentsAccess(Property* expr) { | 3768 bool HGraphBuilder::TryArgumentsAccess(Property* expr) { |
| 3767 VariableProxy* proxy = expr->obj()->AsVariableProxy(); | 3769 VariableProxy* proxy = expr->obj()->AsVariableProxy(); |
| 3768 if (proxy == NULL) return false; | 3770 if (proxy == NULL) return false; |
| 3769 if (!proxy->var()->IsStackAllocated()) return false; | 3771 if (!proxy->var()->IsStackAllocated()) return false; |
| 3770 if (!environment()->Lookup(proxy->var())->CheckFlag(HValue::kIsArguments)) { | 3772 if (!environment()->Lookup(proxy->var())->CheckFlag(HValue::kIsArguments)) { |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3840 VISIT_FOR_VALUE(expr->key()); | 3842 VISIT_FOR_VALUE(expr->key()); |
| 3841 | 3843 |
| 3842 HValue* key = Pop(); | 3844 HValue* key = Pop(); |
| 3843 HValue* obj = Pop(); | 3845 HValue* obj = Pop(); |
| 3844 | 3846 |
| 3845 if (expr->IsMonomorphic()) { | 3847 if (expr->IsMonomorphic()) { |
| 3846 Handle<Map> receiver_type(expr->GetMonomorphicReceiverType()); | 3848 Handle<Map> receiver_type(expr->GetMonomorphicReceiverType()); |
| 3847 // An object has either fast elements or pixel array elements, but never | 3849 // An object has either fast elements or pixel array elements, but never |
| 3848 // both. Pixel array maps that are assigned to pixel array elements are | 3850 // both. Pixel array maps that are assigned to pixel array elements are |
| 3849 // always created with the fast elements flag cleared. | 3851 // always created with the fast elements flag cleared. |
| 3850 if (receiver_type->has_pixel_array_elements()) { | 3852 if (receiver_type->has_external_array_elements()) { |
| 3851 instr = BuildLoadKeyedPixelArrayElement(obj, key, expr); | 3853 if (expr->GetExternalArrayType() == kExternalPixelArray) { |
| 3854 instr = BuildLoadKeyedPixelArrayElement(obj, key, expr); |
| 3855 } |
| 3852 } else if (receiver_type->has_fast_elements()) { | 3856 } else if (receiver_type->has_fast_elements()) { |
| 3853 instr = BuildLoadKeyedFastElement(obj, key, expr); | 3857 instr = BuildLoadKeyedFastElement(obj, key, expr); |
| 3854 } | 3858 } |
| 3855 } | 3859 } |
| 3856 if (instr == NULL) { | 3860 if (instr == NULL) { |
| 3857 instr = BuildLoadKeyedGeneric(obj, key); | 3861 instr = BuildLoadKeyedGeneric(obj, key); |
| 3858 } | 3862 } |
| 3859 } | 3863 } |
| 3860 instr->set_position(expr->position()); | 3864 instr->set_position(expr->position()); |
| 3861 ast_context()->ReturnInstruction(instr, expr->id()); | 3865 ast_context()->ReturnInstruction(instr, expr->id()); |
| (...skipping 2185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6047 } | 6051 } |
| 6048 } | 6052 } |
| 6049 | 6053 |
| 6050 #ifdef DEBUG | 6054 #ifdef DEBUG |
| 6051 if (graph_ != NULL) graph_->Verify(); | 6055 if (graph_ != NULL) graph_->Verify(); |
| 6052 if (allocator_ != NULL) allocator_->Verify(); | 6056 if (allocator_ != NULL) allocator_->Verify(); |
| 6053 #endif | 6057 #endif |
| 6054 } | 6058 } |
| 6055 | 6059 |
| 6056 } } // namespace v8::internal | 6060 } } // namespace v8::internal |
| OLD | NEW |