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 #include "vm/symbols.h" | 5 #include "vm/symbols.h" |
6 | 6 |
7 #include "vm/handles.h" | 7 #include "vm/handles.h" |
8 #include "vm/handles_impl.h" | 8 #include "vm/handles_impl.h" |
9 #include "vm/hash_table.h" | 9 #include "vm/hash_table.h" |
10 #include "vm/isolate.h" | 10 #include "vm/isolate.h" |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 // Create all predefined symbols. | 65 // Create all predefined symbols. |
66 ASSERT((sizeof(names) / sizeof(const char*)) == Symbols::kNullCharId); | 66 ASSERT((sizeof(names) / sizeof(const char*)) == Symbols::kNullCharId); |
67 | 67 |
68 // First set up all the predefined string symbols. | 68 // First set up all the predefined string symbols. |
69 for (intptr_t i = 1; i < Symbols::kKwTableStart; i++) { | 69 for (intptr_t i = 1; i < Symbols::kKwTableStart; i++) { |
70 String* str = String::ReadOnlyHandle(); | 70 String* str = String::ReadOnlyHandle(); |
71 *str = OneByteString::New(names[i], Heap::kOld); | 71 *str = OneByteString::New(names[i], Heap::kOld); |
72 AddToVMIsolate(*str); | 72 AddToVMIsolate(*str); |
73 symbol_handles_[i] = str; | 73 symbol_handles_[i] = str; |
74 } | 74 } |
75 Object::RegisterSingletonClassNames(); | |
76 | 75 |
77 // Create symbols for language keywords. Some keywords are equal to | 76 // Create symbols for language keywords. Some keywords are equal to |
78 // symbols we already created, so use New() instead of Add() to ensure | 77 // symbols we already created, so use New() instead of Add() to ensure |
79 // that the symbols are canonicalized. | 78 // that the symbols are canonicalized. |
80 for (intptr_t i = Symbols::kKwTableStart; i < Symbols::kNullCharId; i++) { | 79 for (intptr_t i = Symbols::kKwTableStart; i < Symbols::kNullCharId; i++) { |
81 String* str = String::ReadOnlyHandle(); | 80 String* str = String::ReadOnlyHandle(); |
82 *str = New(names[i]); | 81 *str = New(names[i]); |
83 symbol_handles_[i] = str; | 82 symbol_handles_[i] = str; |
84 } | 83 } |
85 | 84 |
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
390 RawObject* Symbols::GetVMSymbol(intptr_t object_id) { | 389 RawObject* Symbols::GetVMSymbol(intptr_t object_id) { |
391 ASSERT(IsVMSymbolId(object_id)); | 390 ASSERT(IsVMSymbolId(object_id)); |
392 intptr_t i = (object_id - kMaxPredefinedObjectIds); | 391 intptr_t i = (object_id - kMaxPredefinedObjectIds); |
393 if ((i > kIllegal) && (i < Symbols::kMaxPredefinedId)) { | 392 if ((i > kIllegal) && (i < Symbols::kMaxPredefinedId)) { |
394 return symbol_handles_[i]->raw(); | 393 return symbol_handles_[i]->raw(); |
395 } | 394 } |
396 return Object::null(); | 395 return Object::null(); |
397 } | 396 } |
398 | 397 |
399 } // namespace dart | 398 } // namespace dart |
OLD | NEW |