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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 V(CallNew) \ | 80 V(CallNew) \ |
81 V(CallRuntime) \ | 81 V(CallRuntime) \ |
82 V(CallStub) \ | 82 V(CallStub) \ |
83 V(Change) \ | 83 V(Change) \ |
84 V(CheckFunction) \ | 84 V(CheckFunction) \ |
85 V(CheckInstanceType) \ | 85 V(CheckInstanceType) \ |
86 V(CheckMap) \ | 86 V(CheckMap) \ |
87 V(CheckNonSmi) \ | 87 V(CheckNonSmi) \ |
88 V(CheckPrototypeMaps) \ | 88 V(CheckPrototypeMaps) \ |
89 V(CheckSmi) \ | 89 V(CheckSmi) \ |
| 90 V(ClampToUint8) \ |
90 V(ClassOfTest) \ | 91 V(ClassOfTest) \ |
91 V(Compare) \ | 92 V(Compare) \ |
92 V(CompareJSObjectEq) \ | 93 V(CompareJSObjectEq) \ |
93 V(CompareMap) \ | 94 V(CompareMap) \ |
94 V(CompareSymbolEq) \ | 95 V(CompareSymbolEq) \ |
95 V(Constant) \ | 96 V(Constant) \ |
96 V(Context) \ | 97 V(Context) \ |
97 V(DeleteProperty) \ | 98 V(DeleteProperty) \ |
98 V(Deoptimize) \ | 99 V(Deoptimize) \ |
99 V(Div) \ | 100 V(Div) \ |
100 V(EnterInlined) \ | 101 V(EnterInlined) \ |
101 V(ExternalArrayLength) \ | 102 V(ExternalArrayLength) \ |
102 V(FixedArrayLength) \ | 103 V(FixedArrayLength) \ |
| 104 V(ForceRepresentation) \ |
103 V(FunctionLiteral) \ | 105 V(FunctionLiteral) \ |
104 V(GetCachedArrayIndex) \ | 106 V(GetCachedArrayIndex) \ |
105 V(GlobalObject) \ | 107 V(GlobalObject) \ |
106 V(GlobalReceiver) \ | 108 V(GlobalReceiver) \ |
107 V(Goto) \ | 109 V(Goto) \ |
108 V(HasInstanceType) \ | 110 V(HasInstanceType) \ |
109 V(HasCachedArrayIndex) \ | 111 V(HasCachedArrayIndex) \ |
110 V(In) \ | 112 V(In) \ |
111 V(InstanceOf) \ | 113 V(InstanceOf) \ |
112 V(InstanceOfKnownGlobal) \ | 114 V(InstanceOfKnownGlobal) \ |
(...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
544 | 546 |
545 int id() const { return id_; } | 547 int id() const { return id_; } |
546 void set_id(int id) { id_ = id; } | 548 void set_id(int id) { id_ = id; } |
547 | 549 |
548 HUseIterator uses() const { return HUseIterator(use_list_); } | 550 HUseIterator uses() const { return HUseIterator(use_list_); } |
549 | 551 |
550 virtual bool EmitAtUses() { return false; } | 552 virtual bool EmitAtUses() { return false; } |
551 Representation representation() const { return representation_; } | 553 Representation representation() const { return representation_; } |
552 void ChangeRepresentation(Representation r) { | 554 void ChangeRepresentation(Representation r) { |
553 // Representation was already set and is allowed to be changed. | 555 // Representation was already set and is allowed to be changed. |
554 ASSERT(!representation_.IsNone()); | |
555 ASSERT(!r.IsNone()); | 556 ASSERT(!r.IsNone()); |
556 ASSERT(CheckFlag(kFlexibleRepresentation)); | 557 ASSERT(CheckFlag(kFlexibleRepresentation)); |
557 RepresentationChanged(r); | 558 RepresentationChanged(r); |
558 representation_ = r; | 559 representation_ = r; |
559 } | 560 } |
560 void AssumeRepresentation(Representation r); | 561 void AssumeRepresentation(Representation r); |
561 | 562 |
562 virtual bool IsConvertibleToInteger() const { return true; } | 563 virtual bool IsConvertibleToInteger() const { return true; } |
563 | 564 |
564 HType type() const { return type_; } | 565 HType type() const { return type_; } |
(...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1002 } | 1003 } |
1003 | 1004 |
1004 virtual Representation RequiredInputRepresentation(int index) const { | 1005 virtual Representation RequiredInputRepresentation(int index) const { |
1005 return Representation::Tagged(); | 1006 return Representation::Tagged(); |
1006 } | 1007 } |
1007 | 1008 |
1008 DECLARE_CONCRETE_INSTRUCTION(Throw) | 1009 DECLARE_CONCRETE_INSTRUCTION(Throw) |
1009 }; | 1010 }; |
1010 | 1011 |
1011 | 1012 |
| 1013 class HForceRepresentation: public HTemplateInstruction<1> { |
| 1014 public: |
| 1015 HForceRepresentation(HValue* value, Representation required_representation) { |
| 1016 SetOperandAt(0, value); |
| 1017 set_representation(required_representation); |
| 1018 } |
| 1019 |
| 1020 HValue* value() { return OperandAt(0); } |
| 1021 |
| 1022 virtual HValue* EnsureAndPropagateNotMinusZero(BitVector* visited); |
| 1023 |
| 1024 virtual Representation RequiredInputRepresentation(int index) const { |
| 1025 return representation(); // Same as the output representation. |
| 1026 } |
| 1027 |
| 1028 DECLARE_CONCRETE_INSTRUCTION(ForceRepresentation) |
| 1029 }; |
| 1030 |
| 1031 |
1012 class HChange: public HUnaryOperation { | 1032 class HChange: public HUnaryOperation { |
1013 public: | 1033 public: |
1014 HChange(HValue* value, | 1034 HChange(HValue* value, |
1015 Representation from, | 1035 Representation from, |
1016 Representation to, | 1036 Representation to, |
1017 bool is_truncating) | 1037 bool is_truncating) |
1018 : HUnaryOperation(value), from_(from) { | 1038 : HUnaryOperation(value), from_(from) { |
1019 ASSERT(!from.IsNone() && !to.IsNone()); | 1039 ASSERT(!from.IsNone() && !to.IsNone()); |
1020 ASSERT(!from.Equals(to)); | 1040 ASSERT(!from.Equals(to)); |
1021 set_representation(to); | 1041 set_representation(to); |
(...skipping 25 matching lines...) Expand all Loading... |
1047 HChange* change = HChange::cast(other); | 1067 HChange* change = HChange::cast(other); |
1048 return value() == change->value() | 1068 return value() == change->value() |
1049 && to().Equals(change->to()); | 1069 && to().Equals(change->to()); |
1050 } | 1070 } |
1051 | 1071 |
1052 private: | 1072 private: |
1053 Representation from_; | 1073 Representation from_; |
1054 }; | 1074 }; |
1055 | 1075 |
1056 | 1076 |
| 1077 class HClampToUint8: public HUnaryOperation { |
| 1078 public: |
| 1079 explicit HClampToUint8(HValue* value) |
| 1080 : HUnaryOperation(value), |
| 1081 input_rep_(Representation::None()) { |
| 1082 SetFlag(kFlexibleRepresentation); |
| 1083 set_representation(Representation::Tagged()); |
| 1084 SetFlag(kUseGVN); |
| 1085 } |
| 1086 |
| 1087 virtual Representation RequiredInputRepresentation(int index) const { |
| 1088 return input_rep_; |
| 1089 } |
| 1090 |
| 1091 virtual Representation InferredRepresentation() { |
| 1092 // TODO(danno): Inference on input types should happen separately from |
| 1093 // return representation. |
| 1094 Representation new_rep = value()->representation(); |
| 1095 if (input_rep_.IsNone()) { |
| 1096 if (!new_rep.IsNone()) { |
| 1097 input_rep_ = new_rep; |
| 1098 return Representation::Integer32(); |
| 1099 } else { |
| 1100 return Representation::None(); |
| 1101 } |
| 1102 } else { |
| 1103 return Representation::Integer32(); |
| 1104 } |
| 1105 } |
| 1106 |
| 1107 DECLARE_CONCRETE_INSTRUCTION(ClampToUint8) |
| 1108 |
| 1109 protected: |
| 1110 virtual bool DataEquals(HValue* other) { return true; } |
| 1111 |
| 1112 private: |
| 1113 Representation input_rep_; |
| 1114 }; |
| 1115 |
| 1116 |
1057 class HSimulate: public HInstruction { | 1117 class HSimulate: public HInstruction { |
1058 public: | 1118 public: |
1059 HSimulate(int ast_id, int pop_count) | 1119 HSimulate(int ast_id, int pop_count) |
1060 : ast_id_(ast_id), | 1120 : ast_id_(ast_id), |
1061 pop_count_(pop_count), | 1121 pop_count_(pop_count), |
1062 values_(2), | 1122 values_(2), |
1063 assigned_indexes_(2) {} | 1123 assigned_indexes_(2) {} |
1064 virtual ~HSimulate() {} | 1124 virtual ~HSimulate() {} |
1065 | 1125 |
1066 virtual void PrintDataTo(StringStream* stream); | 1126 virtual void PrintDataTo(StringStream* stream); |
(...skipping 2829 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3896 | 3956 |
3897 DECLARE_CONCRETE_INSTRUCTION(In) | 3957 DECLARE_CONCRETE_INSTRUCTION(In) |
3898 }; | 3958 }; |
3899 | 3959 |
3900 #undef DECLARE_INSTRUCTION | 3960 #undef DECLARE_INSTRUCTION |
3901 #undef DECLARE_CONCRETE_INSTRUCTION | 3961 #undef DECLARE_CONCRETE_INSTRUCTION |
3902 | 3962 |
3903 } } // namespace v8::internal | 3963 } } // namespace v8::internal |
3904 | 3964 |
3905 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ | 3965 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ |
OLD | NEW |