| 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/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 537 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 548 DART_KEYWORD_LIST(DEFINE_SYMBOL_HANDLE_ACCESSOR) | 548 DART_KEYWORD_LIST(DEFINE_SYMBOL_HANDLE_ACCESSOR) |
| 549 #undef DEFINE_SYMBOL_HANDLE_ACCESSOR | 549 #undef DEFINE_SYMBOL_HANDLE_ACCESSOR |
| 550 | 550 |
| 551 // Get symbol for scanner token. | 551 // Get symbol for scanner token. |
| 552 static const String& Token(Token::Kind token); | 552 static const String& Token(Token::Kind token); |
| 553 | 553 |
| 554 // Initialize frequently used symbols in the vm isolate. | 554 // Initialize frequently used symbols in the vm isolate. |
| 555 static void InitOnce(Isolate* isolate); | 555 static void InitOnce(Isolate* isolate); |
| 556 static void InitOnceFromSnapshot(Isolate* isolate); | 556 static void InitOnceFromSnapshot(Isolate* isolate); |
| 557 | 557 |
| 558 // Add all the symbols that were cached in the VM isolate to this isolate, | |
| 559 // we do this when an Isolate is not created from the snapshot so that | |
| 560 // we get a unified symbol table that can be be dumped into the VM isolate | |
| 561 // snapshot. | |
| 562 static void AddPredefinedSymbolsToIsolate(); | |
| 563 | |
| 564 // Initialize and setup a symbol table for the isolate. | 558 // Initialize and setup a symbol table for the isolate. |
| 565 static void SetupSymbolTable(Isolate* isolate); | 559 static void SetupSymbolTable(Isolate* isolate); |
| 566 | 560 |
| 561 static RawArray* UnifiedSymbolTable(); |
| 562 |
| 563 #if defined(DART_PRECOMPILER) |
| 567 // Treat the symbol table as weak and collect garbage. Answer the number of | 564 // Treat the symbol table as weak and collect garbage. Answer the number of |
| 568 // symbols deleted from the symbol table because they where not referenced | 565 // symbols deleted from the symbol table because they where not referenced |
| 569 // from anywhere else. | 566 // from anywhere else. |
| 570 static intptr_t Compact(Isolate* isolate); | 567 static intptr_t Compact(Isolate* isolate); |
| 568 #endif |
| 571 | 569 |
| 572 // Creates a Symbol given a C string that is assumed to contain | 570 // Creates a Symbol given a C string that is assumed to contain |
| 573 // UTF-8 encoded characters and '\0' is considered a termination character. | 571 // UTF-8 encoded characters and '\0' is considered a termination character. |
| 574 // TODO(7123) - Rename this to FromCString(....). | 572 // TODO(7123) - Rename this to FromCString(....). |
| 575 static RawString* New(Thread* thread, const char* cstr) { | 573 static RawString* New(Thread* thread, const char* cstr) { |
| 576 return New(thread, cstr, strlen(cstr)); | 574 return New(thread, cstr, strlen(cstr)); |
| 577 } | 575 } |
| 578 static RawString* New(Thread* thread, const char* cstr, intptr_t length); | 576 static RawString* New(Thread* thread, const char* cstr, intptr_t length); |
| 579 | 577 |
| 580 // Creates a new Symbol from an array of UTF-8 encoded characters. | 578 // Creates a new Symbol from an array of UTF-8 encoded characters. |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 677 friend class SnapshotReader; | 675 friend class SnapshotReader; |
| 678 friend class SnapshotWriter; | 676 friend class SnapshotWriter; |
| 679 friend class ApiMessageReader; | 677 friend class ApiMessageReader; |
| 680 | 678 |
| 681 DISALLOW_COPY_AND_ASSIGN(Symbols); | 679 DISALLOW_COPY_AND_ASSIGN(Symbols); |
| 682 }; | 680 }; |
| 683 | 681 |
| 684 } // namespace dart | 682 } // namespace dart |
| 685 | 683 |
| 686 #endif // VM_SYMBOLS_H_ | 684 #endif // VM_SYMBOLS_H_ |
| OLD | NEW |