Index: vm/symbols.cc |
=================================================================== |
--- vm/symbols.cc (revision 10306) |
+++ vm/symbols.cc (working copy) |
@@ -17,7 +17,6 @@ |
// Turn off population of symbols in the VM symbol table, so that we |
// don't find these symbols while doing a Symbols::New(...). |
-#if 0 |
static const char* names[] = { |
NULL, |
@@ -26,7 +25,6 @@ |
PREDEFINED_SYMBOLS_LIST(DEFINE_SYMBOL_LITERAL) |
#undef DEFINE_SYMBOL_LITERAL |
}; |
-#endif |
void Symbols::InitOnce(Isolate* isolate) { |
@@ -38,7 +36,6 @@ |
// Turn off population of symbols in the VM symbol table, so that we |
// don't find these symbols while doing a Symbols::New(...). |
-#if 0 |
// Create all predefined symbols. |
ASSERT((sizeof(names) / sizeof(const char*)) == kMaxPredefined); |
const Array& symbol_table = |
@@ -50,7 +47,6 @@ |
Add(symbol_table, str); |
predefined_[i] = str.raw(); |
} |
-#endif |
} |
@@ -297,4 +293,21 @@ |
return index; // Index of symbol if found or slot into which to add symbol. |
} |
+ |
+intptr_t Symbols::LookupVMSymbol(RawObject* obj) { |
+ for (intptr_t i = 1; i < kMaxPredefined; i++) { |
+ if (predefined_[i] == obj) { |
+ return (i + Object::kMaxId); |
+ } |
+ } |
+ return Object::kInvalidIndex; |
+} |
+ |
+ |
+RawObject* Symbols::GetVMSymbol(intptr_t object_id) { |
+ ASSERT(IsVMSymbolId(object_id)); |
+ intptr_t i = (object_id - Object::kMaxId); |
+ return (i > 0 && i < kMaxPredefined) ? predefined_[i] : Object::null(); |
+} |
+ |
} // namespace dart |