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

Unified Diff: runtime/vm/object.cc

Issue 12881006: Add the native intrinsic TypedData_setRange to optimize the setRange call when the destination and … (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 9 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') | no next file » | 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 20057)
+++ runtime/vm/object.cc (working copy)
@@ -12381,6 +12381,28 @@
};
+void TypedData::Copy(const TypedData& dst,
+ intptr_t dst_offset_in_bytes,
+ const TypedData& src,
+ intptr_t src_offset_in_bytes,
+ intptr_t length_in_bytes) {
+ ASSERT(Utils::RangeCheck(src_offset_in_bytes,
+ length_in_bytes,
+ src.LengthInBytes()));
+ ASSERT(Utils::RangeCheck(dst_offset_in_bytes,
+ length_in_bytes,
+ dst.LengthInBytes()));
+ {
+ NoGCScope no_gc;
+ if (length_in_bytes > 0) {
+ memmove(dst.DataAddr(dst_offset_in_bytes),
+ src.DataAddr(src_offset_in_bytes),
+ length_in_bytes);
+ }
+ }
+}
+
+
RawTypedData* TypedData::New(intptr_t class_id,
intptr_t len,
Heap::Space space) {
@@ -12418,6 +12440,28 @@
}
+void ExternalTypedData::Copy(const ExternalTypedData& dst,
+ intptr_t dst_offset_in_bytes,
+ const ExternalTypedData& src,
+ intptr_t src_offset_in_bytes,
+ intptr_t length_in_bytes) {
+ ASSERT(Utils::RangeCheck(src_offset_in_bytes,
+ length_in_bytes,
+ src.LengthInBytes()));
+ ASSERT(Utils::RangeCheck(dst_offset_in_bytes,
+ length_in_bytes,
+ dst.LengthInBytes()));
+ {
+ NoGCScope no_gc;
+ if (length_in_bytes > 0) {
+ memmove(dst.DataAddr(dst_offset_in_bytes),
+ src.DataAddr(src_offset_in_bytes),
+ length_in_bytes);
+ }
+ }
+}
+
+
RawExternalTypedData* ExternalTypedData::New(intptr_t class_id,
uint8_t* data,
intptr_t len,
« no previous file with comments | « runtime/vm/object.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698