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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/vm/object.h ('k') | runtime/vm/scanner.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/object.h" 5 #include "vm/object.h"
6 6
7 #include "include/dart_api.h" 7 #include "include/dart_api.h"
8 #include "platform/assert.h" 8 #include "platform/assert.h"
9 #include "vm/assembler.h" 9 #include "vm/assembler.h"
10 #include "vm/cpu.h" 10 #include "vm/cpu.h"
(...skipping 15980 matching lines...) Expand 10 before | Expand all | Expand 10 after
15991 return *TwoByteString::CharAddr(*this, index); 15991 return *TwoByteString::CharAddr(*this, index);
15992 } 15992 }
15993 if (class_id == kExternalOneByteStringCid) { 15993 if (class_id == kExternalOneByteStringCid) {
15994 return *ExternalOneByteString::CharAddr(*this, index); 15994 return *ExternalOneByteString::CharAddr(*this, index);
15995 } 15995 }
15996 ASSERT(class_id == kExternalTwoByteStringCid); 15996 ASSERT(class_id == kExternalTwoByteStringCid);
15997 return *ExternalTwoByteString::CharAddr(*this, index); 15997 return *ExternalTwoByteString::CharAddr(*this, index);
15998 } 15998 }
15999 15999
16000 16000
16001 Scanner::CharAtFunc String::CharAtFunc() const {
16002 intptr_t class_id = raw()->GetClassId();
16003 ASSERT(RawObject::IsStringClassId(class_id));
16004 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.
16005 if (class_id == kOneByteStringCid) {
16006 return &OneByteString::CharAt;
16007 }
16008 if (class_id == kTwoByteStringCid) {
16009 return &TwoByteString::CharAt;
16010 }
16011 if (class_id == kExternalOneByteStringCid) {
16012 return &ExternalOneByteString::CharAt;
16013 }
16014 ASSERT(class_id == kExternalTwoByteStringCid);
16015 return &ExternalTwoByteString::CharAt;
16016 }
16017
16018
16001 intptr_t String::CharSize() const { 16019 intptr_t String::CharSize() const {
16002 intptr_t class_id = raw()->GetClassId(); 16020 intptr_t class_id = raw()->GetClassId();
16003 if (class_id == kOneByteStringCid || class_id == kExternalOneByteStringCid) { 16021 if (class_id == kOneByteStringCid || class_id == kExternalOneByteStringCid) {
16004 return kOneByteChar; 16022 return kOneByteChar;
16005 } 16023 }
16006 ASSERT(class_id == kTwoByteStringCid || 16024 ASSERT(class_id == kTwoByteStringCid ||
16007 class_id == kExternalTwoByteStringCid); 16025 class_id == kExternalTwoByteStringCid);
16008 return kTwoByteChar; 16026 return kTwoByteChar;
16009 } 16027 }
16010 16028
(...skipping 2978 matching lines...) Expand 10 before | Expand all | Expand 10 after
18989 return tag_label.ToCString(); 19007 return tag_label.ToCString();
18990 } 19008 }
18991 19009
18992 19010
18993 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { 19011 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const {
18994 Instance::PrintJSONImpl(stream, ref); 19012 Instance::PrintJSONImpl(stream, ref);
18995 } 19013 }
18996 19014
18997 19015
18998 } // namespace dart 19016 } // namespace dart
OLDNEW
« 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