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

Side by Side Diff: runtime/lib/string.cc

Issue 42443002: Improve string library performance. String concat and indexOf. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | runtime/lib/string_buffer_patch.dart » ('j') | runtime/lib/string_patch.dart » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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/bootstrap_natives.h" 5 #include "vm/bootstrap_natives.h"
6 6
7 #include "vm/exceptions.h" 7 #include "vm/exceptions.h"
8 #include "vm/native_entry.h" 8 #include "vm/native_entry.h"
9 #include "vm/object.h" 9 #include "vm/object.h"
10 #include "vm/symbols.h" 10 #include "vm/symbols.h"
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 } 203 }
204 204
205 205
206 DEFINE_NATIVE_ENTRY(String_toUpperCase, 1) { 206 DEFINE_NATIVE_ENTRY(String_toUpperCase, 1) {
207 const String& receiver = String::CheckedHandle(arguments->NativeArgAt(0)); 207 const String& receiver = String::CheckedHandle(arguments->NativeArgAt(0));
208 ASSERT(!receiver.IsNull()); 208 ASSERT(!receiver.IsNull());
209 return String::ToUpperCase(receiver); 209 return String::ToUpperCase(receiver);
210 } 210 }
211 211
212 212
213 DEFINE_NATIVE_ENTRY(Strings_concatAll, 3) { 213 DEFINE_NATIVE_ENTRY(String_concatRange, 3) {
214 GET_NON_NULL_NATIVE_ARGUMENT(Instance, argument, arguments->NativeArgAt(0)); 214 GET_NON_NULL_NATIVE_ARGUMENT(Instance, argument, arguments->NativeArgAt(0));
215 GET_NON_NULL_NATIVE_ARGUMENT(Smi, start, arguments->NativeArgAt(1)); 215 GET_NON_NULL_NATIVE_ARGUMENT(Smi, start, arguments->NativeArgAt(1));
216 GET_NON_NULL_NATIVE_ARGUMENT(Smi, end, arguments->NativeArgAt(2)); 216 GET_NON_NULL_NATIVE_ARGUMENT(Smi, end, arguments->NativeArgAt(2));
217 const intptr_t start_ix = start.Value(); 217 const intptr_t start_ix = start.Value();
218 const intptr_t end_ix = end.Value(); 218 const intptr_t end_ix = end.Value();
219 if (start_ix < 0) { 219 if (start_ix < 0) {
220 Exceptions::ThrowArgumentError(start); 220 Exceptions::ThrowArgumentError(start);
221 } 221 }
222 Array& strings = Array::Handle(); 222 Array& strings = Array::Handle();
223 intptr_t length = -1; 223 intptr_t length = -1;
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 ? String::Handle(OneByteString::New(length_value, Heap::kNew)) 261 ? String::Handle(OneByteString::New(length_value, Heap::kNew))
262 : String::Handle(TwoByteString::New(length_value, Heap::kNew)); 262 : String::Handle(TwoByteString::New(length_value, Heap::kNew));
263 NoGCScope no_gc; 263 NoGCScope no_gc;
264 264
265 uint16_t* data_position = reinterpret_cast<uint16_t*>(codeUnits.DataAddr(0)); 265 uint16_t* data_position = reinterpret_cast<uint16_t*>(codeUnits.DataAddr(0));
266 String::Copy(result, 0, data_position, length_value); 266 String::Copy(result, 0, data_position, length_value);
267 return result.raw(); 267 return result.raw();
268 } 268 }
269 269
270 } // namespace dart 270 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | runtime/lib/string_buffer_patch.dart » ('j') | runtime/lib/string_patch.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698