| 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/isolate.h" | 7 #include "vm/isolate.h" |
| 8 #include "vm/object.h" | 8 #include "vm/object.h" |
| 9 #include "vm/object_store.h" | 9 #include "vm/object_store.h" |
| 10 #include "vm/raw_object.h" | 10 #include "vm/raw_object.h" |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 | 40 |
| 41 // Create and setup a symbol table in the vm isolate. | 41 // Create and setup a symbol table in the vm isolate. |
| 42 SetupSymbolTable(isolate); | 42 SetupSymbolTable(isolate); |
| 43 | 43 |
| 44 // Turn off population of symbols in the VM symbol table, so that we | 44 // Turn off population of symbols in the VM symbol table, so that we |
| 45 // don't find these symbols while doing a Symbols::New(...). | 45 // don't find these symbols while doing a Symbols::New(...). |
| 46 // Create all predefined symbols. | 46 // Create all predefined symbols. |
| 47 ASSERT((sizeof(names) / sizeof(const char*)) == Symbols::kMaxId); | 47 ASSERT((sizeof(names) / sizeof(const char*)) == Symbols::kMaxId); |
| 48 const Array& symbol_table = | 48 const Array& symbol_table = |
| 49 Array::Handle(isolate->object_store()->symbol_table()); | 49 Array::Handle(isolate->object_store()->symbol_table()); |
| 50 dart::OneByteString& str = OneByteString::Handle(); | 50 dart::String& str = String::Handle(); |
| 51 | 51 |
| 52 for (intptr_t i = 1; i < Symbols::kMaxId; i++) { | 52 for (intptr_t i = 1; i < Symbols::kMaxId; i++) { |
| 53 str = OneByteString::New(names[i], Heap::kOld); | 53 str = OneByteString::New(names[i], Heap::kOld); |
| 54 Add(symbol_table, str); | 54 Add(symbol_table, str); |
| 55 predefined_[i] = str.raw(); | 55 predefined_[i] = str.raw(); |
| 56 } | 56 } |
| 57 Object::RegisterSingletonClassNames(); | 57 Object::RegisterSingletonClassNames(); |
| 58 } | 58 } |
| 59 | 59 |
| 60 | 60 |
| (...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 312 } | 312 } |
| 313 | 313 |
| 314 | 314 |
| 315 RawObject* Symbols::GetVMSymbol(intptr_t object_id) { | 315 RawObject* Symbols::GetVMSymbol(intptr_t object_id) { |
| 316 ASSERT(IsVMSymbolId(object_id)); | 316 ASSERT(IsVMSymbolId(object_id)); |
| 317 intptr_t i = (object_id - kMaxPredefinedObjectIds); | 317 intptr_t i = (object_id - kMaxPredefinedObjectIds); |
| 318 return (i > 0 && i < Symbols::kMaxId) ? predefined_[i] : Object::null(); | 318 return (i > 0 && i < Symbols::kMaxId) ? predefined_[i] : Object::null(); |
| 319 } | 319 } |
| 320 | 320 |
| 321 } // namespace dart | 321 } // namespace dart |
| OLD | NEW |