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

Side by Side Diff: src/token.h

Issue 953563002: Implement experimental exponentiation operator (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: use Number() instead of OrderedNumber() to include NaN Created 5 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 unified diff | Download patch
« no previous file with comments | « src/scanner.cc ('k') | src/typing.cc » ('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 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef V8_TOKEN_H_ 5 #ifndef V8_TOKEN_H_
6 #define V8_TOKEN_H_ 6 #define V8_TOKEN_H_
7 7
8 #include "src/base/logging.h" 8 #include "src/base/logging.h"
9 #include "src/globals.h" 9 #include "src/globals.h"
10 10
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 T(ASSIGN_BIT_XOR, "^=", 2) \ 59 T(ASSIGN_BIT_XOR, "^=", 2) \
60 T(ASSIGN_BIT_AND, "&=", 2) \ 60 T(ASSIGN_BIT_AND, "&=", 2) \
61 T(ASSIGN_SHL, "<<=", 2) \ 61 T(ASSIGN_SHL, "<<=", 2) \
62 T(ASSIGN_SAR, ">>=", 2) \ 62 T(ASSIGN_SAR, ">>=", 2) \
63 T(ASSIGN_SHR, ">>>=", 2) \ 63 T(ASSIGN_SHR, ">>>=", 2) \
64 T(ASSIGN_ADD, "+=", 2) \ 64 T(ASSIGN_ADD, "+=", 2) \
65 T(ASSIGN_SUB, "-=", 2) \ 65 T(ASSIGN_SUB, "-=", 2) \
66 T(ASSIGN_MUL, "*=", 2) \ 66 T(ASSIGN_MUL, "*=", 2) \
67 T(ASSIGN_DIV, "/=", 2) \ 67 T(ASSIGN_DIV, "/=", 2) \
68 T(ASSIGN_MOD, "%=", 2) \ 68 T(ASSIGN_MOD, "%=", 2) \
69 T(ASSIGN_EXP, "**=", 2) \
69 \ 70 \
70 /* Binary operators sorted by precedence. */ \ 71 /* Binary operators sorted by precedence. */ \
71 /* IsBinaryOp() relies on this block of enum values */ \ 72 /* IsBinaryOp() relies on this block of enum values */ \
72 /* being contiguous and sorted in the same order! */ \ 73 /* being contiguous and sorted in the same order! */ \
73 T(COMMA, ",", 1) \ 74 T(COMMA, ",", 1) \
74 T(OR, "||", 4) \ 75 T(OR, "||", 4) \
75 T(AND, "&&", 5) \ 76 T(AND, "&&", 5) \
76 T(BIT_OR, "|", 6) \ 77 T(BIT_OR, "|", 6) \
77 T(BIT_XOR, "^", 7) \ 78 T(BIT_XOR, "^", 7) \
78 T(BIT_AND, "&", 8) \ 79 T(BIT_AND, "&", 8) \
79 T(SHL, "<<", 11) \ 80 T(SHL, "<<", 11) \
80 T(SAR, ">>", 11) \ 81 T(SAR, ">>", 11) \
81 T(SHR, ">>>", 11) \ 82 T(SHR, ">>>", 11) \
82 T(ROR, "rotate right", 11) /* only used by Crankshaft */ \ 83 T(ROR, "rotate right", 11) /* only used by Crankshaft */ \
83 T(ADD, "+", 12) \ 84 T(ADD, "+", 12) \
84 T(SUB, "-", 12) \ 85 T(SUB, "-", 12) \
85 T(MUL, "*", 13) \ 86 T(MUL, "*", 13) \
86 T(DIV, "/", 13) \ 87 T(DIV, "/", 13) \
87 T(MOD, "%", 13) \ 88 T(MOD, "%", 13) \
89 T(EXP, "**", 14) \
88 \ 90 \
89 /* Compare operators sorted by precedence. */ \ 91 /* Compare operators sorted by precedence. */ \
90 /* IsCompareOp() relies on this block of enum values */ \ 92 /* IsCompareOp() relies on this block of enum values */ \
91 /* being contiguous and sorted in the same order! */ \ 93 /* being contiguous and sorted in the same order! */ \
92 T(EQ, "==", 9) \ 94 T(EQ, "==", 9) \
93 T(NE, "!=", 9) \ 95 T(NE, "!=", 9) \
94 T(EQ_STRICT, "===", 9) \ 96 T(EQ_STRICT, "===", 9) \
95 T(NE_STRICT, "!==", 9) \ 97 T(NE_STRICT, "!==", 9) \
96 T(LT, "<", 10) \ 98 T(LT, "<", 10) \
97 T(GT, ">", 10) \ 99 T(GT, ">", 10) \
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 case YIELD: 207 case YIELD:
206 return !is_generator && is_sloppy(language_mode); 208 return !is_generator && is_sloppy(language_mode);
207 default: 209 default:
208 return false; 210 return false;
209 } 211 }
210 UNREACHABLE(); 212 UNREACHABLE();
211 return false; 213 return false;
212 } 214 }
213 215
214 static bool IsAssignmentOp(Value tok) { 216 static bool IsAssignmentOp(Value tok) {
215 return INIT_VAR <= tok && tok <= ASSIGN_MOD; 217 return INIT_VAR <= tok && tok <= ASSIGN_EXP;
216 } 218 }
217 219
218 static bool IsBinaryOp(Value op) { 220 static bool IsBinaryOp(Value op) {
219 return COMMA <= op && op <= MOD; 221 return COMMA <= op && op <= EXP;
220 } 222 }
221 223
222 static bool IsTruncatingBinaryOp(Value op) { 224 static bool IsTruncatingBinaryOp(Value op) {
223 return BIT_OR <= op && op <= ROR; 225 return BIT_OR <= op && op <= ROR;
224 } 226 }
225 227
226 static bool IsCompareOp(Value op) { 228 static bool IsCompareOp(Value op) {
227 return EQ <= op && op <= IN; 229 return EQ <= op && op <= IN;
228 } 230 }
229 231
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
312 private: 314 private:
313 static const char* const name_[NUM_TOKENS]; 315 static const char* const name_[NUM_TOKENS];
314 static const char* const string_[NUM_TOKENS]; 316 static const char* const string_[NUM_TOKENS];
315 static const int8_t precedence_[NUM_TOKENS]; 317 static const int8_t precedence_[NUM_TOKENS];
316 static const char token_type[NUM_TOKENS]; 318 static const char token_type[NUM_TOKENS];
317 }; 319 };
318 320
319 } } // namespace v8::internal 321 } } // namespace v8::internal
320 322
321 #endif // V8_TOKEN_H_ 323 #endif // V8_TOKEN_H_
OLDNEW
« no previous file with comments | « src/scanner.cc ('k') | src/typing.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698