Commit a6cea204 authored by Nico Hartmann's avatar Nico Hartmann Committed by Commit Bot

[turbofan] Allocation-free string to double conversion

Bug: v8:7790
Change-Id: Ib5fe2727e52a62931cb1bd5ae84fa423a9f6c670
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2071262Reviewed-by: 's avatarGeorg Neis <neis@chromium.org>
Reviewed-by: 's avatarToon Verwaest <verwaest@chromium.org>
Commit-Queue: Nico Hartmann <nicohartmann@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66464}
parent bf20d7d1
......@@ -828,9 +828,12 @@ StringData::StringData(JSHeapBroker* broker, ObjectData** storage,
is_external_string_(object->IsExternalString()),
is_seq_string_(object->IsSeqString()),
chars_as_strings_(broker->zone()) {
int flags = ALLOW_HEX | ALLOW_OCTAL | ALLOW_BINARY;
if (length_ <= kMaxLengthForDoubleConversion) {
to_number_ = StringToDouble(broker->isolate(), object, flags);
const int flags = ALLOW_HEX | ALLOW_OCTAL | ALLOW_BINARY;
uc16 buffer[kMaxLengthForDoubleConversion];
String::WriteToFlat(*object, buffer, 0, length_);
Vector<const uc16> v(buffer, length_);
to_number_ = StringToDouble(v, flags);
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment