Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7)

Side by Side Diff: src/hydrogen-instructions.h

Issue 7357003: simplification to HClampToUint8 (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1105 matching lines...) Expand 10 before | Expand all | Expand 10 after
1116 1116
1117 private: 1117 private:
1118 Representation from_; 1118 Representation from_;
1119 bool deoptimize_on_undefined_; 1119 bool deoptimize_on_undefined_;
1120 }; 1120 };
1121 1121
1122 1122
1123 class HClampToUint8: public HUnaryOperation { 1123 class HClampToUint8: public HUnaryOperation {
1124 public: 1124 public:
1125 explicit HClampToUint8(HValue* value) 1125 explicit HClampToUint8(HValue* value)
1126 : HUnaryOperation(value), 1126 : HUnaryOperation(value) {
1127 input_rep_(Representation::None()) { 1127 set_representation(Representation::Integer32());
1128 SetFlag(kFlexibleRepresentation);
1129 set_representation(Representation::Tagged());
1130 SetFlag(kUseGVN); 1128 SetFlag(kUseGVN);
1131 } 1129 }
1132 1130
1133 virtual Representation RequiredInputRepresentation(int index) const { 1131 virtual Representation RequiredInputRepresentation(int index) const {
1134 return input_rep_; 1132 return Representation::None();
1135 }
1136
1137 virtual Representation InferredRepresentation() {
1138 // TODO(danno): Inference on input types should happen separately from
1139 // return representation.
1140 Representation new_rep = value()->representation();
1141 if (input_rep_.IsNone()) {
1142 if (!new_rep.IsNone()) {
1143 input_rep_ = new_rep;
1144 return Representation::Integer32();
1145 } else {
1146 return Representation::None();
1147 }
1148 } else {
1149 return Representation::Integer32();
1150 }
1151 } 1133 }
1152 1134
1153 DECLARE_CONCRETE_INSTRUCTION(ClampToUint8) 1135 DECLARE_CONCRETE_INSTRUCTION(ClampToUint8)
1154 1136
1155 protected: 1137 protected:
1156 virtual bool DataEquals(HValue* other) { return true; } 1138 virtual bool DataEquals(HValue* other) { return true; }
1157
1158 private:
1159 Representation input_rep_;
1160 }; 1139 };
1161 1140
1162 1141
1163 class HToInt32: public HUnaryOperation { 1142 class HToInt32: public HUnaryOperation {
1164 public: 1143 public:
1165 explicit HToInt32(HValue* value) 1144 explicit HToInt32(HValue* value)
1166 : HUnaryOperation(value) { 1145 : HUnaryOperation(value) {
1167 set_representation(Representation::Integer32()); 1146 set_representation(Representation::Integer32());
1168 SetFlag(kUseGVN); 1147 SetFlag(kUseGVN);
1169 } 1148 }
(...skipping 2976 matching lines...) Expand 10 before | Expand all | Expand 10 after
4146 4125
4147 DECLARE_CONCRETE_INSTRUCTION(In) 4126 DECLARE_CONCRETE_INSTRUCTION(In)
4148 }; 4127 };
4149 4128
4150 #undef DECLARE_INSTRUCTION 4129 #undef DECLARE_INSTRUCTION
4151 #undef DECLARE_CONCRETE_INSTRUCTION 4130 #undef DECLARE_CONCRETE_INSTRUCTION
4152 4131
4153 } } // namespace v8::internal 4132 } } // namespace v8::internal
4154 4133
4155 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ 4134 #endif // V8_HYDROGEN_INSTRUCTIONS_H_
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698