| 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 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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: |
| 239 UNREACHABLE(); |
| 238 return op; | 240 return op; |
| 239 } | 241 } |
| 240 } | 242 } |
| 241 | 243 |
| 242 static Value InvertCompareOp(Value op) { | 244 static Value ReverseCompareOp(Value op) { |
| 243 ASSERT(IsCompareOp(op)); | 245 ASSERT(IsCompareOp(op)); |
| 244 switch (op) { | 246 switch (op) { |
| 245 case EQ: return NE; | 247 case EQ: return EQ; |
| 246 case NE: return EQ; | 248 case NE: return NE; |
| 247 case EQ_STRICT: return NE_STRICT; | 249 case EQ_STRICT: return EQ_STRICT; |
| 250 case NE_STRICT: return NE_STRICT; |
| 248 case LT: return GT; | 251 case LT: return GT; |
| 249 case GT: return LT; | 252 case GT: return LT; |
| 250 case LTE: return GTE; | 253 case LTE: return GTE; |
| 251 case GTE: return LTE; | 254 case GTE: return LTE; |
| 252 default: | 255 default: |
| 256 UNREACHABLE(); |
| 253 return op; | 257 return op; |
| 254 } | 258 } |
| 255 } | 259 } |
| 256 | 260 |
| 257 static bool IsBitOp(Value op) { | 261 static bool IsBitOp(Value op) { |
| 258 return (BIT_OR <= op && op <= SHR) || op == BIT_NOT; | 262 return (BIT_OR <= op && op <= SHR) || op == BIT_NOT; |
| 259 } | 263 } |
| 260 | 264 |
| 261 static bool IsUnaryOp(Value op) { | 265 static bool IsUnaryOp(Value op) { |
| 262 return (NOT <= op && op <= VOID) || op == ADD || op == SUB; | 266 return (NOT <= op && op <= VOID) || op == ADD || op == SUB; |
| (...skipping 25 matching lines...) Expand all Loading... |
| 288 private: | 292 private: |
| 289 static const char* const name_[NUM_TOKENS]; | 293 static const char* const name_[NUM_TOKENS]; |
| 290 static const char* const string_[NUM_TOKENS]; | 294 static const char* const string_[NUM_TOKENS]; |
| 291 static const int8_t precedence_[NUM_TOKENS]; | 295 static const int8_t precedence_[NUM_TOKENS]; |
| 292 static const char token_type[NUM_TOKENS]; | 296 static const char token_type[NUM_TOKENS]; |
| 293 }; | 297 }; |
| 294 | 298 |
| 295 } } // namespace v8::internal | 299 } } // namespace v8::internal |
| 296 | 300 |
| 297 #endif // V8_TOKEN_H_ | 301 #endif // V8_TOKEN_H_ |
| OLD | NEW |