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) \ |
(...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
544 | 545 |
545 int id() const { return id_; } | 546 int id() const { return id_; } |
546 void set_id(int id) { id_ = id; } | 547 void set_id(int id) { id_ = id; } |
547 | 548 |
548 HUseIterator uses() const { return HUseIterator(use_list_); } | 549 HUseIterator uses() const { return HUseIterator(use_list_); } |
549 | 550 |
550 virtual bool EmitAtUses() { return false; } | 551 virtual bool EmitAtUses() { return false; } |
551 Representation representation() const { return representation_; } | 552 Representation representation() const { return representation_; } |
552 void ChangeRepresentation(Representation r) { | 553 void ChangeRepresentation(Representation r) { |
553 // Representation was already set and is allowed to be changed. | 554 // Representation was already set and is allowed to be changed. |
554 ASSERT(!representation_.IsNone()); | |
555 ASSERT(!r.IsNone()); | 555 ASSERT(!r.IsNone()); |
556 ASSERT(CheckFlag(kFlexibleRepresentation)); | 556 ASSERT(CheckFlag(kFlexibleRepresentation)); |
557 RepresentationChanged(r); | 557 RepresentationChanged(r); |
558 representation_ = r; | 558 representation_ = r; |
559 } | 559 } |
560 | 560 |
561 virtual bool IsConvertibleToInteger() const { return true; } | 561 virtual bool IsConvertibleToInteger() const { return true; } |
562 | 562 |
563 HType type() const { return type_; } | 563 HType type() const { return type_; } |
564 void set_type(HType type) { | 564 void set_type(HType type) { |
(...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1041 HChange* change = HChange::cast(other); | 1041 HChange* change = HChange::cast(other); |
1042 return value() == change->value() | 1042 return value() == change->value() |
1043 && to().Equals(change->to()); | 1043 && to().Equals(change->to()); |
1044 } | 1044 } |
1045 | 1045 |
1046 private: | 1046 private: |
1047 Representation from_; | 1047 Representation from_; |
1048 }; | 1048 }; |
1049 | 1049 |
1050 | 1050 |
| 1051 class HClampToUint8: public HUnaryOperation { |
| 1052 public: |
| 1053 explicit HClampToUint8(HValue* value) |
| 1054 : HUnaryOperation(value), |
| 1055 input_rep_(Representation::None()) { |
| 1056 SetFlag(kFlexibleRepresentation); |
| 1057 SetFlag(kUseGVN); |
| 1058 } |
| 1059 |
| 1060 virtual Representation RequiredInputRepresentation(int index) const { |
| 1061 return input_rep_; |
| 1062 } |
| 1063 |
| 1064 virtual Representation InferredRepresentation() { |
| 1065 // TODO(danno): Inference on input types should happen separately from |
| 1066 // return representation. |
| 1067 Representation new_rep = value()->representation(); |
| 1068 if (input_rep_.IsNone()) { |
| 1069 if (!new_rep.IsNone()) { |
| 1070 input_rep_ = new_rep; |
| 1071 return Representation::Integer32(); |
| 1072 } else { |
| 1073 return Representation::None(); |
| 1074 } |
| 1075 } else { |
| 1076 return Representation::Integer32(); |
| 1077 } |
| 1078 } |
| 1079 |
| 1080 DECLARE_CONCRETE_INSTRUCTION(ClampToUint8) |
| 1081 |
| 1082 protected: |
| 1083 virtual bool DataEquals(HValue* other) { return true; } |
| 1084 |
| 1085 private: |
| 1086 Representation input_rep_; |
| 1087 }; |
| 1088 |
| 1089 |
1051 class HSimulate: public HInstruction { | 1090 class HSimulate: public HInstruction { |
1052 public: | 1091 public: |
1053 HSimulate(int ast_id, int pop_count) | 1092 HSimulate(int ast_id, int pop_count) |
1054 : ast_id_(ast_id), | 1093 : ast_id_(ast_id), |
1055 pop_count_(pop_count), | 1094 pop_count_(pop_count), |
1056 values_(2), | 1095 values_(2), |
1057 assigned_indexes_(2) {} | 1096 assigned_indexes_(2) {} |
1058 virtual ~HSimulate() {} | 1097 virtual ~HSimulate() {} |
1059 | 1098 |
1060 virtual void PrintDataTo(StringStream* stream); | 1099 virtual void PrintDataTo(StringStream* stream); |
(...skipping 2829 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3890 | 3929 |
3891 DECLARE_CONCRETE_INSTRUCTION(In) | 3930 DECLARE_CONCRETE_INSTRUCTION(In) |
3892 }; | 3931 }; |
3893 | 3932 |
3894 #undef DECLARE_INSTRUCTION | 3933 #undef DECLARE_INSTRUCTION |
3895 #undef DECLARE_CONCRETE_INSTRUCTION | 3934 #undef DECLARE_CONCRETE_INSTRUCTION |
3896 | 3935 |
3897 } } // namespace v8::internal | 3936 } } // namespace v8::internal |
3898 | 3937 |
3899 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ | 3938 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ |
OLD | NEW |