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

Side by Side Diff: src/token.h

Issue 12217136: Fix NegateCompareOp and InvertCompareOp (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 10 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 | « no previous file | test/mjsunit/regress/regress-2537.js » ('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 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 static bool IsEqualityOp(Value op) { 223 static bool IsEqualityOp(Value op) {
224 return op == EQ || op == EQ_STRICT; 224 return op == EQ || op == EQ_STRICT;
225 } 225 }
226 226
227 static Value NegateCompareOp(Value op) { 227 static Value NegateCompareOp(Value op) {
228 ASSERT(IsCompareOp(op)); 228 ASSERT(IsCompareOp(op));
229 switch (op) { 229 switch (op) {
230 case EQ: return NE; 230 case EQ: return NE;
231 case NE: return EQ; 231 case NE: return EQ;
232 case EQ_STRICT: return NE_STRICT; 232 case EQ_STRICT: return NE_STRICT;
233 case NE_STRICT: return EQ_STRICT;
233 case LT: return GTE; 234 case LT: return GTE;
234 case GT: return LTE; 235 case GT: return LTE;
235 case LTE: return GT; 236 case LTE: return GT;
236 case GTE: return LT; 237 case GTE: return LT;
237 default: 238 default:
238 return op; 239 return op;
Michael Starzinger 2013/02/13 11:01:18 Same argumentation as below applies.
Jakob Kummerow 2013/02/13 14:35:43 Done.
239 } 240 }
240 } 241 }
241 242
242 static Value InvertCompareOp(Value op) { 243 static Value InvertCompareOp(Value op) {
Sven Panne 2013/02/13 11:59:30 DBC: Can we rename this to "FlipCompareOp" or some
243 ASSERT(IsCompareOp(op)); 244 ASSERT(IsCompareOp(op));
244 switch (op) { 245 switch (op) {
245 case EQ: return NE; 246 case EQ: return EQ;
246 case NE: return EQ; 247 case NE: return NE;
247 case EQ_STRICT: return NE_STRICT; 248 case EQ_STRICT: return EQ_STRICT;
249 case NE_STRICT: return NE_STRICT;
248 case LT: return GT; 250 case LT: return GT;
249 case GT: return LT; 251 case GT: return LT;
250 case LTE: return GTE; 252 case LTE: return GTE;
251 case GTE: return LTE; 253 case GTE: return LTE;
252 default: 254 default:
253 return op; 255 return op;
Michael Starzinger 2013/02/13 11:01:18 The "IN" and the "INSTANCEOF" operation cannot rea
Jakob Kummerow 2013/02/13 14:35:43 Done.
254 } 256 }
255 } 257 }
256 258
257 static bool IsBitOp(Value op) { 259 static bool IsBitOp(Value op) {
258 return (BIT_OR <= op && op <= SHR) || op == BIT_NOT; 260 return (BIT_OR <= op && op <= SHR) || op == BIT_NOT;
259 } 261 }
260 262
261 static bool IsUnaryOp(Value op) { 263 static bool IsUnaryOp(Value op) {
262 return (NOT <= op && op <= VOID) || op == ADD || op == SUB; 264 return (NOT <= op && op <= VOID) || op == ADD || op == SUB;
263 } 265 }
(...skipping 24 matching lines...) Expand all
288 private: 290 private:
289 static const char* const name_[NUM_TOKENS]; 291 static const char* const name_[NUM_TOKENS];
290 static const char* const string_[NUM_TOKENS]; 292 static const char* const string_[NUM_TOKENS];
291 static const int8_t precedence_[NUM_TOKENS]; 293 static const int8_t precedence_[NUM_TOKENS];
292 static const char token_type[NUM_TOKENS]; 294 static const char token_type[NUM_TOKENS];
293 }; 295 };
294 296
295 } } // namespace v8::internal 297 } } // namespace v8::internal
296 298
297 #endif // V8_TOKEN_H_ 299 #endif // V8_TOKEN_H_
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-2537.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698