| Index: runtime/vm/symbols.cc
|
| ===================================================================
|
| --- runtime/vm/symbols.cc (revision 14980)
|
| +++ runtime/vm/symbols.cc (working copy)
|
| @@ -26,8 +26,8 @@
|
| };
|
|
|
|
|
| -const char* Symbols::Name(intptr_t symbol) {
|
| - ASSERT((symbol > kIllegal) && (symbol < kMaxId));
|
| +const char* Symbols::Name(SymbolId symbol) {
|
| + ASSERT((symbol > kIllegal) && (symbol < kMaxPredefinedId));
|
| return names[symbol];
|
| }
|
|
|
| @@ -40,12 +40,12 @@
|
| SetupSymbolTable(isolate);
|
|
|
| // Create all predefined symbols.
|
| - ASSERT((sizeof(names) / sizeof(const char*)) == Symbols::kMaxId);
|
| + ASSERT((sizeof(names) / sizeof(const char*)) == Symbols::kMaxPredefinedId);
|
| ObjectStore* object_store = isolate->object_store();
|
| Array& symbol_table = Array::Handle();
|
| dart::String& str = String::Handle();
|
|
|
| - for (intptr_t i = 1; i < Symbols::kMaxId; i++) {
|
| + for (intptr_t i = 1; i < Symbols::kMaxPredefinedId; i++) {
|
| // The symbol_table needs to be reloaded as it might have grown in the
|
| // previous iteration.
|
| symbol_table = object_store->symbol_table();
|
| @@ -54,6 +54,11 @@
|
| predefined_[i] = str.raw();
|
| }
|
| Object::RegisterSingletonClassNames();
|
| +
|
| + for (uint32_t c = 0; c <= kMaxOneByteCharCode; c++) {
|
| + ASSERT(kMaxPredefinedId + c < kMaxId);
|
| + predefined_[kMaxPredefinedId + c] = New(&c, 1);
|
| + }
|
| }
|
|
|
|
|
| @@ -117,7 +122,6 @@
|
| template<typename T>
|
| RawString* Symbols::New(const T* characters, intptr_t len) {
|
| Isolate* isolate = Isolate::Current();
|
| - ASSERT(isolate != Dart::vm_isolate());
|
| String& symbol = String::Handle(isolate, String::null());
|
| Array& symbol_table = Array::Handle(isolate, Array::null());
|
|
|
| @@ -200,6 +204,14 @@
|
| }
|
|
|
|
|
| +RawString* Symbols::FromCharCode(uint32_t char_code) {
|
| + if (char_code > kMaxOneByteCharCode) {
|
| + return New(&char_code, 1);
|
| + }
|
| + return predefined_[kNullCharId + char_code];
|
| +}
|
| +
|
| +
|
| void Symbols::GrowSymbolTable(const Array& symbol_table) {
|
| // TODO(iposva): Avoid exponential growth.
|
| intptr_t table_size = symbol_table.Length() - 1;
|
|
|