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

Unified Diff: runtime/vm/token.cc

Issue 735543003: Range feedback for binary integer operations. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comments Created 6 years 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
« no previous file with comments | « runtime/vm/token.h ('k') | runtime/vm/unit_test.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/token.cc
diff --git a/runtime/vm/token.cc b/runtime/vm/token.cc
index 2289718ee8c5e48dba3b4e96efe1c73c33c98a1c..75872e5d1077087923eb9636641cb6bfbac30f96 100644
--- a/runtime/vm/token.cc
+++ b/runtime/vm/token.cc
@@ -39,6 +39,22 @@ const uint8_t Token::precedence_[] = {
bool Token::IsBinaryOperator(Token::Kind token) {
switch (token) {
+ case Token::kOR:
+ case Token::kAND:
+ return true;
+ default:
+ return IsBinaryArithmeticOperator(token);
+ }
+}
+
+
+bool Token::IsUnaryOperator(Token::Kind token) {
+ return (token == kNOT) || IsUnaryArithmeticOperator(token);
+}
+
+
+bool Token::IsBinaryArithmeticOperator(Token::Kind token) {
+ switch (token) {
case Token::kADD:
case Token::kSUB:
case Token::kMUL:
@@ -48,8 +64,6 @@ bool Token::IsBinaryOperator(Token::Kind token) {
case Token::kBIT_OR:
case Token::kBIT_XOR:
case Token::kBIT_AND:
- case Token::kOR:
- case Token::kAND:
case Token::kSHL:
case Token::kSHR:
return true;
@@ -59,8 +73,9 @@ bool Token::IsBinaryOperator(Token::Kind token) {
}
-bool Token::IsPrefixOperator(Token::Kind token) {
- return (token == kNOT) || (token == kBIT_NOT) || (token == kNEGATE);
+bool Token::IsUnaryArithmeticOperator(Token::Kind token) {
+ return (token == kBIT_NOT) || (token == kNEGATE);
}
+
} // namespace dart
« no previous file with comments | « runtime/vm/token.h ('k') | runtime/vm/unit_test.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698