27 return TypedDataView::Cast(
instance).offset_in_bytes();
34 return TypedDataView::Cast(
instance).typed_data();
39 const intptr_t internal_cid =
42 return internal_cid == kTypedDataUint8ArrayCid ||
43 internal_cid == kTypedDataUint8ClampedArrayCid;
50 TypedDataBase::CheckedHandle(zone, arguments->NativeArgAt(0));
51 const Smi& dst_start_smi =
52 Smi::CheckedHandle(zone, arguments->NativeArgAt(1));
53 const Smi& length_smi = Smi::CheckedHandle(zone, arguments->NativeArgAt(2));
55 TypedDataBase::CheckedHandle(zone, arguments->NativeArgAt(3));
56 const Smi& src_start_smi =
57 Smi::CheckedHandle(zone, arguments->NativeArgAt(4));
59 const intptr_t element_size_in_bytes =
dst.ElementSizeInBytes();
62 const intptr_t dst_start_in_bytes =
63 dst_start_smi.
Value() * element_size_in_bytes;
64 const intptr_t length_in_bytes = length_smi.
Value() * element_size_in_bytes;
65 const intptr_t src_start_in_bytes =
66 src_start_smi.
Value() * element_size_in_bytes;
70 ASSERT(dst_start_in_bytes >= 0);
71 ASSERT(src_start_in_bytes >= 0);
73 ASSERT(length_in_bytes > 0);
75 const intptr_t dst_length_in_bytes =
dst.LengthInBytes();
77 ASSERT(dst_start_in_bytes < dst_length_in_bytes);
78 ASSERT(length_in_bytes <= dst_length_in_bytes - dst_start_in_bytes);
80 const intptr_t src_length_in_bytes =
src.LengthInBytes();
82 ASSERT(src_start_in_bytes < src_length_in_bytes);
83 ASSERT(length_in_bytes <= src_length_in_bytes - src_start_in_bytes);
96 reinterpret_cast<uint8_t*
>(
dst.DataAddr(dst_start_in_bytes));
98 reinterpret_cast<int8_t*
>(
src.DataAddr(src_start_in_bytes));
99 for (intptr_t ix = 0; ix < length_in_bytes; ix++) {
100 int8_t v = *src_data;
114#define TYPED_DATA_GETTER(getter, object, ctor) \
115 DEFINE_NATIVE_ENTRY(TypedData_##getter, 0, 2) { \
116 GET_NON_NULL_NATIVE_ARGUMENT(TypedDataBase, array, \
117 arguments->NativeArgAt(0)); \
118 GET_NON_NULL_NATIVE_ARGUMENT(Smi, offsetInBytes, \
119 arguments->NativeArgAt(1)); \
120 return object::ctor(array.getter(offsetInBytes.Value())); \
123#define TYPED_DATA_SETTER(setter, object, get_object_value, access_type) \
124 DEFINE_NATIVE_ENTRY(TypedData_##setter, 0, 3) { \
125 GET_NON_NULL_NATIVE_ARGUMENT(TypedDataBase, array, \
126 arguments->NativeArgAt(0)); \
127 GET_NON_NULL_NATIVE_ARGUMENT(Smi, offsetInBytes, \
128 arguments->NativeArgAt(1)); \
129 GET_NON_NULL_NATIVE_ARGUMENT(object, value, arguments->NativeArgAt(2)); \
130 array.setter(offsetInBytes.Value(), \
131 static_cast<access_type>(value.get_object_value())); \
132 return Object::null(); \
135#define TYPED_DATA_NATIVES(type_name, object, ctor, get_object_value, \
137 TYPED_DATA_GETTER(Get##type_name, object, ctor) \
138 TYPED_DATA_SETTER(Set##type_name, object, get_object_value, access_type)
#define ASSERT_EQUAL(expected, actual)
static SmiPtr New(intptr_t value)
const int kNumTypedDataCidRemainders
bool IsTypedDataBaseClassId(intptr_t index)
const int kTypedDataCidRemainderInternal
static bool IsTypedDataUint8ArrayClassId(intptr_t cid)
bool IsClampedTypedDataBaseClassId(intptr_t index)
static const ClassId kFirstTypedDataCid
DEFINE_NATIVE_ENTRY(List_allocate, 0, 2)
#define GET_NON_NULL_NATIVE_ARGUMENT(type, name, value)
#define TYPED_DATA_NATIVES(type_name, object, ctor, get_object_value, access_type)