OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 } | 209 } |
210 | 210 |
211 static bool IsCompareOp(Value op) { | 211 static bool IsCompareOp(Value op) { |
212 return EQ <= op && op <= IN; | 212 return EQ <= op && op <= IN; |
213 } | 213 } |
214 | 214 |
215 static bool IsOrderedCompareOp(Value op) { | 215 static bool IsOrderedCompareOp(Value op) { |
216 return op == LT || op == LTE || op == GT || op == GTE; | 216 return op == LT || op == LTE || op == GT || op == GTE; |
217 } | 217 } |
218 | 218 |
| 219 static bool IsEqualityOp(Value op) { |
| 220 return op == EQ || op == EQ_STRICT; |
| 221 } |
| 222 |
219 static Value NegateCompareOp(Value op) { | 223 static Value NegateCompareOp(Value op) { |
220 ASSERT(IsCompareOp(op)); | 224 ASSERT(IsCompareOp(op)); |
221 switch (op) { | 225 switch (op) { |
222 case EQ: return NE; | 226 case EQ: return NE; |
223 case NE: return EQ; | 227 case NE: return EQ; |
224 case EQ_STRICT: return NE_STRICT; | 228 case EQ_STRICT: return NE_STRICT; |
225 case LT: return GTE; | 229 case LT: return GTE; |
226 case GT: return LTE; | 230 case GT: return LTE; |
227 case LTE: return GT; | 231 case LTE: return GT; |
228 case GTE: return LT; | 232 case GTE: return LT; |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
280 private: | 284 private: |
281 static const char* const name_[NUM_TOKENS]; | 285 static const char* const name_[NUM_TOKENS]; |
282 static const char* const string_[NUM_TOKENS]; | 286 static const char* const string_[NUM_TOKENS]; |
283 static const int8_t precedence_[NUM_TOKENS]; | 287 static const int8_t precedence_[NUM_TOKENS]; |
284 static const char token_type[NUM_TOKENS]; | 288 static const char token_type[NUM_TOKENS]; |
285 }; | 289 }; |
286 | 290 |
287 } } // namespace v8::internal | 291 } } // namespace v8::internal |
288 | 292 |
289 #endif // V8_TOKEN_H_ | 293 #endif // V8_TOKEN_H_ |
OLD | NEW |