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 3787 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3798 ASSERT(map->has_external_array_elements()); | 3798 ASSERT(map->has_external_array_elements()); |
3799 AddInstruction(new(zone()) HCheckMap(object, map)); | 3799 AddInstruction(new(zone()) HCheckMap(object, map)); |
3800 HLoadElements* elements = new(zone()) HLoadElements(object); | 3800 HLoadElements* elements = new(zone()) HLoadElements(object); |
3801 AddInstruction(elements); | 3801 AddInstruction(elements); |
3802 HInstruction* length = AddInstruction( | 3802 HInstruction* length = AddInstruction( |
3803 new(zone()) HExternalArrayLength(elements)); | 3803 new(zone()) HExternalArrayLength(elements)); |
3804 AddInstruction(new(zone()) HBoundsCheck(key, length)); | 3804 AddInstruction(new(zone()) HBoundsCheck(key, length)); |
3805 HLoadExternalArrayPointer* external_elements = | 3805 HLoadExternalArrayPointer* external_elements = |
3806 new(zone()) HLoadExternalArrayPointer(elements); | 3806 new(zone()) HLoadExternalArrayPointer(elements); |
3807 AddInstruction(external_elements); | 3807 AddInstruction(external_elements); |
3808 if (expr->external_array_type() == kExternalPixelArray) { | 3808 ExternalArrayType array_type = expr->external_array_type(); |
3809 HClampToUint8* clamp = new(zone()) HClampToUint8(val); | 3809 switch (array_type) { |
3810 AddInstruction(clamp); | 3810 case kExternalPixelArray: { |
3811 val = clamp; | 3811 HClampToUint8* clamp = new(zone()) HClampToUint8(val); |
| 3812 AddInstruction(clamp); |
| 3813 val = clamp; |
| 3814 break; |
| 3815 } |
| 3816 case kExternalByteArray: |
| 3817 case kExternalUnsignedByteArray: |
| 3818 case kExternalShortArray: |
| 3819 case kExternalUnsignedShortArray: |
| 3820 case kExternalIntArray: |
| 3821 case kExternalUnsignedIntArray: { |
| 3822 HToInt32* floor_val = new(zone()) HToInt32(val); |
| 3823 AddInstruction(floor_val); |
| 3824 val = floor_val; |
| 3825 break; |
| 3826 } |
| 3827 case kExternalFloatArray: |
| 3828 case kExternalDoubleArray: |
| 3829 break; |
3812 } | 3830 } |
3813 return new(zone()) HStoreKeyedSpecializedArrayElement( | 3831 return new(zone()) HStoreKeyedSpecializedArrayElement( |
3814 external_elements, | 3832 external_elements, |
3815 key, | 3833 key, |
3816 val, | 3834 val, |
3817 expr->external_array_type()); | 3835 expr->external_array_type()); |
3818 } | 3836 } |
3819 | 3837 |
3820 | 3838 |
3821 HInstruction* HGraphBuilder::BuildStoreKeyed(HValue* object, | 3839 HInstruction* HGraphBuilder::BuildStoreKeyed(HValue* object, |
(...skipping 2408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6230 } | 6248 } |
6231 } | 6249 } |
6232 | 6250 |
6233 #ifdef DEBUG | 6251 #ifdef DEBUG |
6234 if (graph_ != NULL) graph_->Verify(); | 6252 if (graph_ != NULL) graph_->Verify(); |
6235 if (allocator_ != NULL) allocator_->Verify(); | 6253 if (allocator_ != NULL) allocator_->Verify(); |
6236 #endif | 6254 #endif |
6237 } | 6255 } |
6238 | 6256 |
6239 } } // namespace v8::internal | 6257 } } // namespace v8::internal |
OLD | NEW |