OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 4496 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4507 HInstruction* HGraphBuilder::BuildExternalArrayElementAccess( | 4507 HInstruction* HGraphBuilder::BuildExternalArrayElementAccess( |
4508 HValue* external_elements, | 4508 HValue* external_elements, |
4509 HValue* checked_key, | 4509 HValue* checked_key, |
4510 HValue* val, | 4510 HValue* val, |
4511 ElementsKind elements_kind, | 4511 ElementsKind elements_kind, |
4512 bool is_store) { | 4512 bool is_store) { |
4513 if (is_store) { | 4513 if (is_store) { |
4514 ASSERT(val != NULL); | 4514 ASSERT(val != NULL); |
4515 switch (elements_kind) { | 4515 switch (elements_kind) { |
4516 case EXTERNAL_PIXEL_ELEMENTS: { | 4516 case EXTERNAL_PIXEL_ELEMENTS: { |
4517 HClampToUint8* clamp = new(zone()) HClampToUint8(val); | 4517 val = AddInstruction(new(zone()) HClampToUint8(val)); |
4518 AddInstruction(clamp); | |
4519 val = clamp; | |
4520 break; | 4518 break; |
4521 } | 4519 } |
4522 case EXTERNAL_BYTE_ELEMENTS: | 4520 case EXTERNAL_BYTE_ELEMENTS: |
4523 case EXTERNAL_UNSIGNED_BYTE_ELEMENTS: | 4521 case EXTERNAL_UNSIGNED_BYTE_ELEMENTS: |
4524 case EXTERNAL_SHORT_ELEMENTS: | 4522 case EXTERNAL_SHORT_ELEMENTS: |
4525 case EXTERNAL_UNSIGNED_SHORT_ELEMENTS: | 4523 case EXTERNAL_UNSIGNED_SHORT_ELEMENTS: |
4526 case EXTERNAL_INT_ELEMENTS: | 4524 case EXTERNAL_INT_ELEMENTS: |
4527 case EXTERNAL_UNSIGNED_INT_ELEMENTS: { | 4525 case EXTERNAL_UNSIGNED_INT_ELEMENTS: { |
4528 HToInt32* floor_val = new(zone()) HToInt32(val); | 4526 if (!val->representation().IsInteger32()) { |
4529 AddInstruction(floor_val); | 4527 val = AddInstruction(new(zone()) HChange( |
4530 val = floor_val; | 4528 val, |
| 4529 Representation::Integer32(), |
| 4530 true, // Truncate to int32. |
| 4531 false)); // Don't deoptimize undefined (irrelevant here). |
| 4532 } |
4531 break; | 4533 break; |
4532 } | 4534 } |
4533 case EXTERNAL_FLOAT_ELEMENTS: | 4535 case EXTERNAL_FLOAT_ELEMENTS: |
4534 case EXTERNAL_DOUBLE_ELEMENTS: | 4536 case EXTERNAL_DOUBLE_ELEMENTS: |
4535 break; | 4537 break; |
4536 case FAST_SMI_ONLY_ELEMENTS: | 4538 case FAST_SMI_ONLY_ELEMENTS: |
4537 case FAST_ELEMENTS: | 4539 case FAST_ELEMENTS: |
4538 case FAST_DOUBLE_ELEMENTS: | 4540 case FAST_DOUBLE_ELEMENTS: |
4539 case DICTIONARY_ELEMENTS: | 4541 case DICTIONARY_ELEMENTS: |
4540 case NON_STRICT_ARGUMENTS_ELEMENTS: | 4542 case NON_STRICT_ARGUMENTS_ELEMENTS: |
4541 UNREACHABLE(); | 4543 UNREACHABLE(); |
4542 break; | 4544 break; |
4543 } | 4545 } |
4544 return new(zone()) HStoreKeyedSpecializedArrayElement( | 4546 return new(zone()) HStoreKeyedSpecializedArrayElement( |
4545 external_elements, checked_key, val, elements_kind); | 4547 external_elements, checked_key, val, elements_kind); |
4546 } else { | 4548 } else { |
| 4549 ASSERT(val == NULL); |
4547 return new(zone()) HLoadKeyedSpecializedArrayElement( | 4550 return new(zone()) HLoadKeyedSpecializedArrayElement( |
4548 external_elements, checked_key, elements_kind); | 4551 external_elements, checked_key, elements_kind); |
4549 } | 4552 } |
4550 } | 4553 } |
4551 | 4554 |
4552 | 4555 |
4553 HInstruction* HGraphBuilder::BuildFastElementAccess(HValue* elements, | 4556 HInstruction* HGraphBuilder::BuildFastElementAccess(HValue* elements, |
4554 HValue* checked_key, | 4557 HValue* checked_key, |
4555 HValue* val, | 4558 HValue* val, |
4556 ElementsKind elements_kind, | 4559 ElementsKind elements_kind, |
(...skipping 3470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8027 } | 8030 } |
8028 } | 8031 } |
8029 | 8032 |
8030 #ifdef DEBUG | 8033 #ifdef DEBUG |
8031 if (graph_ != NULL) graph_->Verify(false); // No full verify. | 8034 if (graph_ != NULL) graph_->Verify(false); // No full verify. |
8032 if (allocator_ != NULL) allocator_->Verify(); | 8035 if (allocator_ != NULL) allocator_->Verify(); |
8033 #endif | 8036 #endif |
8034 } | 8037 } |
8035 | 8038 |
8036 } } // namespace v8::internal | 8039 } } // namespace v8::internal |
OLD | NEW |