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

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

Issue 10829169: Refactor Math.min/max to be a single HInstruction. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: review feedback; removed VORR instruction Created 8 years, 4 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 | « src/hydrogen-instructions.h ('k') | src/ia32/assembler-ia32.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 149
150 150
151 void Range::Union(Range* other) { 151 void Range::Union(Range* other) {
152 upper_ = Max(upper_, other->upper_); 152 upper_ = Max(upper_, other->upper_);
153 lower_ = Min(lower_, other->lower_); 153 lower_ = Min(lower_, other->lower_);
154 bool b = CanBeMinusZero() || other->CanBeMinusZero(); 154 bool b = CanBeMinusZero() || other->CanBeMinusZero();
155 set_can_be_minus_zero(b); 155 set_can_be_minus_zero(b);
156 } 156 }
157 157
158 158
159 void Range::CombinedMax(Range* other) {
160 upper_ = Max(upper_, other->upper_);
161 lower_ = Max(lower_, other->lower_);
162 set_can_be_minus_zero(CanBeMinusZero() || other->CanBeMinusZero());
163 }
164
165
166 void Range::CombinedMin(Range* other) {
167 upper_ = Min(upper_, other->upper_);
168 lower_ = Min(lower_, other->lower_);
169 set_can_be_minus_zero(CanBeMinusZero() || other->CanBeMinusZero());
170 }
171
172
159 void Range::Sar(int32_t value) { 173 void Range::Sar(int32_t value) {
160 int32_t bits = value & 0x1F; 174 int32_t bits = value & 0x1F;
161 lower_ = lower_ >> bits; 175 lower_ = lower_ >> bits;
162 upper_ = upper_ >> bits; 176 upper_ = upper_ >> bits;
163 set_can_be_minus_zero(false); 177 set_can_be_minus_zero(false);
164 } 178 }
165 179
166 180
167 void Range::Shl(int32_t value) { 181 void Range::Shl(int32_t value) {
168 int32_t bits = value & 0x1F; 182 int32_t bits = value & 0x1F;
(...skipping 1062 matching lines...) Expand 10 before | Expand all | Expand 10 after
1231 if (!right()->range()->CanBeZero()) { 1245 if (!right()->range()->CanBeZero()) {
1232 ClearFlag(HValue::kCanBeDivByZero); 1246 ClearFlag(HValue::kCanBeDivByZero);
1233 } 1247 }
1234 return result; 1248 return result;
1235 } else { 1249 } else {
1236 return HValue::InferRange(zone); 1250 return HValue::InferRange(zone);
1237 } 1251 }
1238 } 1252 }
1239 1253
1240 1254
1255 Range* HMathMinMax::InferRange(Zone* zone) {
1256 if (representation().IsInteger32()) {
1257 Range* a = left()->range();
1258 Range* b = right()->range();
1259 Range* res = a->Copy(zone);
1260 if (operation_ == kMathMax) {
1261 res->CombinedMax(b);
1262 } else {
1263 ASSERT(operation_ == kMathMin);
1264 res->CombinedMin(b);
1265 }
1266 return res;
1267 } else {
1268 return HValue::InferRange(zone);
1269 }
1270 }
1271
1272
1241 void HPhi::PrintTo(StringStream* stream) { 1273 void HPhi::PrintTo(StringStream* stream) {
1242 stream->Add("["); 1274 stream->Add("[");
1243 for (int i = 0; i < OperandCount(); ++i) { 1275 for (int i = 0; i < OperandCount(); ++i) {
1244 HValue* value = OperandAt(i); 1276 HValue* value = OperandAt(i);
1245 stream->Add(" "); 1277 stream->Add(" ");
1246 value->PrintNameTo(stream); 1278 value->PrintNameTo(stream);
1247 stream->Add(" "); 1279 stream->Add(" ");
1248 } 1280 }
1249 stream->Add(" uses%d_%di_%dd_%dt", 1281 stream->Add(" uses%d_%di_%dd_%dt",
1250 UseCount(), 1282 UseCount(),
(...skipping 1333 matching lines...) Expand 10 before | Expand all | Expand 10 after
2584 2616
2585 2617
2586 void HCheckPrototypeMaps::Verify() { 2618 void HCheckPrototypeMaps::Verify() {
2587 HInstruction::Verify(); 2619 HInstruction::Verify();
2588 ASSERT(HasNoUses()); 2620 ASSERT(HasNoUses());
2589 } 2621 }
2590 2622
2591 #endif 2623 #endif
2592 2624
2593 } } // namespace v8::internal 2625 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/hydrogen-instructions.h ('k') | src/ia32/assembler-ia32.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698