@@ -10049,7 +10049,6 @@ class OneByteString : public AllStatic {
10049
10049
10050
10050
static uint16_t CharAt (const String& str, intptr_t index) {
10051
10051
ASSERT (str.IsOneByteString ());
10052
- NoSafepointScope no_safepoint;
10053
10052
return OneByteString::CharAt (static_cast <OneByteStringPtr>(str.ptr ()),
10054
10053
index );
10055
10054
}
@@ -10187,7 +10186,6 @@ class TwoByteString : public AllStatic {
10187
10186
10188
10187
static uint16_t CharAt (const String& str, intptr_t index) {
10189
10188
ASSERT (str.IsTwoByteString ());
10190
- NoSafepointScope no_safepoint;
10191
10189
return TwoByteString::CharAt (static_cast <TwoByteStringPtr>(str.ptr ()),
10192
10190
index );
10193
10191
}
@@ -10306,7 +10304,6 @@ class ExternalOneByteString : public AllStatic {
10306
10304
10307
10305
static uint16_t CharAt (const String& str, intptr_t index) {
10308
10306
ASSERT (str.IsExternalOneByteString ());
10309
- NoSafepointScope no_safepoint;
10310
10307
return ExternalOneByteString::CharAt (
10311
10308
static_cast <ExternalOneByteStringPtr>(str.ptr ()), index );
10312
10309
}
@@ -10399,7 +10396,6 @@ class ExternalTwoByteString : public AllStatic {
10399
10396
10400
10397
static uint16_t CharAt (const String& str, intptr_t index) {
10401
10398
ASSERT (str.IsExternalTwoByteString ());
10402
- NoSafepointScope no_safepoint;
10403
10399
return ExternalTwoByteString::CharAt (
10404
10400
static_cast <ExternalTwoByteStringPtr>(str.ptr ()), index );
10405
10401
}
@@ -11117,12 +11113,16 @@ class TypedDataBase : public PointerBase {
11117
11113
11118
11114
#define TYPED_GETTER_SETTER (name, type ) \
11119
11115
type Get##name(intptr_t byte_offset) const { \
11120
- NoSafepointScope no_safepoint; \
11121
- return LoadUnaligned (reinterpret_cast <type*>(DataAddr (byte_offset))); \
11116
+ ASSERT (static_cast <uintptr_t >(byte_offset) <= \
11117
+ static_cast <uintptr_t >(LengthInBytes ()) - sizeof (type)); \
11118
+ return LoadUnaligned ( \
11119
+ reinterpret_cast <type*>(untag ()->data_ + byte_offset)); \
11122
11120
} \
11123
11121
void Set##name(intptr_t byte_offset, type value) const { \
11124
- NoSafepointScope no_safepoint; \
11125
- StoreUnaligned (reinterpret_cast <type*>(DataAddr (byte_offset)), value); \
11122
+ ASSERT (static_cast <uintptr_t >(byte_offset) <= \
11123
+ static_cast <uintptr_t >(LengthInBytes ()) - sizeof (type)); \
11124
+ StoreUnaligned (reinterpret_cast <type*>(untag ()->data_ + byte_offset), \
11125
+ value); \
11126
11126
}
11127
11127
11128
11128
TYPED_GETTER_SETTER (Int8, int8_t )
@@ -11174,14 +11174,16 @@ class TypedData : public TypedDataBase {
11174
11174
11175
11175
#define TYPED_GETTER_SETTER (name, type ) \
11176
11176
type Get##name(intptr_t byte_offset) const { \
11177
- ASSERT ((byte_offset >= 0 ) && \
11178
- (byte_offset + static_cast <intptr_t >( sizeof (type )) - 1 ) < \
11179
- LengthInBytes ()); \
11180
- return LoadUnaligned (ReadOnlyDataAddr< type>(byte_offset)); \
11177
+ ASSERT (static_cast < uintptr_t > (byte_offset) <= \
11178
+ static_cast <uintptr_t >( LengthInBytes ( )) - sizeof (type)); \
11179
+ return LoadUnaligned ( \
11180
+ reinterpret_cast < const type*>( untag ()-> data () + byte_offset)); \
11181
11181
} \
11182
11182
void Set##name(intptr_t byte_offset, type value) const { \
11183
- NoSafepointScope no_safepoint; \
11184
- StoreUnaligned (reinterpret_cast <type*>(DataAddr (byte_offset)), value); \
11183
+ ASSERT (static_cast <uintptr_t >(byte_offset) <= \
11184
+ static_cast <uintptr_t >(LengthInBytes ()) - sizeof (type)); \
11185
+ return StoreUnaligned ( \
11186
+ reinterpret_cast <type*>(untag ()->data () + byte_offset), value); \
11185
11187
}
11186
11188
11187
11189
TYPED_GETTER_SETTER (Int8, int8_t )
0 commit comments