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

Unified Diff: runtime/lib/string.cc

Issue 14862006: Improve performance of String.fromCharCodes by implementing it in Dart. Add tow internal natives to… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 8 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 | « no previous file | runtime/lib/string_patch.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/lib/string.cc
===================================================================
--- runtime/lib/string.cc (revision 22398)
+++ runtime/lib/string.cc (working copy)
@@ -121,6 +121,23 @@
}
+DEFINE_NATIVE_ENTRY(OneByteString_allocate, 1) {
+ GET_NON_NULL_NATIVE_ARGUMENT(Smi, length_obj, arguments->NativeArgAt(0));
+ return OneByteString::New(length_obj.Value(), Heap::kNew);
+}
+
+
+DEFINE_NATIVE_ENTRY(OneByteString_setAt, 3) {
+ GET_NON_NULL_NATIVE_ARGUMENT(String, receiver, arguments->NativeArgAt(0));
+ ASSERT(receiver.IsOneByteString());
+ GET_NON_NULL_NATIVE_ARGUMENT(Smi, index_obj, arguments->NativeArgAt(1));
+ GET_NON_NULL_NATIVE_ARGUMENT(Smi, code_point_obj, arguments->NativeArgAt(2));
+ ASSERT((0 <= code_point_obj.Value()) && (code_point_obj.Value() <= 0xFF));
+ OneByteString::SetCharAt(receiver, index_obj.Value(), code_point_obj.Value());
+ return Object::null();
+}
+
+
DEFINE_NATIVE_ENTRY(String_getHashCode, 1) {
const String& receiver = String::CheckedHandle(arguments->NativeArgAt(0));
intptr_t hash_val = receiver.Hash();
« no previous file with comments | « no previous file | runtime/lib/string_patch.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698