| OLD | NEW |
| 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 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 } | 218 } |
| 219 | 219 |
| 220 static bool IsOrderedRelationalCompareOp(Value op) { | 220 static bool IsOrderedRelationalCompareOp(Value op) { |
| 221 return op == LT || op == LTE || op == GT || op == GTE; | 221 return op == LT || op == LTE || op == GT || op == GTE; |
| 222 } | 222 } |
| 223 | 223 |
| 224 static bool IsEqualityOp(Value op) { | 224 static bool IsEqualityOp(Value op) { |
| 225 return op == EQ || op == EQ_STRICT; | 225 return op == EQ || op == EQ_STRICT; |
| 226 } | 226 } |
| 227 | 227 |
| 228 static bool IsInequalityOp(Value op) { |
| 229 return op == NE || op == NE_STRICT; |
| 230 } |
| 231 |
| 232 static bool IsArithmeticCompareOp(Value op) { |
| 233 return IsOrderedRelationalCompareOp(op) || |
| 234 IsEqualityOp(op) || IsInequalityOp(op); |
| 235 } |
| 236 |
| 228 static Value NegateCompareOp(Value op) { | 237 static Value NegateCompareOp(Value op) { |
| 229 ASSERT(IsCompareOp(op)); | 238 ASSERT(IsArithmeticCompareOp(op)); |
| 230 switch (op) { | 239 switch (op) { |
| 231 case EQ: return NE; | 240 case EQ: return NE; |
| 232 case NE: return EQ; | 241 case NE: return EQ; |
| 233 case EQ_STRICT: return NE_STRICT; | 242 case EQ_STRICT: return NE_STRICT; |
| 234 case NE_STRICT: return EQ_STRICT; | 243 case NE_STRICT: return EQ_STRICT; |
| 235 case LT: return GTE; | 244 case LT: return GTE; |
| 236 case GT: return LTE; | 245 case GT: return LTE; |
| 237 case LTE: return GT; | 246 case LTE: return GT; |
| 238 case GTE: return LT; | 247 case GTE: return LT; |
| 239 default: | 248 default: |
| 240 UNREACHABLE(); | 249 UNREACHABLE(); |
| 241 return op; | 250 return op; |
| 242 } | 251 } |
| 243 } | 252 } |
| 244 | 253 |
| 245 static Value ReverseCompareOp(Value op) { | 254 static Value ReverseCompareOp(Value op) { |
| 246 ASSERT(IsCompareOp(op)); | 255 ASSERT(IsArithmeticCompareOp(op)); |
| 247 switch (op) { | 256 switch (op) { |
| 248 case EQ: return EQ; | 257 case EQ: return EQ; |
| 249 case NE: return NE; | 258 case NE: return NE; |
| 250 case EQ_STRICT: return EQ_STRICT; | 259 case EQ_STRICT: return EQ_STRICT; |
| 251 case NE_STRICT: return NE_STRICT; | 260 case NE_STRICT: return NE_STRICT; |
| 252 case LT: return GT; | 261 case LT: return GT; |
| 253 case GT: return LT; | 262 case GT: return LT; |
| 254 case LTE: return GTE; | 263 case LTE: return GTE; |
| 255 case GTE: return LTE; | 264 case GTE: return LTE; |
| 256 default: | 265 default: |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 293 private: | 302 private: |
| 294 static const char* const name_[NUM_TOKENS]; | 303 static const char* const name_[NUM_TOKENS]; |
| 295 static const char* const string_[NUM_TOKENS]; | 304 static const char* const string_[NUM_TOKENS]; |
| 296 static const int8_t precedence_[NUM_TOKENS]; | 305 static const int8_t precedence_[NUM_TOKENS]; |
| 297 static const char token_type[NUM_TOKENS]; | 306 static const char token_type[NUM_TOKENS]; |
| 298 }; | 307 }; |
| 299 | 308 |
| 300 } } // namespace v8::internal | 309 } } // namespace v8::internal |
| 301 | 310 |
| 302 #endif // V8_TOKEN_H_ | 311 #endif // V8_TOKEN_H_ |
| OLD | NEW |