Index: runtime/vm/object.cc |
diff --git a/runtime/vm/object.cc b/runtime/vm/object.cc |
index 4a7eb4914efb1b16e1b73c876a13889f6ae9712a..5030d55456a6ffea0d399cc7d3d0f8cab23a3fc3 100644 |
--- a/runtime/vm/object.cc |
+++ b/runtime/vm/object.cc |
@@ -18665,6 +18665,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) { |