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

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

Issue 1123813002: Move symbol table from per isolate snapshot to vm isolate snapshot, this reduces the per isolate in… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 5 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « runtime/vm/snapshot_test.cc ('k') | runtime/vm/symbols.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 (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 519 matching lines...) Expand 10 before | Expand all | Expand 10 after
530 #define DEFINE_SYMBOL_HANDLE_ACCESSOR(t, s, p, a) \ 530 #define DEFINE_SYMBOL_HANDLE_ACCESSOR(t, s, p, a) \
531 static const String& t() { return *(symbol_handles_[t##Id]); } 531 static const String& t() { return *(symbol_handles_[t##Id]); }
532 DART_KEYWORD_LIST(DEFINE_SYMBOL_HANDLE_ACCESSOR) 532 DART_KEYWORD_LIST(DEFINE_SYMBOL_HANDLE_ACCESSOR)
533 #undef DEFINE_SYMBOL_HANDLE_ACCESSOR 533 #undef DEFINE_SYMBOL_HANDLE_ACCESSOR
534 534
535 // Get symbol for scanner keyword. 535 // Get symbol for scanner keyword.
536 static const String& Keyword(Token::Kind keyword); 536 static const String& Keyword(Token::Kind keyword);
537 537
538 // Initialize frequently used symbols in the vm isolate. 538 // Initialize frequently used symbols in the vm isolate.
539 static void InitOnce(Isolate* isolate); 539 static void InitOnce(Isolate* isolate);
540 static void InitOnceFromSnapshot(Isolate* isolate);
541
542 // Add all the symbols that were cached in the VM isolate to this isolate,
543 // we do this when an Isolate is not created from the snapshot so that
544 // we get a unified symbol table that can be be dumped into the VM isolate
545 // snapshot.
546 static void AddPredefinedSymbolsToIsolate();
540 547
541 // Initialize and setup a symbol table for the isolate. 548 // Initialize and setup a symbol table for the isolate.
542 static void SetupSymbolTable(Isolate* isolate); 549 static void SetupSymbolTable(Isolate* isolate);
543 550
544 // Creates a Symbol given a C string that is assumed to contain 551 // Creates a Symbol given a C string that is assumed to contain
545 // UTF-8 encoded characters and '\0' is considered a termination character. 552 // UTF-8 encoded characters and '\0' is considered a termination character.
546 // TODO(7123) - Rename this to FromCString(....). 553 // TODO(7123) - Rename this to FromCString(....).
547 static RawString* New(const char* cstr) { 554 static RawString* New(const char* cstr) {
548 return New(cstr, strlen(cstr)); 555 return New(cstr, strlen(cstr));
549 } 556 }
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
585 kInitialSymtabSize = 2048 592 kInitialSymtabSize = 2048
586 }; 593 };
587 594
588 static void GetStats(Isolate* isolate, 595 static void GetStats(Isolate* isolate,
589 intptr_t* size, 596 intptr_t* size,
590 intptr_t* capacity); 597 intptr_t* capacity);
591 598
592 template<typename StringType> 599 template<typename StringType>
593 static RawString* NewSymbol(const StringType& str); 600 static RawString* NewSymbol(const StringType& str);
594 601
595 // Add the string into the VM isolate symbol table.
596 static void AddToVMIsolate(const String& str);
597
598 static intptr_t LookupVMSymbol(RawObject* obj); 602 static intptr_t LookupVMSymbol(RawObject* obj);
599 static RawObject* GetVMSymbol(intptr_t object_id); 603 static RawObject* GetVMSymbol(intptr_t object_id);
600 static bool IsVMSymbolId(intptr_t object_id) { 604 static bool IsVMSymbolId(intptr_t object_id) {
601 return (object_id >= kMaxPredefinedObjectIds && 605 return (object_id >= kMaxPredefinedObjectIds &&
602 object_id < (kMaxPredefinedObjectIds + kMaxPredefinedId)); 606 object_id < (kMaxPredefinedObjectIds + kMaxPredefinedId));
603 } 607 }
604 608
605 // List of Latin1 characters stored in the vm isolate as symbols 609 // List of Latin1 characters stored in the vm isolate as symbols
606 // in order to make Symbols::FromCharCode fast. This structure is 610 // in order to make Symbols::FromCharCode fast. This structure is
607 // used in generated dart code for direct access to these objects. 611 // used in generated dart code for direct access to these objects.
608 static RawString* predefined_[kNumberOfOneCharCodeSymbols]; 612 static RawString* predefined_[kNumberOfOneCharCodeSymbols];
609 613
610 // List of handles for predefined symbols. 614 // List of handles for predefined symbols.
611 static String* symbol_handles_[kMaxPredefinedId]; 615 static String* symbol_handles_[kMaxPredefinedId];
612 616
617 friend class Dart;
613 friend class String; 618 friend class String;
614 friend class SnapshotReader; 619 friend class SnapshotReader;
615 friend class SnapshotWriter; 620 friend class SnapshotWriter;
616 friend class ApiMessageReader; 621 friend class ApiMessageReader;
617 622
618 DISALLOW_COPY_AND_ASSIGN(Symbols); 623 DISALLOW_COPY_AND_ASSIGN(Symbols);
619 }; 624 };
620 625
621 } // namespace dart 626 } // namespace dart
622 627
623 #endif // VM_SYMBOLS_H_ 628 #endif // VM_SYMBOLS_H_
OLDNEW
« no previous file with comments | « runtime/vm/snapshot_test.cc ('k') | runtime/vm/symbols.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698