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

Side by Side Diff: runtime/vm/token.h

Issue 68663003: Merge TRUNCDIV and MOD into TRUNCDIV_MOD single operation. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 1 month 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
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #ifndef VM_TOKEN_H_ 5 #ifndef VM_TOKEN_H_
6 #define VM_TOKEN_H_ 6 #define VM_TOKEN_H_
7 7
8 #include "platform/assert.h" 8 #include "platform/assert.h"
9 9
10 namespace dart { 10 namespace dart {
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 \ 126 \
127 TOK(kNEWLINE, "\n", 0, kNoAttribute) \ 127 TOK(kNEWLINE, "\n", 0, kNoAttribute) \
128 TOK(kWHITESP, "", 0, kNoAttribute) \ 128 TOK(kWHITESP, "", 0, kNoAttribute) \
129 TOK(kERROR, "", 0, kNoAttribute) \ 129 TOK(kERROR, "", 0, kNoAttribute) \
130 TOK(kILLEGAL, "", 0, kNoAttribute) \ 130 TOK(kILLEGAL, "", 0, kNoAttribute) \
131 \ 131 \
132 /* Support for Dart scripts. */ \ 132 /* Support for Dart scripts. */ \
133 TOK(kSCRIPTTAG, "#!", 0, kNoAttribute) \ 133 TOK(kSCRIPTTAG, "#!", 0, kNoAttribute) \
134 \ 134 \
135 /* Support for optimized code */ \ 135 /* Support for optimized code */ \
136 TOK(kREM, "", 0, kNoAttribute) \ 136 TOK(kREM, "", 0, kNoAttribute) \
137 TOK(kTRUNCDIVMOD, "", 0, kNoAttribute) \
138 TOK(kTRUNCDIVREM, "", 0, kNoAttribute) \
137 139
138 // List of keywords. The list must be alphabetically ordered. The 140 // List of keywords. The list must be alphabetically ordered. The
139 // keyword recognition code depends on the ordering. 141 // keyword recognition code depends on the ordering.
140 // If you add a keyword at the beginning or end of this list, make sure 142 // If you add a keyword at the beginning or end of this list, make sure
141 // to update kFirstKeyword and kLastKeyword below. 143 // to update kFirstKeyword and kLastKeyword below.
142 #define DART_KEYWORD_LIST(KW) \ 144 #define DART_KEYWORD_LIST(KW) \
143 KW(kABSTRACT, "abstract", 0, kPseudoKeyword) /* == kFirstKeyword */ \ 145 KW(kABSTRACT, "abstract", 0, kPseudoKeyword) /* == kFirstKeyword */ \
144 KW(kAS, "as", 10, kPseudoKeyword) \ 146 KW(kAS, "as", 10, kPseudoKeyword) \
145 KW(kASSERT, "assert", 10, kKeyword) \ 147 KW(kASSERT, "assert", 10, kKeyword) \
146 KW(kBREAK, "break", 0, kKeyword) \ 148 KW(kBREAK, "break", 0, kKeyword) \
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 return (tok == kIDENT) || IsPseudoKeyword(tok); 252 return (tok == kIDENT) || IsPseudoKeyword(tok);
251 } 253 }
252 254
253 static const char* Name(Kind tok) { 255 static const char* Name(Kind tok) {
254 ASSERT(tok < kNumTokens); 256 ASSERT(tok < kNumTokens);
255 return name_[tok]; 257 return name_[tok];
256 } 258 }
257 259
258 static const char* Str(Kind tok) { 260 static const char* Str(Kind tok) {
259 ASSERT(tok < kNumTokens); 261 ASSERT(tok < kNumTokens);
260 return tok_str_[tok]; 262 switch (tok) {
263 case Token::kREM: return "REM";
264 case Token::kTRUNCDIVMOD: return "TRUNCDIVMOD";
265 case Token::kTRUNCDIVREM: return "TRUNCDIVREM";
266 default: return tok_str_[tok];
267 }
261 } 268 }
262 269
263 static int Precedence(Kind tok) { 270 static int Precedence(Kind tok) {
264 ASSERT(tok < kNumTokens); 271 ASSERT(tok < kNumTokens);
265 return precedence_[tok]; 272 return precedence_[tok];
266 } 273 }
267 274
268 static Attribute Attributes(Kind tok) { 275 static Attribute Attributes(Kind tok) {
269 ASSERT(tok < kNumTokens); 276 ASSERT(tok < kNumTokens);
270 return attributes_[tok]; 277 return attributes_[tok];
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
314 static const char* name_[]; 321 static const char* name_[];
315 static const char* tok_str_[]; 322 static const char* tok_str_[];
316 static const uint8_t precedence_[]; 323 static const uint8_t precedence_[];
317 static const Attribute attributes_[]; 324 static const Attribute attributes_[];
318 }; 325 };
319 326
320 327
321 } // namespace dart 328 } // namespace dart
322 329
323 #endif // VM_TOKEN_H_ 330 #endif // VM_TOKEN_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698