| 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 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 281 vm_isolate->object_store()->set_symbol_table(table.Release()); | 281 vm_isolate->object_store()->set_symbol_table(table.Release()); |
| 282 } | 282 } |
| 283 | 283 |
| 284 | 284 |
| 285 void Symbols::AddPredefinedSymbolsToIsolate() { | 285 void Symbols::AddPredefinedSymbolsToIsolate() { |
| 286 // Should only be run by regular Dart isolates. | 286 // Should only be run by regular Dart isolates. |
| 287 Thread* thread = Thread::Current(); | 287 Thread* thread = Thread::Current(); |
| 288 Isolate* isolate = thread->isolate(); | 288 Isolate* isolate = thread->isolate(); |
| 289 Zone* zone = thread->zone(); | 289 Zone* zone = thread->zone(); |
| 290 ASSERT(isolate != Dart::vm_isolate()); | 290 ASSERT(isolate != Dart::vm_isolate()); |
| 291 String& str = String::Handle(isolate); | 291 String& str = String::Handle(zone); |
| 292 | 292 |
| 293 SymbolTable table(zone, isolate->object_store()->symbol_table()); | 293 SymbolTable table(zone, isolate->object_store()->symbol_table()); |
| 294 | 294 |
| 295 // Set up all the predefined string symbols and create symbols for | 295 // Set up all the predefined string symbols and create symbols for |
| 296 // language keywords. | 296 // language keywords. |
| 297 for (intptr_t i = 1; i < Symbols::kNullCharId; i++) { | 297 for (intptr_t i = 1; i < Symbols::kNullCharId; i++) { |
| 298 str = OneByteString::New(names[i], Heap::kOld); | 298 str = OneByteString::New(names[i], Heap::kOld); |
| 299 str.Hash(); | 299 str.Hash(); |
| 300 str.SetCanonical(); | 300 str.SetCanonical(); |
| 301 bool present = table.Insert(str); | 301 bool present = table.Insert(str); |
| (...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 604 RawObject* Symbols::GetVMSymbol(intptr_t object_id) { | 604 RawObject* Symbols::GetVMSymbol(intptr_t object_id) { |
| 605 ASSERT(IsVMSymbolId(object_id)); | 605 ASSERT(IsVMSymbolId(object_id)); |
| 606 intptr_t i = (object_id - kMaxPredefinedObjectIds); | 606 intptr_t i = (object_id - kMaxPredefinedObjectIds); |
| 607 if ((i > kIllegal) && (i < Symbols::kMaxPredefinedId)) { | 607 if ((i > kIllegal) && (i < Symbols::kMaxPredefinedId)) { |
| 608 return symbol_handles_[i]->raw(); | 608 return symbol_handles_[i]->raw(); |
| 609 } | 609 } |
| 610 return Object::null(); | 610 return Object::null(); |
| 611 } | 611 } |
| 612 | 612 |
| 613 } // namespace dart | 613 } // namespace dart |
| OLD | NEW |