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

Unified Diff: runtime/vm/symbols.cc

Issue 1130843002: Unify processing of Keywords and predefined symbols in the same loop and add accessors for keyword … (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 5 years, 7 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 | « runtime/vm/symbols.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/symbols.cc
===================================================================
--- runtime/vm/symbols.cc (revision 45570)
+++ runtime/vm/symbols.cc (working copy)
@@ -30,8 +30,8 @@
"", // matches kKwTableStart.
-#define DEFINE_KEYWORD_SYMBOL_INDEX(token, chars, ignore1, ignore2) \
- chars,
+#define DEFINE_KEYWORD_SYMBOL_INDEX(t, s, p, a) \
+ s,
DART_KEYWORD_LIST(DEFINE_KEYWORD_SYMBOL_INDEX)
#undef DEFINE_KEYWORD_SYMBOL_INDEX
};
@@ -65,8 +65,11 @@
// Create all predefined symbols.
ASSERT((sizeof(names) / sizeof(const char*)) == Symbols::kNullCharId);
- // First set up all the predefined string symbols.
- for (intptr_t i = 1; i < Symbols::kKwTableStart; i++) {
+ // Set up all the predefined string symbols and create symbols for language
+ // keywords. We don't expect to find any overlaps between the predefined
+ // string symbols and the language keywords. If an overlap is introduced
+ // inadvertantly the ASSERT in AddToVMIsolate while fail.
+ for (intptr_t i = 1; i < Symbols::kNullCharId; i++) {
String* str = String::ReadOnlyHandle();
*str = OneByteString::New(names[i], Heap::kOld);
AddToVMIsolate(*str);
@@ -73,15 +76,6 @@
symbol_handles_[i] = str;
}
- // Create symbols for language keywords. Some keywords are equal to
- // symbols we already created, so use New() instead of Add() to ensure
- // that the symbols are canonicalized.
- for (intptr_t i = Symbols::kKwTableStart; i < Symbols::kNullCharId; i++) {
- String* str = String::ReadOnlyHandle();
- *str = New(names[i]);
- symbol_handles_[i] = str;
- }
-
// Add Latin1 characters as Symbols, so that Symbols::FromCharCode is fast.
for (intptr_t c = 0; c < kNumberOfOneCharCodeSymbols; c++) {
intptr_t idx = (kNullCharId + c);
« no previous file with comments | « runtime/vm/symbols.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698