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

Unified Diff: runtime/vm/object.cc

Issue 315303002: Improve scanner performance by remembering string's CharAt function as the string type does not cha… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 6 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/object.h ('k') | runtime/vm/scanner.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/object.cc
===================================================================
--- runtime/vm/object.cc (revision 37049)
+++ runtime/vm/object.cc (working copy)
@@ -15998,6 +15998,24 @@
}
+Scanner::CharAtFunc String::CharAtFunc() const {
+ intptr_t class_id = raw()->GetClassId();
+ ASSERT(RawObject::IsStringClassId(class_id));
+ NoGCScope no_gc;
zra 2014/06/05 20:49:46 What is the reason for the NoGCScope?
srdjan 2014/06/05 21:16:38 Copy and paste error: removed.
+ if (class_id == kOneByteStringCid) {
+ return &OneByteString::CharAt;
+ }
+ if (class_id == kTwoByteStringCid) {
+ return &TwoByteString::CharAt;
+ }
+ if (class_id == kExternalOneByteStringCid) {
+ return &ExternalOneByteString::CharAt;
+ }
+ ASSERT(class_id == kExternalTwoByteStringCid);
+ return &ExternalTwoByteString::CharAt;
+}
+
+
intptr_t String::CharSize() const {
intptr_t class_id = raw()->GetClassId();
if (class_id == kOneByteStringCid || class_id == kExternalOneByteStringCid) {
« no previous file with comments | « runtime/vm/object.h ('k') | runtime/vm/scanner.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698