[turbofan] Allocation-free string to double conversion
Bug: v8:7790 Change-Id: Ib5fe2727e52a62931cb1bd5ae84fa423a9f6c670 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2071262 Reviewed-by: Georg Neis <neis@chromium.org> Reviewed-by: Toon Verwaest <verwaest@chromium.org> Commit-Queue: Nico Hartmann <nicohartmann@chromium.org> Cr-Commit-Position: refs/heads/master@{#66464}
This commit is contained in:
parent
bf20d7d1d3
commit
a6cea204df
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user