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

Unified Diff: runtime/lib/typed_data.cc

Issue 132163005: Version 1.1.0-dev.5.7 (Closed) Base URL: http://dart.googlecode.com/svn/trunk/dart/
Patch Set: Created 6 years, 11 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/bin/builtin.dart ('k') | runtime/lib/typed_data.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/lib/typed_data.cc
===================================================================
--- runtime/lib/typed_data.cc (revision 31662)
+++ runtime/lib/typed_data.cc (working copy)
@@ -65,34 +65,29 @@
return Integer::null();
}
+
template <typename DstType, typename SrcType>
static RawBool* CopyData(const Instance& dst, const Instance& src,
const Smi& dst_start, const Smi& src_start,
const Smi& length) {
const DstType& dst_array = DstType::Cast(dst);
const SrcType& src_array = SrcType::Cast(src);
- intptr_t element_size_in_bytes = dst_array.ElementSizeInBytes();
- intptr_t dst_offset_in_bytes = dst_start.Value() * element_size_in_bytes;
- intptr_t src_offset_in_bytes = src_start.Value() * element_size_in_bytes;
- intptr_t length_in_bytes = length.Value() * element_size_in_bytes;
+ const intptr_t dst_offset_in_bytes = dst_start.Value();
+ const intptr_t src_offset_in_bytes = src_start.Value();
+ const intptr_t length_in_bytes = length.Value();
if (dst_array.ElementType() != src_array.ElementType()) {
return Bool::False().raw();
}
- RangeCheck(src_offset_in_bytes,
- length_in_bytes,
- src_array.LengthInBytes(),
- element_size_in_bytes);
- RangeCheck(dst_offset_in_bytes,
- length_in_bytes,
- dst_array.LengthInBytes(),
- element_size_in_bytes);
+ ASSERT(Utils::RangeCheck(
+ src_offset_in_bytes, length_in_bytes, src_array.LengthInBytes()));
+ ASSERT(Utils::RangeCheck(
+ dst_offset_in_bytes, length_in_bytes, dst_array.LengthInBytes()));
TypedData::Copy<DstType, SrcType>(dst_array, dst_offset_in_bytes,
src_array, src_offset_in_bytes,
length_in_bytes);
return Bool::True().raw();
}
-
DEFINE_NATIVE_ENTRY(TypedData_setRange, 5) {
GET_NON_NULL_NATIVE_ARGUMENT(Instance, dst, arguments->NativeArgAt(0));
GET_NON_NULL_NATIVE_ARGUMENT(Smi, dst_start, arguments->NativeArgAt(1));
@@ -122,10 +117,10 @@
dst, src, dst_start, src_start, length);
}
}
+ UNREACHABLE();
return Bool::False().raw();
}
-
// We check the length parameter against a possible maximum length for the
// array based on available physical addressable memory on the system. The
// maximum possible length is a scaled value of kSmiMax which is set up based
« no previous file with comments | « runtime/bin/builtin.dart ('k') | runtime/lib/typed_data.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698