| 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 3449 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3460 | 3460 |
| 3461 protected: | 3461 protected: |
| 3462 virtual bool DataEquals(HValue* other) { return true; } | 3462 virtual bool DataEquals(HValue* other) { return true; } |
| 3463 }; | 3463 }; |
| 3464 | 3464 |
| 3465 | 3465 |
| 3466 class HLoadKeyedSpecializedArrayElement: public HBinaryOperation { | 3466 class HLoadKeyedSpecializedArrayElement: public HBinaryOperation { |
| 3467 public: | 3467 public: |
| 3468 HLoadKeyedSpecializedArrayElement(HValue* external_elements, | 3468 HLoadKeyedSpecializedArrayElement(HValue* external_elements, |
| 3469 HValue* key, | 3469 HValue* key, |
| 3470 ExternalArrayType array_type) | 3470 JSObject::ElementsKind elements_kind) |
| 3471 : HBinaryOperation(external_elements, key), | 3471 : HBinaryOperation(external_elements, key), |
| 3472 array_type_(array_type) { | 3472 elements_kind_(elements_kind) { |
| 3473 if (array_type == kExternalFloatArray || | 3473 if (elements_kind == JSObject::EXTERNAL_FLOAT_ELEMENTS || |
| 3474 array_type == kExternalDoubleArray) { | 3474 elements_kind == JSObject::EXTERNAL_DOUBLE_ELEMENTS) { |
| 3475 set_representation(Representation::Double()); | 3475 set_representation(Representation::Double()); |
| 3476 } else { | 3476 } else { |
| 3477 set_representation(Representation::Integer32()); | 3477 set_representation(Representation::Integer32()); |
| 3478 } | 3478 } |
| 3479 SetFlag(kDependsOnSpecializedArrayElements); | 3479 SetFlag(kDependsOnSpecializedArrayElements); |
| 3480 // Native code could change the specialized array. | 3480 // Native code could change the specialized array. |
| 3481 SetFlag(kDependsOnCalls); | 3481 SetFlag(kDependsOnCalls); |
| 3482 SetFlag(kUseGVN); | 3482 SetFlag(kUseGVN); |
| 3483 } | 3483 } |
| 3484 | 3484 |
| 3485 virtual void PrintDataTo(StringStream* stream); | 3485 virtual void PrintDataTo(StringStream* stream); |
| 3486 | 3486 |
| 3487 virtual Representation RequiredInputRepresentation(int index) const { | 3487 virtual Representation RequiredInputRepresentation(int index) const { |
| 3488 // The key is supposed to be Integer32, but the base pointer | 3488 // The key is supposed to be Integer32, but the base pointer |
| 3489 // for the element load is a naked pointer. | 3489 // for the element load is a naked pointer. |
| 3490 return (index == 1) ? Representation::Integer32() | 3490 return (index == 1) ? Representation::Integer32() |
| 3491 : Representation::External(); | 3491 : Representation::External(); |
| 3492 } | 3492 } |
| 3493 | 3493 |
| 3494 HValue* external_pointer() { return OperandAt(0); } | 3494 HValue* external_pointer() { return OperandAt(0); } |
| 3495 HValue* key() { return OperandAt(1); } | 3495 HValue* key() { return OperandAt(1); } |
| 3496 ExternalArrayType array_type() const { return array_type_; } | 3496 JSObject::ElementsKind elements_kind() const { return elements_kind_; } |
| 3497 | 3497 |
| 3498 DECLARE_CONCRETE_INSTRUCTION(LoadKeyedSpecializedArrayElement) | 3498 DECLARE_CONCRETE_INSTRUCTION(LoadKeyedSpecializedArrayElement) |
| 3499 | 3499 |
| 3500 protected: | 3500 protected: |
| 3501 virtual bool DataEquals(HValue* other) { | 3501 virtual bool DataEquals(HValue* other) { |
| 3502 if (!other->IsLoadKeyedSpecializedArrayElement()) return false; | 3502 if (!other->IsLoadKeyedSpecializedArrayElement()) return false; |
| 3503 HLoadKeyedSpecializedArrayElement* cast_other = | 3503 HLoadKeyedSpecializedArrayElement* cast_other = |
| 3504 HLoadKeyedSpecializedArrayElement::cast(other); | 3504 HLoadKeyedSpecializedArrayElement::cast(other); |
| 3505 return array_type_ == cast_other->array_type(); | 3505 return elements_kind_ == cast_other->elements_kind(); |
| 3506 } | 3506 } |
| 3507 | 3507 |
| 3508 private: | 3508 private: |
| 3509 ExternalArrayType array_type_; | 3509 JSObject::ElementsKind elements_kind_; |
| 3510 }; | 3510 }; |
| 3511 | 3511 |
| 3512 | 3512 |
| 3513 class HLoadKeyedGeneric: public HTemplateInstruction<3> { | 3513 class HLoadKeyedGeneric: public HTemplateInstruction<3> { |
| 3514 public: | 3514 public: |
| 3515 HLoadKeyedGeneric(HValue* context, HValue* obj, HValue* key) { | 3515 HLoadKeyedGeneric(HValue* context, HValue* obj, HValue* key) { |
| 3516 set_representation(Representation::Tagged()); | 3516 set_representation(Representation::Tagged()); |
| 3517 SetOperandAt(0, obj); | 3517 SetOperandAt(0, obj); |
| 3518 SetOperandAt(1, key); | 3518 SetOperandAt(1, key); |
| 3519 SetOperandAt(2, context); | 3519 SetOperandAt(2, context); |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3642 | 3642 |
| 3643 DECLARE_CONCRETE_INSTRUCTION(StoreKeyedFastElement) | 3643 DECLARE_CONCRETE_INSTRUCTION(StoreKeyedFastElement) |
| 3644 }; | 3644 }; |
| 3645 | 3645 |
| 3646 | 3646 |
| 3647 class HStoreKeyedSpecializedArrayElement: public HTemplateInstruction<3> { | 3647 class HStoreKeyedSpecializedArrayElement: public HTemplateInstruction<3> { |
| 3648 public: | 3648 public: |
| 3649 HStoreKeyedSpecializedArrayElement(HValue* external_elements, | 3649 HStoreKeyedSpecializedArrayElement(HValue* external_elements, |
| 3650 HValue* key, | 3650 HValue* key, |
| 3651 HValue* val, | 3651 HValue* val, |
| 3652 ExternalArrayType array_type) | 3652 JSObject::ElementsKind elements_kind) |
| 3653 : array_type_(array_type) { | 3653 : elements_kind_(elements_kind) { |
| 3654 SetFlag(kChangesSpecializedArrayElements); | 3654 SetFlag(kChangesSpecializedArrayElements); |
| 3655 SetOperandAt(0, external_elements); | 3655 SetOperandAt(0, external_elements); |
| 3656 SetOperandAt(1, key); | 3656 SetOperandAt(1, key); |
| 3657 SetOperandAt(2, val); | 3657 SetOperandAt(2, val); |
| 3658 } | 3658 } |
| 3659 | 3659 |
| 3660 virtual void PrintDataTo(StringStream* stream); | 3660 virtual void PrintDataTo(StringStream* stream); |
| 3661 | 3661 |
| 3662 virtual Representation RequiredInputRepresentation(int index) const { | 3662 virtual Representation RequiredInputRepresentation(int index) const { |
| 3663 if (index == 0) { | 3663 if (index == 0) { |
| 3664 return Representation::External(); | 3664 return Representation::External(); |
| 3665 } else { | 3665 } else { |
| 3666 if (index == 2 && (array_type() == kExternalFloatArray || | 3666 bool float_or_double_elements = |
| 3667 array_type() == kExternalDoubleArray)) { | 3667 elements_kind() == JSObject::EXTERNAL_FLOAT_ELEMENTS || |
| 3668 elements_kind() == JSObject::EXTERNAL_DOUBLE_ELEMENTS; |
| 3669 if (index == 2 && float_or_double_elements) { |
| 3668 return Representation::Double(); | 3670 return Representation::Double(); |
| 3669 } else { | 3671 } else { |
| 3670 return Representation::Integer32(); | 3672 return Representation::Integer32(); |
| 3671 } | 3673 } |
| 3672 } | 3674 } |
| 3673 } | 3675 } |
| 3674 | 3676 |
| 3675 HValue* external_pointer() { return OperandAt(0); } | 3677 HValue* external_pointer() { return OperandAt(0); } |
| 3676 HValue* key() { return OperandAt(1); } | 3678 HValue* key() { return OperandAt(1); } |
| 3677 HValue* value() { return OperandAt(2); } | 3679 HValue* value() { return OperandAt(2); } |
| 3678 ExternalArrayType array_type() const { return array_type_; } | 3680 JSObject::ElementsKind elements_kind() const { return elements_kind_; } |
| 3679 | 3681 |
| 3680 DECLARE_CONCRETE_INSTRUCTION(StoreKeyedSpecializedArrayElement) | 3682 DECLARE_CONCRETE_INSTRUCTION(StoreKeyedSpecializedArrayElement) |
| 3681 | 3683 |
| 3682 private: | 3684 private: |
| 3683 ExternalArrayType array_type_; | 3685 JSObject::ElementsKind elements_kind_; |
| 3684 }; | 3686 }; |
| 3685 | 3687 |
| 3686 | 3688 |
| 3687 class HStoreKeyedGeneric: public HTemplateInstruction<4> { | 3689 class HStoreKeyedGeneric: public HTemplateInstruction<4> { |
| 3688 public: | 3690 public: |
| 3689 HStoreKeyedGeneric(HValue* context, | 3691 HStoreKeyedGeneric(HValue* context, |
| 3690 HValue* object, | 3692 HValue* object, |
| 3691 HValue* key, | 3693 HValue* key, |
| 3692 HValue* value, | 3694 HValue* value, |
| 3693 bool strict_mode) | 3695 bool strict_mode) |
| (...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4029 | 4031 |
| 4030 DECLARE_CONCRETE_INSTRUCTION(In) | 4032 DECLARE_CONCRETE_INSTRUCTION(In) |
| 4031 }; | 4033 }; |
| 4032 | 4034 |
| 4033 #undef DECLARE_INSTRUCTION | 4035 #undef DECLARE_INSTRUCTION |
| 4034 #undef DECLARE_CONCRETE_INSTRUCTION | 4036 #undef DECLARE_CONCRETE_INSTRUCTION |
| 4035 | 4037 |
| 4036 } } // namespace v8::internal | 4038 } } // namespace v8::internal |
| 4037 | 4039 |
| 4038 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ | 4040 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ |
| OLD | NEW |