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 481 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1046 HChange* change = HChange::cast(other); | 1046 HChange* change = HChange::cast(other); |
1047 return value() == change->value() | 1047 return value() == change->value() |
1048 && to().Equals(change->to()); | 1048 && to().Equals(change->to()); |
1049 } | 1049 } |
1050 | 1050 |
1051 private: | 1051 private: |
1052 Representation from_; | 1052 Representation from_; |
1053 }; | 1053 }; |
1054 | 1054 |
1055 | 1055 |
1056 class HClampToUint8: public HUnaryOperation { | |
1057 public: | |
1058 explicit HClampToUint8(HValue* value) | |
1059 : HUnaryOperation(value), | |
1060 input_rep_(Representation::None()) { | |
1061 SetFlag(kFlexibleRepresentation); | |
Kevin Millikin (Chromium)
2011/05/16 07:06:35
Everywhere else we have kFlexibleRepresentation, w
danno
2011/05/16 14:13:43
Done.
| |
1062 SetFlag(kUseGVN); | |
1063 } | |
1064 | |
1065 virtual Representation RequiredInputRepresentation(int index) const { | |
1066 return input_rep_; | |
1067 } | |
1068 | |
1069 virtual Representation InferredRepresentation() { | |
1070 // TODO(danno): Inference on input types should happen separately from | |
1071 // return representation. | |
1072 Representation new_rep = value()->representation(); | |
1073 if (input_rep_.IsNone()) { | |
1074 if (!new_rep.IsNone()) { | |
1075 input_rep_ = new_rep; | |
1076 return Representation::Integer32(); | |
1077 } else { | |
1078 return Representation::None(); | |
1079 } | |
1080 } else { | |
1081 return Representation::Integer32(); | |
1082 } | |
1083 } | |
1084 | |
1085 DECLARE_CONCRETE_INSTRUCTION(ClampToUint8) | |
1086 | |
1087 protected: | |
1088 virtual bool DataEquals(HValue* other) { return true; } | |
1089 | |
1090 private: | |
1091 Representation input_rep_; | |
1092 }; | |
1093 | |
1094 | |
1056 class HSimulate: public HInstruction { | 1095 class HSimulate: public HInstruction { |
1057 public: | 1096 public: |
1058 HSimulate(int ast_id, int pop_count) | 1097 HSimulate(int ast_id, int pop_count) |
1059 : ast_id_(ast_id), | 1098 : ast_id_(ast_id), |
1060 pop_count_(pop_count), | 1099 pop_count_(pop_count), |
1061 values_(2), | 1100 values_(2), |
1062 assigned_indexes_(2) {} | 1101 assigned_indexes_(2) {} |
1063 virtual ~HSimulate() {} | 1102 virtual ~HSimulate() {} |
1064 | 1103 |
1065 virtual void PrintDataTo(StringStream* stream); | 1104 virtual void PrintDataTo(StringStream* stream); |
(...skipping 2829 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3895 | 3934 |
3896 DECLARE_CONCRETE_INSTRUCTION(In) | 3935 DECLARE_CONCRETE_INSTRUCTION(In) |
3897 }; | 3936 }; |
3898 | 3937 |
3899 #undef DECLARE_INSTRUCTION | 3938 #undef DECLARE_INSTRUCTION |
3900 #undef DECLARE_CONCRETE_INSTRUCTION | 3939 #undef DECLARE_CONCRETE_INSTRUCTION |
3901 | 3940 |
3902 } } // namespace v8::internal | 3941 } } // namespace v8::internal |
3903 | 3942 |
3904 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ | 3943 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ |
OLD | NEW |