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

Unified Diff: runtime/vm/symbols.cc

Issue 11644038: Fix latin1 character predefinition in the symbol table. The code (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years 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 16352)
+++ runtime/vm/symbols.cc (working copy)
@@ -76,9 +76,17 @@
}
Object::RegisterSingletonClassNames();
- for (int32_t c = 0; c <= kMaxOneCharCodeSymbol; c++) {
+ // Add Latin1 characters as Symbols, so that Symbols::FromCharCode is fast.
+ for (intptr_t c = 0; c < kMaxOneCharCodeSymbol; c++) {
+ // The symbol_table needs to be reloaded as it might have grown in the
+ // previous iteration.
+ symbol_table = object_store->symbol_table();
ASSERT(kMaxPredefinedId + c < kMaxId);
- predefined_[kMaxPredefinedId + c] = FromUTF32(&c, 1);
+ ASSERT(Utf::IsLatin1(c));
+ uint8_t ch = static_cast<uint8_t>(c);
+ str = OneByteString::New(&ch, 1, Heap::kOld);
+ Add(symbol_table, str);
+ predefined_[kMaxPredefinedId + c] = str.raw();
}
predefined_handles_ = new ReadOnlyHandles();
« 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