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

Unified Diff: runtime/vm/object.cc

Issue 11369259: Add one-char string table for faster String.charAt to the VM. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: added characters 0x80..0xff Created 8 years, 1 month 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
Index: runtime/vm/object.cc
===================================================================
--- runtime/vm/object.cc (revision 14980)
+++ runtime/vm/object.cc (working copy)
@@ -408,6 +408,8 @@
isolate->object_store()->set_array_class(cls);
cls = Class::NewStringClass(kOneByteStringCid);
isolate->object_store()->set_one_byte_string_class(cls);
+ cls = Class::NewStringClass(kTwoByteStringCid);
+ isolate->object_store()->set_two_byte_string_class(cls);
// Allocate and initialize the empty_array instance.
{
@@ -590,6 +592,10 @@
cls = Class::NewStringClass(kOneByteStringCid);
object_store->set_one_byte_string_class(cls);
+ // Pre-allocate the TwoByteString class needed by the symbol table.
+ cls = Class::NewStringClass(kTwoByteStringCid);
+ object_store->set_two_byte_string_class(cls);
+
// Setup the symbol table for the symbols created in the isolate.
Symbols::SetupSymbolTable(isolate);
@@ -643,8 +649,7 @@
RegisterPrivateClass(cls, name, core_lib);
pending_classes.Add(cls, Heap::kOld);
- cls = Class::NewStringClass(kTwoByteStringCid);
- object_store->set_two_byte_string_class(cls);
+ cls = object_store->two_byte_string_class(); // Was allocated above.
name = Symbols::TwoByteString();
RegisterPrivateClass(cls, name, core_lib);
pending_classes.Add(cls, Heap::kOld);
« no previous file with comments | « runtime/lib/string.cc ('k') | runtime/vm/snapshot_test.cc » ('j') | runtime/vm/snapshot_test.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698