OLD | NEW |
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_SYMBOLS_H_ | 5 #ifndef VM_SYMBOLS_H_ |
6 #define VM_SYMBOLS_H_ | 6 #define VM_SYMBOLS_H_ |
7 | 7 |
8 #include "vm/object.h" | 8 #include "vm/object.h" |
9 #include "vm/snapshot_ids.h" | 9 #include "vm/snapshot_ids.h" |
10 | 10 |
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
308 | 308 |
309 // List of strings that are pre created in the vm isolate. | 309 // List of strings that are pre created in the vm isolate. |
310 enum SymbolId { | 310 enum SymbolId { |
311 kIllegal = 0, | 311 kIllegal = 0, |
312 | 312 |
313 #define DEFINE_SYMBOL_INDEX(symbol, literal) \ | 313 #define DEFINE_SYMBOL_INDEX(symbol, literal) \ |
314 k##symbol##Id, | 314 k##symbol##Id, |
315 PREDEFINED_SYMBOLS_LIST(DEFINE_SYMBOL_INDEX) | 315 PREDEFINED_SYMBOLS_LIST(DEFINE_SYMBOL_INDEX) |
316 #undef DEFINE_SYMBOL_INDEX | 316 #undef DEFINE_SYMBOL_INDEX |
317 | 317 |
| 318 kKwTableStart, // First keyword at kKwTableStart + 1. |
| 319 |
| 320 #define DEFINE_KEYWORD_SYMBOL_INDEX(token, chars, ignore1, ignore2) \ |
| 321 token##Id, |
| 322 DART_KEYWORD_LIST(DEFINE_KEYWORD_SYMBOL_INDEX) |
| 323 #undef DEFINE_KEYWORD_SYMBOL_INDEX |
| 324 |
318 kNullCharId, // One char code symbol starts here and takes up 256 entries. | 325 kNullCharId, // One char code symbol starts here and takes up 256 entries. |
319 kMaxPredefinedId = kNullCharId + kMaxOneCharCodeSymbol + 1, | 326 kMaxPredefinedId = kNullCharId + kMaxOneCharCodeSymbol + 1, |
320 }; | 327 }; |
321 | 328 |
322 // Number of one character symbols being predefined in the predefined_ array. | 329 // Number of one character symbols being predefined in the predefined_ array. |
323 static const int kNumberOfOneCharCodeSymbols = | 330 static const int kNumberOfOneCharCodeSymbols = |
324 (kMaxPredefinedId - kNullCharId); | 331 (kMaxPredefinedId - kNullCharId); |
325 | 332 |
326 // Offset of Null character which is the predefined character symbol. | 333 // Offset of Null character which is the predefined character symbol. |
327 static const int kNullCharCodeSymbolOffset = 0; | 334 static const int kNullCharCodeSymbolOffset = 0; |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
390 static const String& Semicolon() { | 397 static const String& Semicolon() { |
391 return *(symbol_handles_[kNullCharId + ';']); | 398 return *(symbol_handles_[kNullCharId + ';']); |
392 } | 399 } |
393 | 400 |
394 // Access methods for symbol handles stored in the vm isolate. | 401 // Access methods for symbol handles stored in the vm isolate. |
395 #define DEFINE_SYMBOL_HANDLE_ACCESSOR(symbol, literal) \ | 402 #define DEFINE_SYMBOL_HANDLE_ACCESSOR(symbol, literal) \ |
396 static const String& symbol() { return *(symbol_handles_[k##symbol##Id]); } | 403 static const String& symbol() { return *(symbol_handles_[k##symbol##Id]); } |
397 PREDEFINED_SYMBOLS_LIST(DEFINE_SYMBOL_HANDLE_ACCESSOR) | 404 PREDEFINED_SYMBOLS_LIST(DEFINE_SYMBOL_HANDLE_ACCESSOR) |
398 #undef DEFINE_SYMBOL_HANDLE_ACCESSOR | 405 #undef DEFINE_SYMBOL_HANDLE_ACCESSOR |
399 | 406 |
| 407 // Get symbol for scanner keyword. |
| 408 static const String& Keyword(Token::Kind keyword); |
| 409 |
400 // Initialize frequently used symbols in the vm isolate. | 410 // Initialize frequently used symbols in the vm isolate. |
401 static void InitOnce(Isolate* isolate); | 411 static void InitOnce(Isolate* isolate); |
402 | 412 |
403 // Initialize and setup a symbol table for the isolate. | 413 // Initialize and setup a symbol table for the isolate. |
404 static void SetupSymbolTable(Isolate* isolate); | 414 static void SetupSymbolTable(Isolate* isolate); |
405 | 415 |
406 // Get number of symbols in an isolate's symbol table. | 416 // Get number of symbols in an isolate's symbol table. |
407 static intptr_t Size(Isolate* isolate); | 417 static intptr_t Size(Isolate* isolate); |
408 | 418 |
409 // Creates a Symbol given a C string that is assumed to contain | 419 // Creates a Symbol given a C string that is assumed to contain |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
498 friend class SnapshotReader; | 508 friend class SnapshotReader; |
499 friend class SnapshotWriter; | 509 friend class SnapshotWriter; |
500 friend class ApiMessageReader; | 510 friend class ApiMessageReader; |
501 | 511 |
502 DISALLOW_COPY_AND_ASSIGN(Symbols); | 512 DISALLOW_COPY_AND_ASSIGN(Symbols); |
503 }; | 513 }; |
504 | 514 |
505 } // namespace dart | 515 } // namespace dart |
506 | 516 |
507 #endif // VM_SYMBOLS_H_ | 517 #endif // VM_SYMBOLS_H_ |
OLD | NEW |