| 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 RUNTIME_VM_SYMBOLS_H_ | 5 #ifndef RUNTIME_VM_SYMBOLS_H_ |
| 6 #define RUNTIME_VM_SYMBOLS_H_ | 6 #define RUNTIME_VM_SYMBOLS_H_ |
| 7 | 7 |
| 8 #include "vm/growable_array.h" | 8 #include "vm/growable_array.h" |
| 9 #include "vm/object.h" | 9 #include "vm/object.h" |
| 10 #include "vm/snapshot_ids.h" | 10 #include "vm/snapshot_ids.h" |
| (...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 223 V(Uint16List, "Uint16List") \ | 223 V(Uint16List, "Uint16List") \ |
| 224 V(Int32List, "Int32List") \ | 224 V(Int32List, "Int32List") \ |
| 225 V(Uint32List, "Uint32List") \ | 225 V(Uint32List, "Uint32List") \ |
| 226 V(Int64List, "Int64List") \ | 226 V(Int64List, "Int64List") \ |
| 227 V(Uint64List, "Uint64List") \ | 227 V(Uint64List, "Uint64List") \ |
| 228 V(Float32x4List, "Float32x4List") \ | 228 V(Float32x4List, "Float32x4List") \ |
| 229 V(Int32x4List, "Int32x4List") \ | 229 V(Int32x4List, "Int32x4List") \ |
| 230 V(Float64x2List, "Float64x2List") \ | 230 V(Float64x2List, "Float64x2List") \ |
| 231 V(Float32List, "Float32List") \ | 231 V(Float32List, "Float32List") \ |
| 232 V(Float64List, "Float64List") \ | 232 V(Float64List, "Float64List") \ |
| 233 V(_Int8ArrayFactory, "Int8List.") \ | 233 V(_Int8ArrayFactory, "Int8List.") \ |
| 234 V(_Uint8ArrayFactory, "Uint8List.") \ | 234 V(_Uint8ArrayFactory, "Uint8List.") \ |
| 235 V(_Uint8ClampedArrayFactory, "Uint8ClampedList.") \ | 235 V(_Uint8ClampedArrayFactory, "Uint8ClampedList.") \ |
| 236 V(_Int16ArrayFactory, "Int16List.") \ | 236 V(_Int16ArrayFactory, "Int16List.") \ |
| 237 V(_Uint16ArrayFactory, "Uint16List.") \ | 237 V(_Uint16ArrayFactory, "Uint16List.") \ |
| 238 V(_Int32ArrayFactory, "Int32List.") \ | 238 V(_Int32ArrayFactory, "Int32List.") \ |
| 239 V(_Uint32ArrayFactory, "Uint32List.") \ | 239 V(_Uint32ArrayFactory, "Uint32List.") \ |
| 240 V(_Int64ArrayFactory, "Int64List.") \ | 240 V(_Int64ArrayFactory, "Int64List.") \ |
| 241 V(_Uint64ArrayFactory, "Uint64List.") \ | 241 V(_Uint64ArrayFactory, "Uint64List.") \ |
| 242 V(_Float32x4ArrayFactory, "Float32x4List.") \ | 242 V(_Float32x4ArrayFactory, "Float32x4List.") \ |
| 243 V(_Int32x4ArrayFactory, "Int32x4List.") \ | 243 V(_Int32x4ArrayFactory, "Int32x4List.") \ |
| 244 V(_Float64x2ArrayFactory, "Float64x2List.") \ | 244 V(_Float64x2ArrayFactory, "Float64x2List.") \ |
| 245 V(_Float32ArrayFactory, "Float32List.") \ | 245 V(_Float32ArrayFactory, "Float32List.") \ |
| 246 V(_Float64ArrayFactory, "Float64List.") \ | 246 V(_Float64ArrayFactory, "Float64List.") \ |
| 247 V(_Int8ArrayView, "_Int8ArrayView") \ | 247 V(_Int8ArrayView, "_Int8ArrayView") \ |
| 248 V(_Uint8ArrayView, "_Uint8ArrayView") \ | 248 V(_Uint8ArrayView, "_Uint8ArrayView") \ |
| 249 V(_Uint8ClampedArrayView, "_Uint8ClampedArrayView") \ | 249 V(_Uint8ClampedArrayView, "_Uint8ClampedArrayView") \ |
| 250 V(_Int16ArrayView, "_Int16ArrayView") \ | 250 V(_Int16ArrayView, "_Int16ArrayView") \ |
| 251 V(_Uint16ArrayView, "_Uint16ArrayView") \ | 251 V(_Uint16ArrayView, "_Uint16ArrayView") \ |
| 252 V(_Int32ArrayView, "_Int32ArrayView") \ | 252 V(_Int32ArrayView, "_Int32ArrayView") \ |
| 253 V(_Uint32ArrayView, "_Uint32ArrayView") \ | 253 V(_Uint32ArrayView, "_Uint32ArrayView") \ |
| 254 V(_Int64ArrayView, "_Int64ArrayView") \ | 254 V(_Int64ArrayView, "_Int64ArrayView") \ |
| 255 V(_Uint64ArrayView, "_Uint64ArrayView") \ | 255 V(_Uint64ArrayView, "_Uint64ArrayView") \ |
| 256 V(_Float32ArrayView, "_Float32ArrayView") \ | 256 V(_Float32ArrayView, "_Float32ArrayView") \ |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 397 V(add, "add") \ | 397 V(add, "add") \ |
| 398 V(ConstructorClosurePrefix, "new#") \ | 398 V(ConstructorClosurePrefix, "new#") \ |
| 399 V(_runExtension, "_runExtension") \ | 399 V(_runExtension, "_runExtension") \ |
| 400 V(_runPendingImmediateCallback, "_runPendingImmediateCallback") \ | 400 V(_runPendingImmediateCallback, "_runPendingImmediateCallback") \ |
| 401 V(DartLibrary, "dart.library.") \ | 401 V(DartLibrary, "dart.library.") \ |
| 402 V(DartLibraryMirrors, "dart.library.mirrors") \ | 402 V(DartLibraryMirrors, "dart.library.mirrors") \ |
| 403 V(_name, "_name") \ | 403 V(_name, "_name") \ |
| 404 V(_classRangeCheck, "_classRangeCheck") \ | 404 V(_classRangeCheck, "_classRangeCheck") \ |
| 405 V(_classRangeCheckNegative, "_classRangeCheckNegative") \ | 405 V(_classRangeCheckNegative, "_classRangeCheckNegative") \ |
| 406 V(GetRuntimeType, "get:runtimeType") \ | 406 V(GetRuntimeType, "get:runtimeType") \ |
| 407 V(HaveSameRuntimeType, "_haveSameRuntimeType") \ | 407 V(HaveSameRuntimeType, "_haveSameRuntimeType") |
| 408 | 408 |
| 409 | 409 |
| 410 // Contains a list of frequently used strings in a canonicalized form. This | 410 // Contains a list of frequently used strings in a canonicalized form. This |
| 411 // list is kept in the vm_isolate in order to share the copy across isolates | 411 // list is kept in the vm_isolate in order to share the copy across isolates |
| 412 // without having to maintain copies in each isolate. | 412 // without having to maintain copies in each isolate. |
| 413 class Symbols : public AllStatic { | 413 class Symbols : public AllStatic { |
| 414 public: | 414 public: |
| 415 enum { kMaxOneCharCodeSymbol = 0xFF }; | 415 enum { kMaxOneCharCodeSymbol = 0xFF }; |
| 416 | 416 |
| 417 // List of strings that are pre created in the vm isolate. | 417 // List of strings that are pre created in the vm isolate. |
| 418 enum SymbolId { | 418 enum SymbolId { |
| 419 // clang-format off |
| 419 kIllegal = 0, | 420 kIllegal = 0, |
| 420 | 421 |
| 421 #define DEFINE_SYMBOL_INDEX(symbol, literal) \ | 422 #define DEFINE_SYMBOL_INDEX(symbol, literal) k##symbol##Id, |
| 422 k##symbol##Id, | |
| 423 PREDEFINED_SYMBOLS_LIST(DEFINE_SYMBOL_INDEX) | 423 PREDEFINED_SYMBOLS_LIST(DEFINE_SYMBOL_INDEX) |
| 424 #undef DEFINE_SYMBOL_INDEX | 424 #undef DEFINE_SYMBOL_INDEX |
| 425 | 425 |
| 426 kTokenTableStart, // First token at kTokenTableStart + 1. | 426 kTokenTableStart, // First token at kTokenTableStart + 1. |
| 427 | 427 |
| 428 #define DEFINE_TOKEN_SYMBOL_INDEX(t, s, p, a) \ | 428 #define DEFINE_TOKEN_SYMBOL_INDEX(t, s, p, a) t##Id, |
| 429 t##Id, | 429 DART_TOKEN_LIST(DEFINE_TOKEN_SYMBOL_INDEX) DART_KEYWORD_LIST( |
| 430 DART_TOKEN_LIST(DEFINE_TOKEN_SYMBOL_INDEX) | 430 DEFINE_TOKEN_SYMBOL_INDEX) |
| 431 DART_KEYWORD_LIST(DEFINE_TOKEN_SYMBOL_INDEX) | |
| 432 #undef DEFINE_TOKEN_SYMBOL_INDEX | 431 #undef DEFINE_TOKEN_SYMBOL_INDEX |
| 433 | 432 |
| 434 kNullCharId, // One char code symbol starts here and takes up 256 entries. | 433 kNullCharId, // One char code symbol starts here and takes up 256 entries. |
| 435 kMaxPredefinedId = kNullCharId + kMaxOneCharCodeSymbol + 1, | 434 kMaxPredefinedId = kNullCharId + kMaxOneCharCodeSymbol + 1, |
| 435 // clang-format on |
| 436 }; | 436 }; |
| 437 | 437 |
| 438 // Number of one character symbols being predefined in the predefined_ array. | 438 // Number of one character symbols being predefined in the predefined_ array. |
| 439 static const int kNumberOfOneCharCodeSymbols = | 439 static const int kNumberOfOneCharCodeSymbols = |
| 440 (kMaxPredefinedId - kNullCharId); | 440 (kMaxPredefinedId - kNullCharId); |
| 441 | 441 |
| 442 // Offset of Null character which is the predefined character symbol. | 442 // Offset of Null character which is the predefined character symbol. |
| 443 static const int kNullCharCodeSymbolOffset = 0; | 443 static const int kNullCharCodeSymbolOffset = 0; |
| 444 | 444 |
| 445 static const String& Symbol(intptr_t index) { | 445 static const String& Symbol(intptr_t index) { |
| 446 ASSERT((index > kIllegal) && (index < kMaxPredefinedId)); | 446 ASSERT((index > kIllegal) && (index < kMaxPredefinedId)); |
| 447 return *(symbol_handles_[index]); | 447 return *(symbol_handles_[index]); |
| 448 } | 448 } |
| 449 | 449 |
| 450 // Access methods for one byte character symbols stored in the vm isolate. | 450 // Access methods for one byte character symbols stored in the vm isolate. |
| 451 static const String& Dot() { | 451 static const String& Dot() { return *(symbol_handles_[kNullCharId + '.']); } |
| 452 return *(symbol_handles_[kNullCharId + '.']); | |
| 453 } | |
| 454 static const String& Equals() { | 452 static const String& Equals() { |
| 455 return *(symbol_handles_[kNullCharId + '=']); | 453 return *(symbol_handles_[kNullCharId + '=']); |
| 456 } | 454 } |
| 457 static const String& Plus() { | 455 static const String& Plus() { return *(symbol_handles_[kNullCharId + '+']); } |
| 458 return *(symbol_handles_[kNullCharId + '+']); | 456 static const String& Minus() { return *(symbol_handles_[kNullCharId + '-']); } |
| 459 } | 457 static const String& BitOr() { return *(symbol_handles_[kNullCharId + '|']); } |
| 460 static const String& Minus() { | |
| 461 return *(symbol_handles_[kNullCharId + '-']); | |
| 462 } | |
| 463 static const String& BitOr() { | |
| 464 return *(symbol_handles_[kNullCharId + '|']); | |
| 465 } | |
| 466 static const String& BitAnd() { | 458 static const String& BitAnd() { |
| 467 return *(symbol_handles_[kNullCharId + '&']); | 459 return *(symbol_handles_[kNullCharId + '&']); |
| 468 } | 460 } |
| 469 static const String& LAngleBracket() { | 461 static const String& LAngleBracket() { |
| 470 return *(symbol_handles_[kNullCharId + '<']); | 462 return *(symbol_handles_[kNullCharId + '<']); |
| 471 } | 463 } |
| 472 static const String& RAngleBracket() { | 464 static const String& RAngleBracket() { |
| 473 return *(symbol_handles_[kNullCharId + '>']); | 465 return *(symbol_handles_[kNullCharId + '>']); |
| 474 } | 466 } |
| 475 static const String& LParen() { | 467 static const String& LParen() { |
| 476 return *(symbol_handles_[kNullCharId + '(']); | 468 return *(symbol_handles_[kNullCharId + '(']); |
| 477 } | 469 } |
| 478 static const String& RParen() { | 470 static const String& RParen() { |
| 479 return *(symbol_handles_[kNullCharId + ')']); | 471 return *(symbol_handles_[kNullCharId + ')']); |
| 480 } | 472 } |
| 481 static const String& LBracket() { | 473 static const String& LBracket() { |
| 482 return *(symbol_handles_[kNullCharId + '[']); | 474 return *(symbol_handles_[kNullCharId + '[']); |
| 483 } | 475 } |
| 484 static const String& RBracket() { | 476 static const String& RBracket() { |
| 485 return *(symbol_handles_[kNullCharId + ']']); | 477 return *(symbol_handles_[kNullCharId + ']']); |
| 486 } | 478 } |
| 487 static const String& LBrace() { | 479 static const String& LBrace() { |
| 488 return *(symbol_handles_[kNullCharId + '{']); | 480 return *(symbol_handles_[kNullCharId + '{']); |
| 489 } | 481 } |
| 490 static const String& RBrace() { | 482 static const String& RBrace() { |
| 491 return *(symbol_handles_[kNullCharId + '}']); | 483 return *(symbol_handles_[kNullCharId + '}']); |
| 492 } | 484 } |
| 493 static const String& Blank() { | 485 static const String& Blank() { return *(symbol_handles_[kNullCharId + ' ']); } |
| 494 return *(symbol_handles_[kNullCharId + ' ']); | |
| 495 } | |
| 496 static const String& Dollar() { | 486 static const String& Dollar() { |
| 497 return *(symbol_handles_[kNullCharId + '$']); | 487 return *(symbol_handles_[kNullCharId + '$']); |
| 498 } | 488 } |
| 499 static const String& NewLine() { | 489 static const String& NewLine() { |
| 500 return *(symbol_handles_[kNullCharId + '\n']); | 490 return *(symbol_handles_[kNullCharId + '\n']); |
| 501 } | 491 } |
| 502 static const String& DoubleQuote() { | 492 static const String& DoubleQuote() { |
| 503 return *(symbol_handles_[kNullCharId + '"']); | 493 return *(symbol_handles_[kNullCharId + '"']); |
| 504 } | 494 } |
| 505 static const String& SingleQuote() { | 495 static const String& SingleQuote() { |
| 506 return *(symbol_handles_[kNullCharId + '\'']); | 496 return *(symbol_handles_[kNullCharId + '\'']); |
| 507 } | 497 } |
| 508 static const String& LowercaseR() { | 498 static const String& LowercaseR() { |
| 509 return *(symbol_handles_[kNullCharId + 'r']); | 499 return *(symbol_handles_[kNullCharId + 'r']); |
| 510 } | 500 } |
| 511 static const String& Dash() { | 501 static const String& Dash() { return *(symbol_handles_[kNullCharId + '-']); } |
| 512 return *(symbol_handles_[kNullCharId + '-']); | |
| 513 } | |
| 514 static const String& Ampersand() { | 502 static const String& Ampersand() { |
| 515 return *(symbol_handles_[kNullCharId + '&']); | 503 return *(symbol_handles_[kNullCharId + '&']); |
| 516 } | 504 } |
| 517 static const String& Backtick() { | 505 static const String& Backtick() { |
| 518 return *(symbol_handles_[kNullCharId + '`']); | 506 return *(symbol_handles_[kNullCharId + '`']); |
| 519 } | 507 } |
| 520 static const String& Slash() { | 508 static const String& Slash() { return *(symbol_handles_[kNullCharId + '/']); } |
| 521 return *(symbol_handles_[kNullCharId + '/']); | 509 static const String& At() { return *(symbol_handles_[kNullCharId + '@']); } |
| 522 } | |
| 523 static const String& At() { | |
| 524 return *(symbol_handles_[kNullCharId + '@']); | |
| 525 } | |
| 526 static const String& HashMark() { | 510 static const String& HashMark() { |
| 527 return *(symbol_handles_[kNullCharId + '#']); | 511 return *(symbol_handles_[kNullCharId + '#']); |
| 528 } | 512 } |
| 529 static const String& Semicolon() { | 513 static const String& Semicolon() { |
| 530 return *(symbol_handles_[kNullCharId + ';']); | 514 return *(symbol_handles_[kNullCharId + ';']); |
| 531 } | 515 } |
| 532 static const String& Star() { | 516 static const String& Star() { return *(symbol_handles_[kNullCharId + '*']); } |
| 533 return *(symbol_handles_[kNullCharId + '*']); | |
| 534 } | |
| 535 static const String& Percent() { | 517 static const String& Percent() { |
| 536 return *(symbol_handles_[kNullCharId + '%']); | 518 return *(symbol_handles_[kNullCharId + '%']); |
| 537 } | 519 } |
| 538 static const String& Caret() { | 520 static const String& Caret() { return *(symbol_handles_[kNullCharId + '^']); } |
| 539 return *(symbol_handles_[kNullCharId + '^']); | 521 static const String& Tilde() { return *(symbol_handles_[kNullCharId + '~']); } |
| 540 } | |
| 541 static const String& Tilde() { | |
| 542 return *(symbol_handles_[kNullCharId + '~']); | |
| 543 } | |
| 544 | 522 |
| 545 static const String& Empty() { return *(symbol_handles_[kTokenTableStart]); } | 523 static const String& Empty() { return *(symbol_handles_[kTokenTableStart]); } |
| 546 static const String& False() { return *(symbol_handles_[kFALSEId]); } | 524 static const String& False() { return *(symbol_handles_[kFALSEId]); } |
| 547 static const String& Library() { return *(symbol_handles_[kLIBRARYId]); } | 525 static const String& Library() { return *(symbol_handles_[kLIBRARYId]); } |
| 548 static const String& Super() { return *(symbol_handles_[kSUPERId]); } | 526 static const String& Super() { return *(symbol_handles_[kSUPERId]); } |
| 549 static const String& This() { return *(symbol_handles_[kTHISId]); } | 527 static const String& This() { return *(symbol_handles_[kTHISId]); } |
| 550 static const String& True() { return *(symbol_handles_[kTRUEId]); } | 528 static const String& True() { return *(symbol_handles_[kTRUEId]); } |
| 551 static const String& Void() { return *(symbol_handles_[kVOIDId]); } | 529 static const String& Void() { return *(symbol_handles_[kVOIDId]); } |
| 552 | 530 |
| 553 // Access methods for symbol handles stored in the vm isolate for predefined | 531 // Access methods for symbol handles stored in the vm isolate for predefined |
| 554 // symbols. | 532 // symbols. |
| 555 #define DEFINE_SYMBOL_HANDLE_ACCESSOR(symbol, literal) \ | 533 #define DEFINE_SYMBOL_HANDLE_ACCESSOR(symbol, literal) \ |
| 556 static const String& symbol() { return *(symbol_handles_[k##symbol##Id]); } | 534 static const String& symbol() { return *(symbol_handles_[k##symbol##Id]); } |
| 557 PREDEFINED_SYMBOLS_LIST(DEFINE_SYMBOL_HANDLE_ACCESSOR) | 535 PREDEFINED_SYMBOLS_LIST(DEFINE_SYMBOL_HANDLE_ACCESSOR) |
| 558 #undef DEFINE_SYMBOL_HANDLE_ACCESSOR | 536 #undef DEFINE_SYMBOL_HANDLE_ACCESSOR |
| 559 | 537 |
| 560 // Access methods for symbol handles stored in the vm isolate for keywords. | 538 // Access methods for symbol handles stored in the vm isolate for keywords. |
| 561 #define DEFINE_SYMBOL_HANDLE_ACCESSOR(t, s, p, a) \ | 539 #define DEFINE_SYMBOL_HANDLE_ACCESSOR(t, s, p, a) \ |
| 562 static const String& t() { return *(symbol_handles_[t##Id]); } | 540 static const String& t() { return *(symbol_handles_[t##Id]); } |
| 563 DART_TOKEN_LIST(DEFINE_SYMBOL_HANDLE_ACCESSOR) | 541 DART_TOKEN_LIST(DEFINE_SYMBOL_HANDLE_ACCESSOR) |
| 564 DART_KEYWORD_LIST(DEFINE_SYMBOL_HANDLE_ACCESSOR) | 542 DART_KEYWORD_LIST(DEFINE_SYMBOL_HANDLE_ACCESSOR) |
| 565 #undef DEFINE_SYMBOL_HANDLE_ACCESSOR | 543 #undef DEFINE_SYMBOL_HANDLE_ACCESSOR |
| 566 | 544 |
| 567 // Get symbol for scanner token. | 545 // Get symbol for scanner token. |
| 568 static const String& Token(Token::Kind token); | 546 static const String& Token(Token::Kind token); |
| 569 | 547 |
| 570 // Initialize frequently used symbols in the vm isolate. | 548 // Initialize frequently used symbols in the vm isolate. |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 618 static RawString* NewFormatted(Thread* thread, const char* format, ...) | 596 static RawString* NewFormatted(Thread* thread, const char* format, ...) |
| 619 PRINTF_ATTRIBUTE(2, 3); | 597 PRINTF_ATTRIBUTE(2, 3); |
| 620 static RawString* NewFormattedV(Thread* thread, | 598 static RawString* NewFormattedV(Thread* thread, |
| 621 const char* format, | 599 const char* format, |
| 622 va_list args); | 600 va_list args); |
| 623 | 601 |
| 624 static RawString* FromConcat(Thread* thread, | 602 static RawString* FromConcat(Thread* thread, |
| 625 const String& str1, | 603 const String& str1, |
| 626 const String& str2); | 604 const String& str2); |
| 627 | 605 |
| 628 static RawString* FromConcatAll(Thread* thread, | 606 static RawString* FromConcatAll( |
| 607 Thread* thread, |
| 629 const GrowableHandlePtrArray<const String>& strs); | 608 const GrowableHandlePtrArray<const String>& strs); |
| 630 | 609 |
| 631 static RawString* FromGet(Thread* thread, const String& str); | 610 static RawString* FromGet(Thread* thread, const String& str); |
| 632 static RawString* FromSet(Thread* thread, const String& str); | 611 static RawString* FromSet(Thread* thread, const String& str); |
| 633 static RawString* FromDot(Thread* thread, const String& str); | 612 static RawString* FromDot(Thread* thread, const String& str); |
| 634 | 613 |
| 635 // Returns char* of predefined symbol. | 614 // Returns char* of predefined symbol. |
| 636 static const char* Name(SymbolId symbol); | 615 static const char* Name(SymbolId symbol); |
| 637 | 616 |
| 638 static RawString* FromCharCode(Thread* thread, int32_t char_code); | 617 static RawString* FromCharCode(Thread* thread, int32_t char_code); |
| 639 | 618 |
| 640 static RawString** PredefinedAddress() { | 619 static RawString** PredefinedAddress() { |
| 641 return reinterpret_cast<RawString**>(&predefined_); | 620 return reinterpret_cast<RawString**>(&predefined_); |
| 642 } | 621 } |
| 643 | 622 |
| 644 static void DumpStats(); | 623 static void DumpStats(); |
| 645 | 624 |
| 646 // Returns Symbol::Null if no symbol is found. | 625 // Returns Symbol::Null if no symbol is found. |
| 647 template<typename StringType> | 626 template <typename StringType> |
| 648 static RawString* Lookup(Thread* thread, const StringType& str); | 627 static RawString* Lookup(Thread* thread, const StringType& str); |
| 649 | 628 |
| 650 // Returns Symbol::Null if no symbol is found. | 629 // Returns Symbol::Null if no symbol is found. |
| 651 static RawString* LookupFromConcat(Thread* thread, | 630 static RawString* LookupFromConcat(Thread* thread, |
| 652 const String& str1, | 631 const String& str1, |
| 653 const String& str2); | 632 const String& str2); |
| 654 | 633 |
| 655 static RawString* LookupFromGet(Thread* thread, const String& str); | 634 static RawString* LookupFromGet(Thread* thread, const String& str); |
| 656 static RawString* LookupFromSet(Thread* thread, const String& str); | 635 static RawString* LookupFromSet(Thread* thread, const String& str); |
| 657 static RawString* LookupFromDot(Thread* thread, const String& str); | 636 static RawString* LookupFromDot(Thread* thread, const String& str); |
| 658 | 637 |
| 659 static void GetStats(Isolate* isolate, | 638 static void GetStats(Isolate* isolate, intptr_t* size, intptr_t* capacity); |
| 660 intptr_t* size, | |
| 661 intptr_t* capacity); | |
| 662 | 639 |
| 663 private: | 640 private: |
| 664 enum { | 641 enum { kInitialVMIsolateSymtabSize = 1024, kInitialSymtabSize = 2048 }; |
| 665 kInitialVMIsolateSymtabSize = 1024, | |
| 666 kInitialSymtabSize = 2048 | |
| 667 }; | |
| 668 | 642 |
| 669 template<typename StringType> | 643 template <typename StringType> |
| 670 static RawString* NewSymbol(Thread* thread, const StringType& str); | 644 static RawString* NewSymbol(Thread* thread, const StringType& str); |
| 671 | 645 |
| 672 static intptr_t LookupPredefinedSymbol(RawObject* obj); | 646 static intptr_t LookupPredefinedSymbol(RawObject* obj); |
| 673 static RawObject* GetPredefinedSymbol(intptr_t object_id); | 647 static RawObject* GetPredefinedSymbol(intptr_t object_id); |
| 674 static bool IsPredefinedSymbolId(intptr_t object_id) { | 648 static bool IsPredefinedSymbolId(intptr_t object_id) { |
| 675 return (object_id >= kMaxPredefinedObjectIds && | 649 return (object_id >= kMaxPredefinedObjectIds && |
| 676 object_id < (kMaxPredefinedObjectIds + kMaxPredefinedId)); | 650 object_id < (kMaxPredefinedObjectIds + kMaxPredefinedId)); |
| 677 } | 651 } |
| 678 | 652 |
| 679 // List of Latin1 characters stored in the vm isolate as symbols | 653 // List of Latin1 characters stored in the vm isolate as symbols |
| (...skipping 11 matching lines...) Expand all Loading... |
| 691 friend class Serializer; | 665 friend class Serializer; |
| 692 friend class Deserializer; | 666 friend class Deserializer; |
| 693 friend class ApiMessageReader; | 667 friend class ApiMessageReader; |
| 694 | 668 |
| 695 DISALLOW_COPY_AND_ASSIGN(Symbols); | 669 DISALLOW_COPY_AND_ASSIGN(Symbols); |
| 696 }; | 670 }; |
| 697 | 671 |
| 698 } // namespace dart | 672 } // namespace dart |
| 699 | 673 |
| 700 #endif // RUNTIME_VM_SYMBOLS_H_ | 674 #endif // RUNTIME_VM_SYMBOLS_H_ |
| OLD | NEW |