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 5447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5458 SetOperandAt(1, key); | 5458 SetOperandAt(1, key); |
5459 SetOperandAt(2, dependency != NULL ? dependency : obj); | 5459 SetOperandAt(2, dependency != NULL ? dependency : obj); |
5460 | 5460 |
5461 if (!is_external()) { | 5461 if (!is_external()) { |
5462 // I can detect the case between storing double (holey and fast) and | 5462 // I can detect the case between storing double (holey and fast) and |
5463 // smi/object by looking at elements_kind_. | 5463 // smi/object by looking at elements_kind_. |
5464 ASSERT(IsFastSmiOrObjectElementsKind(elements_kind) || | 5464 ASSERT(IsFastSmiOrObjectElementsKind(elements_kind) || |
5465 IsFastDoubleElementsKind(elements_kind)); | 5465 IsFastDoubleElementsKind(elements_kind)); |
5466 | 5466 |
5467 if (IsFastSmiOrObjectElementsKind(elements_kind)) { | 5467 if (IsFastSmiOrObjectElementsKind(elements_kind)) { |
5468 if (IsFastSmiElementsKind(elements_kind)) { | 5468 if (IsFastSmiElementsKind(elements_kind) && |
| 5469 (!IsHoleyElementsKind(elements_kind) || |
| 5470 mode == NEVER_RETURN_HOLE)) { |
5469 set_type(HType::Smi()); | 5471 set_type(HType::Smi()); |
5470 set_representation(Representation::Smi()); | 5472 set_representation(Representation::Smi()); |
5471 } else { | 5473 } else { |
5472 set_representation(Representation::Tagged()); | 5474 set_representation(Representation::Tagged()); |
5473 } | 5475 } |
5474 | 5476 |
5475 SetGVNFlag(kDependsOnArrayElements); | 5477 SetGVNFlag(kDependsOnArrayElements); |
5476 } else { | 5478 } else { |
5477 set_representation(Representation::Double()); | 5479 set_representation(Representation::Double()); |
5478 SetGVNFlag(kDependsOnDoubleArrayElements); | 5480 SetGVNFlag(kDependsOnDoubleArrayElements); |
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5767 // EXTERNAL_{UNSIGNED_,}{BYTE,SHORT,INT}_ELEMENTS are truncating. | 5769 // EXTERNAL_{UNSIGNED_,}{BYTE,SHORT,INT}_ELEMENTS are truncating. |
5768 if (elements_kind >= EXTERNAL_BYTE_ELEMENTS && | 5770 if (elements_kind >= EXTERNAL_BYTE_ELEMENTS && |
5769 elements_kind <= EXTERNAL_UNSIGNED_INT_ELEMENTS) { | 5771 elements_kind <= EXTERNAL_UNSIGNED_INT_ELEMENTS) { |
5770 SetFlag(kTruncatingToInt32); | 5772 SetFlag(kTruncatingToInt32); |
5771 } | 5773 } |
5772 } | 5774 } |
5773 | 5775 |
5774 virtual Representation RequiredInputRepresentation(int index) { | 5776 virtual Representation RequiredInputRepresentation(int index) { |
5775 // kind_fast: tagged[int32] = tagged | 5777 // kind_fast: tagged[int32] = tagged |
5776 // kind_double: tagged[int32] = double | 5778 // kind_double: tagged[int32] = double |
| 5779 // kind_smi : tagged[int32] = smi |
5777 // kind_external: external[int32] = (double | int32) | 5780 // kind_external: external[int32] = (double | int32) |
5778 if (index == 0) { | 5781 if (index == 0) { |
5779 return is_external() ? Representation::External() | 5782 return is_external() ? Representation::External() |
5780 : Representation::Tagged(); | 5783 : Representation::Tagged(); |
5781 } else if (index == 1) { | 5784 } else if (index == 1) { |
5782 return ArrayInstructionInterface::KeyedAccessIndexRequirement( | 5785 return ArrayInstructionInterface::KeyedAccessIndexRequirement( |
5783 OperandAt(1)->representation()); | 5786 OperandAt(1)->representation()); |
5784 } | 5787 } |
5785 | 5788 |
5786 ASSERT_EQ(index, 2); | 5789 ASSERT_EQ(index, 2); |
5787 if (IsDoubleOrFloatElementsKind(elements_kind())) { | 5790 if (IsDoubleOrFloatElementsKind(elements_kind())) { |
5788 return Representation::Double(); | 5791 return Representation::Double(); |
5789 } | 5792 } |
5790 | 5793 |
5791 if (IsFastSmiElementsKind(elements_kind())) { | 5794 if (IsFastSmiElementsKind(elements_kind())) { |
5792 return Representation::Smi(); | 5795 return Representation::Smi(); |
5793 } | 5796 } |
5794 | 5797 |
5795 return is_external() ? Representation::Integer32() | 5798 return is_external() ? Representation::Integer32() |
5796 : Representation::Tagged(); | 5799 : Representation::Tagged(); |
5797 } | 5800 } |
5798 | 5801 |
5799 bool is_external() const { | 5802 bool is_external() const { |
5800 return IsExternalArrayElementsKind(elements_kind()); | 5803 return IsExternalArrayElementsKind(elements_kind()); |
5801 } | 5804 } |
5802 | 5805 |
5803 virtual Representation observed_input_representation(int index) { | 5806 virtual Representation observed_input_representation(int index) { |
5804 if (index < 2) return RequiredInputRepresentation(index); | 5807 if (index < 2) return RequiredInputRepresentation(index); |
| 5808 if (IsFastSmiElementsKind(elements_kind())) { |
| 5809 return Representation::Smi(); |
| 5810 } |
5805 if (IsDoubleOrFloatElementsKind(elements_kind())) { | 5811 if (IsDoubleOrFloatElementsKind(elements_kind())) { |
5806 return Representation::Double(); | 5812 return Representation::Double(); |
5807 } | 5813 } |
5808 if (is_external()) { | 5814 if (is_external()) { |
5809 return Representation::Integer32(); | 5815 return Representation::Integer32(); |
5810 } | 5816 } |
5811 // For fast object elements kinds, don't assume anything. | 5817 // For fast object elements kinds, don't assume anything. |
5812 return Representation::None(); | 5818 return Representation::None(); |
5813 } | 5819 } |
5814 | 5820 |
(...skipping 698 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6513 virtual bool IsDeletable() const { return true; } | 6519 virtual bool IsDeletable() const { return true; } |
6514 }; | 6520 }; |
6515 | 6521 |
6516 | 6522 |
6517 #undef DECLARE_INSTRUCTION | 6523 #undef DECLARE_INSTRUCTION |
6518 #undef DECLARE_CONCRETE_INSTRUCTION | 6524 #undef DECLARE_CONCRETE_INSTRUCTION |
6519 | 6525 |
6520 } } // namespace v8::internal | 6526 } } // namespace v8::internal |
6521 | 6527 |
6522 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ | 6528 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ |
OLD | NEW |