File tree Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Original file line number Diff line number Diff line change 22
33#include " env-inl.h"
44#include " node_mutex.h"
5- #include " v8-inspector .h"
5+ #include " simdutf .h"
66#include " util-inl.h"
7+ #include " v8-inspector.h"
78
89#include < unicode/unistr.h>
910
@@ -289,10 +290,12 @@ Deletable* MainThreadInterface::GetObjectIfExists(int id) {
289290}
290291
291292std::unique_ptr<StringBuffer> Utf8ToStringView (const std::string& message) {
292- icu::UnicodeString utf16 = icu::UnicodeString::fromUTF8 (
293- icu::StringPiece (message.data (), message.length ()));
294- StringView view (reinterpret_cast <const uint16_t *>(utf16.getBuffer ()),
295- utf16.length ());
293+ size_t expected_u16_length =
294+ simdutf::utf16_length_from_utf8 (message.data (), message.length ());
295+ MaybeStackBuffer<char16_t > buffer (expected_u16_length);
296+ size_t utf16_length = simdutf::convert_utf8_to_utf16 (
297+ message.data (), message.length (), buffer.out ());
298+ StringView view (reinterpret_cast <uint16_t *>(buffer.out ()), utf16_length);
296299 return StringBuffer::create (view);
297300}
298301
You can’t perform that action at this time.
0 commit comments