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

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

Issue 7489043: Better range information for logical shift right >>>. (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
« src/hydrogen-instructions.h ('K') | « src/hydrogen-instructions.h ('k') | 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 1212 matching lines...) Expand 10 before | Expand all | Expand 10 after
1223 ? left()->range()->Copy() 1223 ? left()->range()->Copy()
1224 : new Range(); 1224 : new Range();
1225 result->Sar(c->Integer32Value()); 1225 result->Sar(c->Integer32Value());
1226 return result; 1226 return result;
1227 } 1227 }
1228 } 1228 }
1229 return HValue::InferRange(); 1229 return HValue::InferRange();
1230 } 1230 }
1231 1231
1232 1232
1233 Range* HShr::InferRange() {
1234 if (right()->IsConstant()) {
1235 HConstant* c = HConstant::cast(right());
1236 if (c->HasInteger32Value()) {
1237 int shift_count = c->Integer32Value() & 0x1f;
1238 if (left()->range()->CanBeNegative()) {
1239 // Only compute bounds if the result always fits into an int32.
1240 return (shift_count >= 1)
1241 ? new Range(0, static_cast<uint32_t>(0xffffffff) >> shift_count)
1242 : new Range();
1243 } else {
1244 // For positive inputs we can use the >> operator.
1245 Range* result = (left()->range() != NULL)
1246 ? left()->range()->Copy()
1247 : new Range();
1248 result->Sar(c->Integer32Value());
1249 return result;
1250 }
1251 }
1252 }
1253 return HValue::InferRange();
1254 }
1255
1256
1233 Range* HShl::InferRange() { 1257 Range* HShl::InferRange() {
1234 if (right()->IsConstant()) { 1258 if (right()->IsConstant()) {
1235 HConstant* c = HConstant::cast(right()); 1259 HConstant* c = HConstant::cast(right());
1236 if (c->HasInteger32Value()) { 1260 if (c->HasInteger32Value()) {
1237 Range* result = (left()->range() != NULL) 1261 Range* result = (left()->range() != NULL)
1238 ? left()->range()->Copy() 1262 ? left()->range()->Copy()
1239 : new Range(); 1263 : new Range();
1240 result->Shl(c->Integer32Value()); 1264 result->Shl(c->Integer32Value());
1241 return result; 1265 return result;
1242 } 1266 }
(...skipping 574 matching lines...) Expand 10 before | Expand all | Expand 10 after
1817 1841
1818 1842
1819 void HCheckPrototypeMaps::Verify() { 1843 void HCheckPrototypeMaps::Verify() {
1820 HInstruction::Verify(); 1844 HInstruction::Verify();
1821 ASSERT(HasNoUses()); 1845 ASSERT(HasNoUses());
1822 } 1846 }
1823 1847
1824 #endif 1848 #endif
1825 1849
1826 } } // namespace v8::internal 1850 } } // namespace v8::internal
OLDNEW
« src/hydrogen-instructions.h ('K') | « src/hydrogen-instructions.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698