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 10 matching lines...) Expand all Loading... | |
21 static const char* names[] = { | 21 static const char* names[] = { |
22 NULL, | 22 NULL, |
23 | 23 |
24 #define DEFINE_SYMBOL_LITERAL(symbol, literal) \ | 24 #define DEFINE_SYMBOL_LITERAL(symbol, literal) \ |
25 literal, | 25 literal, |
26 PREDEFINED_SYMBOLS_LIST(DEFINE_SYMBOL_LITERAL) | 26 PREDEFINED_SYMBOLS_LIST(DEFINE_SYMBOL_LITERAL) |
27 #undef DEFINE_SYMBOL_LITERAL | 27 #undef DEFINE_SYMBOL_LITERAL |
28 }; | 28 }; |
29 | 29 |
30 | 30 |
31 const char* Symbols::Name(intptr_t symbol) { | |
hausner
2012/08/31 00:34:55
Why is this needed (or better) than getting the ra
regis
2012/08/31 01:36:18
See the other comment. When we just need a char*,
| |
32 ASSERT((symbol > kIllegal) && (symbol < kMaxId)); | |
33 return names[symbol]; | |
34 } | |
35 | |
36 | |
31 void Symbols::InitOnce(Isolate* isolate) { | 37 void Symbols::InitOnce(Isolate* isolate) { |
32 // Should only be run by the vm isolate. | 38 // Should only be run by the vm isolate. |
33 ASSERT(isolate == Dart::vm_isolate()); | 39 ASSERT(isolate == Dart::vm_isolate()); |
34 | 40 |
35 // Create and setup a symbol table in the vm isolate. | 41 // Create and setup a symbol table in the vm isolate. |
36 SetupSymbolTable(isolate); | 42 SetupSymbolTable(isolate); |
37 | 43 |
38 // 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 |
39 // don't find these symbols while doing a Symbols::New(...). | 45 // don't find these symbols while doing a Symbols::New(...). |
40 // Create all predefined symbols. | 46 // Create all predefined symbols. |
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
306 } | 312 } |
307 | 313 |
308 | 314 |
309 RawObject* Symbols::GetVMSymbol(intptr_t object_id) { | 315 RawObject* Symbols::GetVMSymbol(intptr_t object_id) { |
310 ASSERT(IsVMSymbolId(object_id)); | 316 ASSERT(IsVMSymbolId(object_id)); |
311 intptr_t i = (object_id - kMaxPredefinedObjectIds); | 317 intptr_t i = (object_id - kMaxPredefinedObjectIds); |
312 return (i > 0 && i < Symbols::kMaxId) ? predefined_[i] : Object::null(); | 318 return (i > 0 && i < Symbols::kMaxId) ? predefined_[i] : Object::null(); |
313 } | 319 } |
314 | 320 |
315 } // namespace dart | 321 } // namespace dart |
OLD | NEW |