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

Unified Diff: runtime/vm/token.h

Issue 12852007: Improve code for !identical(a, b): (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/intermediate_language.cc ('k') | tests/language/identical_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/token.h
===================================================================
--- runtime/vm/token.h (revision 20548)
+++ runtime/vm/token.h (working copy)
@@ -290,6 +290,24 @@
static bool IsBinaryOperator(Token::Kind token);
static bool IsPrefixOperator(Token::Kind token);
+ // For a comparison operation return an operation for the negated comparison:
+ // !(a (op) b) === a (op') b
+ static Token::Kind NegateComparison(Token::Kind op) {
+ switch (op) {
+ case Token::kEQ: return Token::kNE;
+ case Token::kNE: return Token::kEQ;
+ case Token::kLT: return Token::kGTE;
+ case Token::kGT: return Token::kLTE;
+ case Token::kLTE: return Token::kGT;
+ case Token::kGTE: return Token::kLT;
+ case Token::kEQ_STRICT: return Token::kNE_STRICT;
+ case Token::kNE_STRICT: return Token::kEQ_STRICT;
+ default:
+ UNREACHABLE();
+ return Token::kILLEGAL;
+ }
+ }
+
private:
static const char* name_[];
static const char* tok_str_[];
« no previous file with comments | « runtime/vm/intermediate_language.cc ('k') | tests/language/identical_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698