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

Unified Diff: runtime/vm/intermediate_language.cc

Issue 682993008: Improve precision of range analysis by allowing it to track ranges across all int typed phis. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: runtime/vm/intermediate_language.cc
diff --git a/runtime/vm/intermediate_language.cc b/runtime/vm/intermediate_language.cc
index c0a4f039a25d4b5e34924d59808fd7a33b2e1c88..fbc492221942fa0a6d9e85cae6f73b59a8f3280c 100644
--- a/runtime/vm/intermediate_language.cc
+++ b/runtime/vm/intermediate_language.cc
@@ -1260,11 +1260,41 @@ bool BinaryIntegerOpInstr::RightIsPowerOfTwoConstant() const {
}
+static intptr_t RepresentationBits(Representation r) {
+ switch (r) {
+ case kTagged:
+ return kBitsPerWord - 1;
+ case kUnboxedInt32:
+ case kUnboxedUint32:
+ return 32;
+ case kUnboxedMint:
+ return 64;
+ default:
+ UNREACHABLE();
+ return 0;
+ }
+}
+
+
+static int64_t RepresentationMask(Representation r) {
+ return static_cast<int64_t>(
+ static_cast<uint64_t>(-1) >> (64 - RepresentationBits(r)));
+}
+
+
static bool ToIntegerConstant(Value* value, int64_t* result) {
if (!value->BindsToConstant()) {
UnboxInstr* unbox = value->definition()->AsUnbox();
- if ((unbox != NULL) && (unbox->representation() == kUnboxedDouble)) {
- return ToIntegerConstant(unbox->value(), result);
+ if (unbox != NULL) {
+ if (unbox->representation() == kUnboxedDouble) {
+ return ToIntegerConstant(unbox->value(), result);
+ } else if (unbox->representation() == kUnboxedUint32) {
Florian Schneider 2014/11/10 16:10:47 Why are kUnboxedInt32 and kInboxedMint not handled
+ if (ToIntegerConstant(unbox->value(), result)) {
+ *result &= RepresentationMask(kUnboxedUint32);
+ return true;
+ }
+ return false;
+ }
}
return false;
}
@@ -1392,28 +1422,6 @@ static bool IsCommutative(Token::Kind op) {
}
-static intptr_t RepresentationBits(Representation r) {
- switch (r) {
- case kTagged:
- return kBitsPerWord - 1;
- case kUnboxedInt32:
- case kUnboxedUint32:
- return 32;
- case kUnboxedMint:
- return 64;
- default:
- UNREACHABLE();
- return 0;
- }
-}
-
-
-static int64_t RepresentationMask(Representation r) {
- return static_cast<int64_t>(
- static_cast<uint64_t>(-1) >> (64 - RepresentationBits(r)));
-}
-
-
UnaryIntegerOpInstr* UnaryIntegerOpInstr::Make(Representation representation,
Token::Kind op_kind,
Value* value,
« runtime/vm/flow_graph_range_analysis.cc ('K') | « runtime/vm/intermediate_language.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698