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 3704 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3715 ASSERT(map->has_external_array_elements()); | 3715 ASSERT(map->has_external_array_elements()); |
3716 AddInstruction(new(zone()) HCheckMap(object, map)); | 3716 AddInstruction(new(zone()) HCheckMap(object, map)); |
3717 HLoadElements* elements = new(zone()) HLoadElements(object); | 3717 HLoadElements* elements = new(zone()) HLoadElements(object); |
3718 AddInstruction(elements); | 3718 AddInstruction(elements); |
3719 HInstruction* length = AddInstruction( | 3719 HInstruction* length = AddInstruction( |
3720 new(zone()) HExternalArrayLength(elements)); | 3720 new(zone()) HExternalArrayLength(elements)); |
3721 AddInstruction(new(zone()) HBoundsCheck(key, length)); | 3721 AddInstruction(new(zone()) HBoundsCheck(key, length)); |
3722 HLoadExternalArrayPointer* external_elements = | 3722 HLoadExternalArrayPointer* external_elements = |
3723 new(zone()) HLoadExternalArrayPointer(elements); | 3723 new(zone()) HLoadExternalArrayPointer(elements); |
3724 AddInstruction(external_elements); | 3724 AddInstruction(external_elements); |
| 3725 if (expr->external_array_type() == kExternalPixelArray) { |
| 3726 HClampToUint8* clamp = new(zone()) HClampToUint8(val); |
| 3727 AddInstruction(clamp); |
| 3728 val = clamp; |
| 3729 } |
3725 return new(zone()) HStoreKeyedSpecializedArrayElement( | 3730 return new(zone()) HStoreKeyedSpecializedArrayElement( |
3726 external_elements, | 3731 external_elements, |
3727 key, | 3732 key, |
3728 val, | 3733 val, |
3729 expr->external_array_type()); | 3734 expr->external_array_type()); |
3730 } | 3735 } |
3731 | 3736 |
3732 | 3737 |
3733 HInstruction* HGraphBuilder::BuildStoreKeyed(HValue* object, | 3738 HInstruction* HGraphBuilder::BuildStoreKeyed(HValue* object, |
3734 HValue* key, | 3739 HValue* key, |
(...skipping 2385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6120 } | 6125 } |
6121 } | 6126 } |
6122 | 6127 |
6123 #ifdef DEBUG | 6128 #ifdef DEBUG |
6124 if (graph_ != NULL) graph_->Verify(); | 6129 if (graph_ != NULL) graph_->Verify(); |
6125 if (allocator_ != NULL) allocator_->Verify(); | 6130 if (allocator_ != NULL) allocator_->Verify(); |
6126 #endif | 6131 #endif |
6127 } | 6132 } |
6128 | 6133 |
6129 } } // namespace v8::internal | 6134 } } // namespace v8::internal |
OLD | NEW |