28 return default_value.ptr();
38 if (list.IsGrowableObjectArray()) {
40 a = growableArray.
data();
42 }
else if (list.IsArray()) {
43 a = Array::Cast(list).ptr();
50 intptr_t
start = start_obj.Value();
55 intptr_t
end = end_obj.Value();
61 bool is_one_byte_string =
true;
63 intptr_t utf16_len = array_len;
64 int32_t* utf32_array = zone->Alloc<int32_t>(array_len);
66 for (intptr_t
i = 0;
i < array_len;
i++) {
67 index_object ^=
a.At(
start +
i);
68 if (!index_object.IsSmi()) {
71 intptr_t
value = Smi::Cast(index_object).Value();
77 int32_t value32 =
static_cast<int32_t
>(
value);
79 is_one_byte_string =
false;
84 utf32_array[
i] = value32;
86 if (is_one_byte_string) {
94 String::CheckedHandle(zone, arguments->NativeArgAt(0));
98 intptr_t
start = start_obj.Value();
99 intptr_t
end = end_obj.Value();
107 ASSERT(
string.IsTwoByteString());
126 for (intptr_t
i = 0;
i <
len;
i++) {
128 if (
object.
IsSmi()) {
129 intptr_t slice_start = Smi::Cast(
object).Value();
131 if (slice_start < 0) {
132 intptr_t
bits = -slice_start;
142 if (!
object.
IsSmi()) {
146 slice_end = Smi::Cast(
object).Value();
149 if (char_limit > 0xff) {
158 const String&
base = String::CheckedHandle(zone, arguments->NativeArgAt(0));
160 arguments->NativeArgAt(1));
164 intptr_t
len = matches_growable.Length();
167 const intptr_t
length = length_obj.Value();
173 bool is_onebyte = is_onebyte_obj.value();
177 if (!
base.IsOneByteString()) {
182 const intptr_t base_length =
base.Length();
190 intptr_t write_index = 0;
191 for (intptr_t
i = 0;
i <
len;
i++) {
193 if (
object.
IsSmi()) {
194 intptr_t slice_start = Smi::Cast(
object).Value();
195 intptr_t slice_length = -1;
197 if (slice_start < 0) {
198 intptr_t
bits = -slice_start;
205 if (
object.
IsSmi()) {
206 intptr_t slice_end = Smi::Cast(
object).Value();
207 slice_length = slice_end - slice_start;
211 if (slice_length > 0) {
212 if (0 <= slice_start && slice_start + slice_length <= base_length &&
213 write_index + slice_length <=
length) {
215 write_index += slice_length;
225 }
else if (
object.IsString()) {
226 const String& replacement = String::Cast(
object);
227 intptr_t replacement_length = replacement.
Length();
228 if (write_index + replacement_length >
length) {
233 write_index += replacement_length;
236 if (write_index <
length) {
244 String::CheckedHandle(zone, arguments->NativeArgAt(0));
250 String::CheckedHandle(zone, arguments->NativeArgAt(0));
255 const intptr_t
start = start_obj.Value();
256 const intptr_t
end = end_obj.Value();
262 const int64_t
length = length_obj.AsInt64Value();
267 thread->isolate_group()->object_store()->out_of_memory());
276 const int64_t
length = length_obj.AsInt64Value();
281 thread->isolate_group()->object_store()->out_of_memory());
289 Instance& list = Instance::CheckedHandle(zone, arguments->NativeArgAt(0));
293 intptr_t
start = start_obj.Value();
294 intptr_t
end = end_obj.Value();
305 if (list.IsTypedDataBase()) {
314 }
else if (list.IsArray()) {
315 const Array& array = Array::Cast(list);
325 }
else if (list.IsGrowableObjectArray()) {
343 ASSERT(receiver.IsOneByteString());
347 code_point_obj.Value() & 0xFF);
353 ASSERT(receiver.IsTwoByteString());
357 code_point_obj.Value() & 0xFFFF);
362 Instance& list = Instance::CheckedHandle(zone, arguments->NativeArgAt(0));
366 intptr_t
start = start_obj.Value();
367 intptr_t
end = end_obj.Value();
377 if (list.IsTypedDataBase()) {
386 }
else if (list.IsArray()) {
387 const Array& array = Array::Cast(list);
398 }
else if (list.IsGrowableObjectArray()) {
417 String::CheckedHandle(zone, arguments->NativeArgAt(0));
418 intptr_t hash_val = receiver.
Hash();
426 String::CheckedHandle(zone, arguments->NativeArgAt(0));
432 const intptr_t index_value = Smi::Cast(index).Value();
433 if ((0 <= index_value) && (index_value < str.
Length())) {
434 return str.
CharAt(index_value);
445 String::CheckedHandle(zone, arguments->NativeArgAt(0));
453 String::CheckedHandle(zone, arguments->NativeArgAt(0));
460 String::CheckedHandle(zone, arguments->NativeArgAt(0));
467 String::CheckedHandle(zone, arguments->NativeArgAt(0));
476 const intptr_t start_ix =
start.Value();
477 const intptr_t end_ix =
end.Value();
483 if (argument.IsArray()) {
484 strings ^= argument.
ptr();
486 }
else if (argument.IsGrowableObjectArray()) {
488 strings = g_array.
data();
499 for (intptr_t
i = start_ix;
i < end_ix;
i++) {
500 elem ^= strings.
At(
i);
511 intptr_t array_length = codeUnits.Length();
512 intptr_t length_value =
length.Value();
513 if (length_value < 0 || length_value > array_length) {
522 uint16_t* data_position =
reinterpret_cast<uint16_t*
>(codeUnits.DataAddr(0));
static StringPtr GetEnvironmentValue(Thread *thread, const String &name)
ObjectPtr At(intptr_t index) const
static DART_NORETURN void ThrowByType(ExceptionType type, const Array &arguments)
static DART_NORETURN void ThrowRangeError(const char *argument_name, const Integer &argument_value, intptr_t expected_from, intptr_t expected_to)
static DART_NORETURN void Throw(Thread *thread, const Instance &exception)
static DART_NORETURN void ThrowArgumentError(const Instance &arg)
ObjectPtr At(intptr_t index) const
static void SetCharAt(const String &str, intptr_t index, uint8_t code_unit)
static OneByteStringPtr New(intptr_t len, Heap::Space space)
static constexpr intptr_t kMaxElements
static SmiPtr New(intptr_t value)
static bool IsValid(int64_t value)
static void Copy(const String &dst, intptr_t dst_offset, const uint8_t *characters, intptr_t len)
bool IsOneByteString() const
static StringPtr ToLowerCase(const String &str, Heap::Space space=Heap::kNew)
static StringPtr ConcatAllRange(const Array &strings, intptr_t start, intptr_t end, Heap::Space space=Heap::kNew)
uint16_t CharAt(intptr_t index) const
static StringPtr SubString(const String &str, intptr_t begin_index, Heap::Space space=Heap::kNew)
static StringPtr Concat(const String &str1, const String &str2, Heap::Space space=Heap::kNew)
static StringPtr ToUpperCase(const String &str, Heap::Space space=Heap::kNew)
static StringPtr FromCharCode(Thread *thread, uint16_t char_code)
static StringPtr New(Thread *thread, const char *cstr)
static uint16_t CharAt(const String &str, intptr_t index)
static TwoByteStringPtr New(intptr_t len, Heap::Space space)
static constexpr intptr_t kMaxElements
static void SetCharAt(const String &str, intptr_t index, uint16_t ch)
TypedDataElementType ElementType() const
static bool IsSupplementary(int32_t code_point)
static bool IsOutOfRange(int32_t code_point)
static bool IsLatin1(int32_t code_point)
static bool CheckSlicesOneByte(const String &base, const Array &matches, const int len)
static constexpr intptr_t kLengthSize
DEFINE_NATIVE_ENTRY(List_allocate, 0, 2)
static uint16_t StringValueAt(const String &str, const Integer &index)
static uint16_t CharacterLimit(const String &string, intptr_t start, intptr_t end)
static constexpr intptr_t kLengthMask
#define GET_NATIVE_ARGUMENT(type, name, value)
#define GET_NON_NULL_NATIVE_ARGUMENT(type, name, value)