Commit 1f9f0a4a authored by Santiago Aboy Solanes's avatar Santiago Aboy Solanes Committed by V8 LUCI CQ

[compiler] Read ThinStrings concurrently, as InternalizedStrings do

ThinStrings are essentially a pointer to an InternalizedString. Read
them concurrently in places where we read InternalizedStrings.

Bug: v8:7790, v8:11791
Change-Id: I3be4dd27336f58706c9c57d5042f96cb8f56bcaa
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2905608
Commit-Queue: Santiago Aboy Solanes <solanes@chromium.org>
Reviewed-by: 's avatarGeorg Neis <neis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#74785}
parent 1924e5b9
......@@ -3140,13 +3140,17 @@ base::Optional<ObjectRef> StringRef::GetCharAsStringOrUndefined(
return ObjectRef(broker(), element);
}
bool StringRef::SupportedStringKind() const {
DCHECK(broker()->is_concurrent_inlining());
return IsInternalizedString() || object()->IsThinString();
}
base::Optional<int> StringRef::length() const {
if (data_->should_access_heap()) {
if (data_->kind() == kNeverSerializedHeapObject &&
!this->IsInternalizedString()) {
if (data_->kind() == kNeverSerializedHeapObject && !SupportedStringKind()) {
TRACE_BROKER_MISSING(
broker(),
"length for kNeverSerialized non-internalized string " << *this);
"length for kNeverSerialized unsupported string kind " << *this);
return base::nullopt;
} else {
return object()->length(kAcquireLoad);
......@@ -3157,11 +3161,10 @@ base::Optional<int> StringRef::length() const {
base::Optional<uint16_t> StringRef::GetFirstChar() {
if (data_->should_access_heap()) {
if (data_->kind() == kNeverSerializedHeapObject &&
!this->IsInternalizedString()) {
if (data_->kind() == kNeverSerializedHeapObject && !SupportedStringKind()) {
TRACE_BROKER_MISSING(
broker(),
"first char for kNeverSerialized non-internalized string " << *this);
"first char for kNeverSerialized unsupported string kind " << *this);
return base::nullopt;
}
......@@ -3178,11 +3181,10 @@ base::Optional<uint16_t> StringRef::GetFirstChar() {
base::Optional<double> StringRef::ToNumber() {
if (data_->should_access_heap()) {
if (data_->kind() == kNeverSerializedHeapObject &&
!this->IsInternalizedString()) {
if (data_->kind() == kNeverSerializedHeapObject && !SupportedStringKind()) {
TRACE_BROKER_MISSING(
broker(),
"number for kNeverSerialized non-internalized string " << *this);
"number for kNeverSerialized unsupported string kind " << *this);
return base::nullopt;
}
......
......@@ -923,14 +923,20 @@ class StringRef : public NameRef {
uint32_t index, SerializationPolicy policy =
SerializationPolicy::kAssumeSerialized) const;
// When concurrently accessing non-read-only non-internalized strings, we
// return base::nullopt for these methods.
// When concurrently accessing non-read-only non-supported strings, we return
// base::nullopt for these methods.
base::Optional<int> length() const;
base::Optional<uint16_t> GetFirstChar();
base::Optional<double> ToNumber();
bool IsSeqString() const;
bool IsExternalString() const;
private:
// With concurrent inlining on, we currently support reading directly
// internalized strings, and thin strings (which are pointers to internalized
// strings).
bool SupportedStringKind() const;
};
class SymbolRef : public NameRef {
......
......@@ -66,6 +66,10 @@ V8_INLINE bool IsExternalString(InstanceType instance_type) {
kExternalStringTag;
}
V8_INLINE bool IsThinString(InstanceType instance_type) {
return (instance_type & kStringRepresentationMask) == kThinStringTag;
}
} // namespace InstanceTypeChecker
// TODO(v8:7786): For instance types that have a single map instance on the
......
......@@ -1362,11 +1362,13 @@ ConcurrentLookupIterator::TryGetOwnConstantElement(
JSPrimitiveWrapper js_value = JSPrimitiveWrapper::cast(holder);
String wrapped_string = String::cast(js_value.value());
// The access guard below protects only internalized string accesses.
// The access guard below protects string accesses related to internalized
// strings.
// TODO(jgruber): Support other string kinds.
Map wrapped_string_map = wrapped_string.map(isolate, kAcquireLoad);
if (!InstanceTypeChecker::IsInternalizedString(
wrapped_string_map.instance_type())) {
InstanceType wrapped_type = wrapped_string_map.instance_type();
if (!(InstanceTypeChecker::IsInternalizedString(wrapped_type)) ||
InstanceTypeChecker::IsThinString(wrapped_type)) {
return kGaveUp;
}
......
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