[compiler] Update StringRef::ToNumber for an external strings case

ToNumber was already returning base::Optional but it still needed to be
updated for the internal external uncached string case.

As a note, both IsExternal and IsSeqString do not need to be updated
since they only look at the map.

Bug: v8:7790
Change-Id: Icb5ba7f40982c01cada2a9c2b96b824edce70d44
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2615422
Reviewed-by: Georg Neis <neis@chromium.org>
Commit-Queue: Santiago Aboy Solanes <solanes@chromium.org>
Cr-Commit-Position: refs/heads/master@{#72005}
This commit is contained in:
Santiago Aboy Solanes 2021-01-08 18:29:33 +00:00 committed by Commit Bot
parent 950eae9ade
commit bfab4808bc

View File

@ -3102,6 +3102,14 @@ base::Optional<uint16_t> StringRef::GetFirstChar() {
base::Optional<double> StringRef::ToNumber() {
if (data_->should_access_heap()) {
if (data_->kind() == kNeverSerializedHeapObject &&
!this->IsInternalizedString()) {
TRACE_BROKER_MISSING(
broker(),
"number for kNeverSerialized non-internalized string " << *this);
return base::nullopt;
}
return TryStringToDouble(broker()->local_isolate(), object());
}
return data()->AsString()->to_number();