Commit b7364a49 authored by Georg Neis's avatar Georg Neis Committed by V8 LUCI CQ

[compiler] Simplify StringRef

... by removing some obsolete code.

Bug: v8:7790
Change-Id: I3a244ef5fc7fe15321e5bb1c9bb2fe794030ba3b
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3124801
Commit-Queue: Georg Neis <neis@chromium.org>
Reviewed-by: 's avatarJakob Gruber <jgruber@chromium.org>
Cr-Commit-Position: refs/heads/main@{#76582}
parent 19d89456
......@@ -363,18 +363,6 @@ void JSObjectData::SerializeObjectCreateMap(JSHeapBroker* broker,
namespace {
base::Optional<ObjectRef> GetOwnElementFromHeap(JSHeapBroker* broker,
Handle<Object> receiver,
uint32_t index,
bool constant_only) {
LookupIterator it(broker->isolate(), receiver, index, LookupIterator::OWN);
if (it.state() == LookupIterator::DATA &&
(!constant_only || (it.IsReadOnly() && !it.IsConfigurable()))) {
return MakeRef(broker, it.GetDataValue());
}
return base::nullopt;
}
base::Optional<ObjectRef> GetOwnFastDataPropertyFromHeap(
JSHeapBroker* broker, JSObjectRef holder, Representation representation,
FieldIndex field_index) {
......@@ -1797,25 +1785,21 @@ ObjectRef MapRef::GetFieldType(InternalIndex descriptor_index) const {
}
base::Optional<ObjectRef> StringRef::GetCharAsStringOrUndefined(
uint32_t index, SerializationPolicy policy) const {
if (broker()->is_concurrent_inlining()) {
String maybe_char;
auto result = ConcurrentLookupIterator::TryGetOwnChar(
&maybe_char, broker()->isolate(), broker()->local_isolate(), *object(),
index);
if (result == ConcurrentLookupIterator::kGaveUp) {
TRACE_BROKER_MISSING(broker(), "StringRef::GetCharAsStringOrUndefined on "
<< *this << " at index " << index);
return {};
}
uint32_t index) const {
DCHECK(data_->should_access_heap() || broker()->is_concurrent_inlining());
String maybe_char;
auto result = ConcurrentLookupIterator::TryGetOwnChar(
&maybe_char, broker()->isolate(), broker()->local_isolate(), *object(),
index);
DCHECK_EQ(result, ConcurrentLookupIterator::kPresent);
return TryMakeRef(broker(), maybe_char);
if (result == ConcurrentLookupIterator::kGaveUp) {
TRACE_BROKER_MISSING(broker(), "StringRef::GetCharAsStringOrUndefined on "
<< *this << " at index " << index);
return {};
}
CHECK_EQ(data_->kind(), ObjectDataKind::kUnserializedHeapObject);
return GetOwnElementFromHeap(broker(), object(), index, true);
DCHECK_EQ(result, ConcurrentLookupIterator::kPresent);
return TryMakeRef(broker(), maybe_char);
}
bool StringRef::SupportedStringKind() const {
......
......@@ -55,8 +55,6 @@ inline bool IsAnyStore(AccessMode mode) {
return mode == AccessMode::kStore || mode == AccessMode::kStoreInLiteral;
}
enum class SerializationPolicy { kAssumeSerialized, kSerializeIfNeeded };
// Clarifies in function signatures that a method may only be called when
// concurrent inlining is disabled.
class NotConcurrentInliningTag final {
......@@ -936,9 +934,7 @@ class StringRef : public NameRef {
// With concurrent inlining on, we return base::nullopt due to not being able
// to use LookupIterator in a thread-safe way.
base::Optional<ObjectRef> GetCharAsStringOrUndefined(
uint32_t index, SerializationPolicy policy =
SerializationPolicy::kAssumeSerialized) const;
base::Optional<ObjectRef> GetCharAsStringOrUndefined(uint32_t index) const;
// When concurrently accessing non-read-only non-supported strings, we return
// base::nullopt for these methods.
......
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