Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(385)

Unified Diff: vm/symbols.cc

Issue 10834069: Do not try to serialize VM objects, these are read only canonical objects and should be referred to… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « vm/symbols.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « vm/symbols.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698