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/isolate.h" | 9 #include "vm/isolate.h" |
10 #include "vm/object.h" | 10 #include "vm/object.h" |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 predefined_[c] = str->raw(); | 87 predefined_[c] = str->raw(); |
88 symbol_handles_[idx] = str; | 88 symbol_handles_[idx] = str; |
89 } | 89 } |
90 } | 90 } |
91 | 91 |
92 | 92 |
93 void Symbols::SetupSymbolTable(Isolate* isolate) { | 93 void Symbols::SetupSymbolTable(Isolate* isolate) { |
94 ASSERT(isolate != NULL); | 94 ASSERT(isolate != NULL); |
95 | 95 |
96 // Setup the symbol table used within the String class. | 96 // Setup the symbol table used within the String class. |
97 const int initial_size = (isolate == Dart::vm_isolate()) ? | 97 const intptr_t initial_size = (isolate == Dart::vm_isolate()) ? |
98 kInitialVMIsolateSymtabSize : kInitialSymtabSize; | 98 kInitialVMIsolateSymtabSize : kInitialSymtabSize; |
99 const Array& array = Array::Handle(Array::New(initial_size + 1)); | 99 const Array& array = Array::Handle(Array::New(initial_size + 1)); |
100 | 100 |
101 // Last element contains the count of used slots. | 101 // Last element contains the count of used slots. |
102 array.SetAt(initial_size, Smi::Handle(Smi::New(0))); | 102 array.SetAt(initial_size, Smi::Handle(Smi::New(0))); |
103 isolate->object_store()->set_symbol_table(array); | 103 isolate->object_store()->set_symbol_table(array); |
104 } | 104 } |
105 | 105 |
106 | 106 |
107 intptr_t Symbols::Size(Isolate* isolate) { | 107 intptr_t Symbols::Size(Isolate* isolate) { |
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
447 RawObject* Symbols::GetVMSymbol(intptr_t object_id) { | 447 RawObject* Symbols::GetVMSymbol(intptr_t object_id) { |
448 ASSERT(IsVMSymbolId(object_id)); | 448 ASSERT(IsVMSymbolId(object_id)); |
449 intptr_t i = (object_id - kMaxPredefinedObjectIds); | 449 intptr_t i = (object_id - kMaxPredefinedObjectIds); |
450 if ((i > kIllegal) && (i < Symbols::kMaxPredefinedId)) { | 450 if ((i > kIllegal) && (i < Symbols::kMaxPredefinedId)) { |
451 return symbol_handles_[i]->raw(); | 451 return symbol_handles_[i]->raw(); |
452 } | 452 } |
453 return Object::null(); | 453 return Object::null(); |
454 } | 454 } |
455 | 455 |
456 } // namespace dart | 456 } // namespace dart |
OLD | NEW |