Index: runtime/vm/object.cc |
diff --git a/runtime/vm/object.cc b/runtime/vm/object.cc |
index 4046022fc279c8834c6bac398d3caad62849acea..2d46ccf03e0c873d61b9950b06bdd836dac6ad31 100644 |
--- a/runtime/vm/object.cc |
+++ b/runtime/vm/object.cc |
@@ -18779,6 +18779,36 @@ RawTwoByteString* TwoByteString::New(const String& str, |
} |
+RawTwoByteString* TwoByteString::New(const TypedData& other_typed_data, |
+ intptr_t other_start_index, |
+ intptr_t other_len, |
+ Heap::Space space) { |
+ const String& result = String::Handle(TwoByteString::New(other_len, space)); |
+ if (other_len > 0) { |
+ NoGCScope no_gc; |
+ memmove(TwoByteString::CharAddr(result, 0), |
+ other_typed_data.DataAddr(other_start_index), |
+ other_len * sizeof(uint16_t)); |
+ } |
+ return TwoByteString::raw(result); |
+} |
+ |
+ |
+RawTwoByteString* TwoByteString::New(const ExternalTypedData& other_typed_data, |
+ intptr_t other_start_index, |
+ intptr_t other_len, |
+ Heap::Space space) { |
+ const String& result = String::Handle(TwoByteString::New(other_len, space)); |
+ if (other_len > 0) { |
+ NoGCScope no_gc; |
+ memmove(TwoByteString::CharAddr(result, 0), |
+ other_typed_data.DataAddr(other_start_index), |
+ other_len * sizeof(uint16_t)); |
+ } |
+ return TwoByteString::raw(result); |
+} |
+ |
+ |
RawTwoByteString* TwoByteString::Concat(const String& str1, |
const String& str2, |
Heap::Space space) { |