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

Unified Diff: vm/symbols.cc

Issue 10808111: Move more symbols to the vm isolate. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: Created 8 years, 5 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
« vm/symbols.h ('K') | « 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 9862)
+++ vm/symbols.cc (working copy)
@@ -13,10 +13,18 @@
namespace dart {
-const char* Symbols::kDot = ".";
-RawString* Symbols::dot_ = String::null();
+RawString* Symbols::predefined_[Symbols::kMaxPredefined];
+static const char* names[] = {
+ NULL,
+#define DEFINE_SYMBOL_LITERAL(symbol, literal) \
+ literal,
+PREDEFINED_SYMBOLS_LIST(DEFINE_SYMBOL_LITERAL)
+#undef DEFINE_SYMBOL_LITERAL
+};
+
+
void Symbols::InitOnce(Isolate* isolate) {
// Should only be run by the vm isolate.
ASSERT(isolate == Dart::vm_isolate());
@@ -25,13 +33,16 @@
SetupSymbolTable(isolate);
// Create all predefined symbols.
+ ASSERT((sizeof(names) / sizeof(const char*)) == kMaxPredefined);
const Array& symbol_table =
Array::Handle(isolate->object_store()->symbol_table());
OneByteString& str = OneByteString::Handle();
- str = OneByteString::New(kDot, Heap::kOld);
- Add(symbol_table, str); // "."
- dot_ = str.raw();
+ for (intptr_t i = 1; i < kMaxPredefined; i++) {
+ str = OneByteString::New(names[i], Heap::kOld);
+ Add(symbol_table, str);
+ predefined_[i] = str.raw();
+ }
}
@@ -39,10 +50,12 @@
ASSERT(isolate != NULL);
// Setup the symbol table used within the String class.
- const Array& array = Array::Handle(Array::New(kInitialSymbolTableSize + 1));
+ const int initial_size = (isolate == Dart::vm_isolate()) ?
+ kInitialVMIsolateSymtabSize : kInitialSymtabSize;
+ const Array& array = Array::Handle(Array::New(initial_size + 1));
// Last element contains the count of used slots.
- array.SetAt(kInitialSymbolTableSize, Smi::Handle(Smi::New(0)));
+ array.SetAt(initial_size, Smi::Handle(Smi::New(0)));
isolate->object_store()->set_symbol_table(array);
}
« vm/symbols.h ('K') | « vm/symbols.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698