[string] Add PtrComprCageBase to WriteToFlat, HashString, and Get

Also a couple of microoptimizations and consistent formatting in
WriteToFlat.

Change-Id: Ie642a4b8e0819b04603ee5c5d12eebccf6a2d59c
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3151963
Commit-Queue: Leszek Swirski <leszeks@chromium.org>
Reviewed-by: Jakob Gruber <jgruber@chromium.org>
Reviewed-by: Igor Sheludko <ishell@chromium.org>
Cr-Commit-Position: refs/heads/main@{#76799}
This commit is contained in:
Leszek Swirski 2021-09-13 17:05:51 +02:00 committed by V8 LUCI CQ
parent c6bb56302c
commit fbf51c7ad9
6 changed files with 148 additions and 91 deletions

View File

@ -645,9 +645,10 @@ MaybeHandle<String> FactoryBase<Impl>::NewConsString(
DisallowGarbageCollection no_gc;
SharedStringAccessGuardIfNeeded access_guard(isolate());
base::uc16* sink = result->GetChars(no_gc, access_guard);
String::WriteToFlat(*left, sink, 0, left->length(), access_guard);
String::WriteToFlat(*right, sink + left->length(), 0, right->length(),
String::WriteToFlat(*left, sink, 0, left->length(), isolate(),
access_guard);
String::WriteToFlat(*right, sink + left->length(), 0, right->length(),
isolate(), access_guard);
return result;
}

View File

@ -1425,7 +1425,7 @@ base::Optional<double> TryStringToDouble(LocalIsolate* isolate,
const int flags = ALLOW_HEX | ALLOW_OCTAL | ALLOW_BINARY;
auto buffer = std::make_unique<base::uc16[]>(max_length_for_conversion);
SharedStringAccessGuardIfNeeded access_guard(isolate);
String::WriteToFlat(*object, buffer.get(), 0, length, access_guard);
String::WriteToFlat(*object, buffer.get(), 0, length, isolate, access_guard);
base::Vector<const base::uc16> v(buffer.get(), length);
return StringToDouble(v, flags);
}

View File

@ -1507,7 +1507,8 @@ ConcurrentLookupIterator::Result ConcurrentLookupIterator::TryGetOwnChar(
uint16_t charcode;
{
SharedStringAccessGuardIfNeeded access_guard(local_isolate);
charcode = string.Get(static_cast<int>(index));
charcode = string.Get(static_cast<int>(index), PtrComprCageBase(isolate),
access_guard);
}
if (charcode > unibrow::Latin1::kMaxChar) return kGaveUp;

View File

@ -119,6 +119,12 @@ StringShape::StringShape(const String str)
DCHECK_EQ(type_ & kIsNotStringMask, kStringTag);
}
StringShape::StringShape(const String str, PtrComprCageBase cage_base)
: type_(str.map(cage_base, kAcquireLoad).instance_type()) {
set_valid();
DCHECK_EQ(type_ & kIsNotStringMask, kStringTag);
}
StringShape::StringShape(Map map) : type_(map.instance_type()) {
set_valid();
DCHECK_EQ(type_ & kIsNotStringMask, kStringTag);
@ -617,45 +623,53 @@ Handle<String> String::Flatten(LocalIsolate* isolate, Handle<String> string,
return string;
}
uint16_t String::Get(int index) const {
DCHECK(!SharedStringAccessGuardIfNeeded::IsNeeded(*this));
return GetImpl(index, GetPtrComprCageBase(*this),
SharedStringAccessGuardIfNeeded::NotNeeded());
}
uint16_t String::Get(int index, Isolate* isolate) const {
SharedStringAccessGuardIfNeeded scope(isolate);
return GetImpl(index, scope);
return GetImpl(index, isolate, scope);
}
uint16_t String::Get(int index, LocalIsolate* local_isolate) const {
SharedStringAccessGuardIfNeeded scope(local_isolate);
return GetImpl(index, scope);
return GetImpl(index, local_isolate, scope);
}
uint16_t String::Get(
int index, const SharedStringAccessGuardIfNeeded& access_guard) const {
return GetImpl(index, access_guard);
int index, PtrComprCageBase cage_base,
const SharedStringAccessGuardIfNeeded& access_guard) const {
return GetImpl(index, cage_base, access_guard);
}
uint16_t String::GetImpl(
int index, const SharedStringAccessGuardIfNeeded& access_guard) const {
int index, PtrComprCageBase cage_base,
const SharedStringAccessGuardIfNeeded& access_guard) const {
DCHECK(index >= 0 && index < length());
class StringGetDispatcher : public AllStatic {
public:
#define DEFINE_METHOD(Type) \
static inline uint16_t Handle##Type( \
Type str, int index, \
Type str, int index, PtrComprCageBase cage_base, \
const SharedStringAccessGuardIfNeeded& access_guard) { \
return str.Get(index, access_guard); \
return str.Get(index, cage_base, access_guard); \
}
STRING_CLASS_TYPES(DEFINE_METHOD)
#undef DEFINE_METHOD
static inline uint16_t HandleInvalidString(
String str, int index,
String str, int index, PtrComprCageBase cage_base,
const SharedStringAccessGuardIfNeeded& access_guard) {
UNREACHABLE();
}
};
return StringShape(*this)
.DispatchToSpecificType<StringGetDispatcher, uint16_t>(*this, index,
access_guard);
.DispatchToSpecificType<StringGetDispatcher, uint16_t>(
*this, index, cage_base, access_guard);
}
void String::Set(int index, uint16_t value) {
@ -667,9 +681,11 @@ void String::Set(int index, uint16_t value) {
: SeqTwoByteString::cast(*this).SeqTwoByteStringSet(index, value);
}
bool String::IsFlat() const {
if (!StringShape(*this).IsCons()) return true;
return ConsString::cast(*this).second().length() == 0;
bool String::IsFlat() const { return IsFlat(GetPtrComprCageBase(*this)); }
bool String::IsFlat(PtrComprCageBase cage_base) const {
if (!StringShape(*this, cage_base).IsCons()) return true;
return ConsString::cast(*this).second(cage_base).length() == 0;
}
String String::GetUnderlying() const {
@ -771,11 +787,13 @@ inline base::Vector<const base::uc16> String::GetCharVector(
uint8_t SeqOneByteString::Get(int index) const {
DCHECK(!SharedStringAccessGuardIfNeeded::IsNeeded(*this));
return Get(index, SharedStringAccessGuardIfNeeded::NotNeeded());
return Get(index, GetPtrComprCageBase(*this),
SharedStringAccessGuardIfNeeded::NotNeeded());
}
uint8_t SeqOneByteString::Get(
int index, const SharedStringAccessGuardIfNeeded& access_guard) const {
int index, PtrComprCageBase cage_base,
const SharedStringAccessGuardIfNeeded& access_guard) const {
USE(access_guard);
DCHECK(index >= 0 && index < length());
return ReadField<byte>(kHeaderSize + index * kCharSize);
@ -825,7 +843,8 @@ base::uc16* SeqTwoByteString::GetChars(
}
uint16_t SeqTwoByteString::Get(
int index, const SharedStringAccessGuardIfNeeded& access_guard) const {
int index, PtrComprCageBase cage_base,
const SharedStringAccessGuardIfNeeded& access_guard) const {
USE(access_guard);
DCHECK(index >= 0 && index < length());
return ReadField<uint16_t>(kHeaderSize + index * kShortSize);
@ -977,7 +996,8 @@ const uint8_t* ExternalOneByteString::GetChars() const {
}
uint8_t ExternalOneByteString::Get(
int index, const SharedStringAccessGuardIfNeeded& access_guard) const {
int index, PtrComprCageBase cage_base,
const SharedStringAccessGuardIfNeeded& access_guard) const {
USE(access_guard);
DCHECK(index >= 0 && index < length());
return GetChars()[index];
@ -1044,7 +1064,8 @@ const uint16_t* ExternalTwoByteString::GetChars() const {
}
uint16_t ExternalTwoByteString::Get(
int index, const SharedStringAccessGuardIfNeeded& access_guard) const {
int index, PtrComprCageBase cage_base,
const SharedStringAccessGuardIfNeeded& access_guard) const {
USE(access_guard);
DCHECK(index >= 0 && index < length());
return GetChars()[index];

View File

@ -647,53 +647,52 @@ std::unique_ptr<char[]> String::ToCString(AllowNullsFlag allow_nulls,
template <typename sinkchar>
void String::WriteToFlat(String source, sinkchar* sink, int from, int to) {
DCHECK(!SharedStringAccessGuardIfNeeded::IsNeeded(source));
return WriteToFlat(source, sink, from, to,
return WriteToFlat(source, sink, from, to, GetPtrComprCageBase(source),
SharedStringAccessGuardIfNeeded::NotNeeded());
}
// static
template <typename sinkchar>
void String::WriteToFlat(String source, sinkchar* sink, int from, int to,
PtrComprCageBase cage_base,
const SharedStringAccessGuardIfNeeded& access_guard) {
DisallowGarbageCollection no_gc;
while (from < to) {
if (from == to) return;
while (true) {
DCHECK_LT(from, to);
DCHECK_LE(0, from);
DCHECK_LE(to, source.length());
switch (StringShape(source).full_representation_tag()) {
case kOneByteStringTag | kExternalStringTag: {
switch (StringShape(source, cage_base).full_representation_tag()) {
case kOneByteStringTag | kExternalStringTag:
CopyChars(sink, ExternalOneByteString::cast(source).GetChars() + from,
to - from);
return;
}
case kTwoByteStringTag | kExternalStringTag: {
const base::uc16* data = ExternalTwoByteString::cast(source).GetChars();
CopyChars(sink, data + from, to - from);
case kTwoByteStringTag | kExternalStringTag:
CopyChars(sink, ExternalTwoByteString::cast(source).GetChars() + from,
to - from);
return;
}
case kOneByteStringTag | kSeqStringTag: {
case kOneByteStringTag | kSeqStringTag:
CopyChars(
sink,
SeqOneByteString::cast(source).GetChars(no_gc, access_guard) + from,
to - from);
return;
}
case kTwoByteStringTag | kSeqStringTag: {
case kTwoByteStringTag | kSeqStringTag:
CopyChars(
sink,
SeqTwoByteString::cast(source).GetChars(no_gc, access_guard) + from,
to - from);
return;
}
case kOneByteStringTag | kConsStringTag:
case kTwoByteStringTag | kConsStringTag: {
ConsString cons_string = ConsString::cast(source);
String first = cons_string.first();
String first = cons_string.first(cage_base);
int boundary = first.length();
if (to - boundary >= boundary - from) {
// Right hand side is longer. Recurse over left.
if (from < boundary) {
WriteToFlat(first, sink, from, boundary, access_guard);
if (from == 0 && cons_string.second() == first) {
WriteToFlat(first, sink, from, boundary, cage_base, access_guard);
if (from == 0 && cons_string.second(cage_base) == first) {
CopyChars(sink + boundary, sink, boundary);
return;
}
@ -703,46 +702,50 @@ void String::WriteToFlat(String source, sinkchar* sink, int from, int to,
from -= boundary;
}
to -= boundary;
source = cons_string.second();
source = cons_string.second(cage_base);
} else {
// Left hand side is longer. Recurse over right.
if (to > boundary) {
String second = cons_string.second();
String second = cons_string.second(cage_base);
// When repeatedly appending to a string, we get a cons string that
// is unbalanced to the left, a list, essentially. We inline the
// common case of sequential one-byte right child.
if (to - boundary == 1) {
sink[boundary - from] = static_cast<sinkchar>(second.Get(0));
} else if (second.IsSeqOneByteString()) {
sink[boundary - from] =
static_cast<sinkchar>(second.Get(0, cage_base, access_guard));
} else if (second.IsSeqOneByteString(cage_base)) {
CopyChars(
sink + boundary - from,
SeqOneByteString::cast(second).GetChars(no_gc, access_guard),
to - boundary);
} else {
WriteToFlat(second, sink + boundary - from, 0, to - boundary,
access_guard);
cage_base, access_guard);
}
to = boundary;
}
source = first;
}
break;
if (from == to) return;
continue;
}
case kOneByteStringTag | kSlicedStringTag:
case kTwoByteStringTag | kSlicedStringTag: {
SlicedString slice = SlicedString::cast(source);
unsigned offset = slice.offset();
WriteToFlat(slice.parent(), sink, from + offset, to + offset,
access_guard);
return;
source = slice.parent(cage_base);
from += offset;
to += offset;
continue;
}
case kOneByteStringTag | kThinStringTag:
case kTwoByteStringTag | kThinStringTag:
source = ThinString::cast(source).actual();
break;
source = ThinString::cast(source).actual(cage_base);
continue;
}
UNREACHABLE();
}
DCHECK_EQ(from, to);
UNREACHABLE();
}
template <typename SourceChar>
@ -819,12 +822,15 @@ bool String::SlowEquals(
if (len != other.length()) return false;
if (len == 0) return true;
PtrComprCageBase cage_base = GetPtrComprCageBase(*this);
// Fast check: if at least one ThinString is involved, dereference it/them
// and restart.
if (this->IsThinString() || other.IsThinString()) {
if (other.IsThinString()) other = ThinString::cast(other).actual();
if (this->IsThinString()) {
return ThinString::cast(*this).actual().Equals(other);
if (this->IsThinString(cage_base) || other.IsThinString(cage_base)) {
if (other.IsThinString(cage_base))
other = ThinString::cast(other).actual(cage_base);
if (this->IsThinString(cage_base)) {
return ThinString::cast(*this).actual(cage_base).Equals(other);
} else {
return this->Equals(other);
}
@ -852,7 +858,9 @@ bool String::SlowEquals(
// We know the strings are both non-empty. Compare the first chars
// before we try to flatten the strings.
if (this->Get(0, access_guard) != other.Get(0, access_guard)) return false;
if (this->Get(0, cage_base, access_guard) !=
other.Get(0, cage_base, access_guard))
return false;
if (IsSeqOneByteString() && other.IsSeqOneByteString()) {
const uint8_t* str1 =
@ -1348,6 +1356,7 @@ namespace {
template <typename Char>
uint32_t HashString(String string, size_t start, int length, uint64_t seed,
PtrComprCageBase cage_base,
const SharedStringAccessGuardIfNeeded& access_guard) {
DisallowGarbageCollection no_gc;
@ -1358,11 +1367,12 @@ uint32_t HashString(String string, size_t start, int length, uint64_t seed,
std::unique_ptr<Char[]> buffer;
const Char* chars;
if (string.IsConsString()) {
if (string.IsConsString(cage_base)) {
DCHECK_EQ(0, start);
DCHECK(!string.IsFlat());
buffer.reset(new Char[length]);
String::WriteToFlat(string, buffer.get(), 0, length, access_guard);
String::WriteToFlat(string, buffer.get(), 0, length, cage_base,
access_guard);
chars = buffer.get();
} else {
chars = string.GetChars<Char>(no_gc, access_guard) + start;
@ -1387,25 +1397,32 @@ uint32_t String::ComputeAndSetHash(
uint64_t seed = HashSeed(GetReadOnlyRoots());
size_t start = 0;
String string = *this;
if (string.IsSlicedString()) {
PtrComprCageBase cage_base = GetPtrComprCageBase(string);
StringShape shape(string, cage_base);
if (shape.IsSliced()) {
SlicedString sliced = SlicedString::cast(string);
start = sliced.offset();
string = sliced.parent();
string = sliced.parent(cage_base);
shape = StringShape(string, cage_base);
}
if (string.IsConsString() && string.IsFlat()) {
string = ConsString::cast(string).first();
if (shape.IsCons() && string.IsFlat(cage_base)) {
string = ConsString::cast(string).first(cage_base);
shape = StringShape(string, cage_base);
}
if (string.IsThinString()) {
string = ThinString::cast(string).actual();
if (shape.IsThin()) {
string = ThinString::cast(string).actual(cage_base);
shape = StringShape(string, cage_base);
if (length() == string.length()) {
set_raw_hash_field(string.raw_hash_field());
return hash();
}
}
uint32_t raw_hash_field =
string.IsOneByteRepresentation()
? HashString<uint8_t>(string, start, length(), seed, access_guard)
: HashString<uint16_t>(string, start, length(), seed, access_guard);
shape.encoding_tag() == kOneByteStringTag
? HashString<uint8_t>(string, start, length(), seed, cage_base,
access_guard)
: HashString<uint16_t>(string, start, length(), seed, cage_base,
access_guard);
set_raw_hash_field(raw_hash_field);
// Check the hash code is there.
@ -1509,29 +1526,30 @@ void SeqTwoByteString::clear_padding() {
}
uint16_t ConsString::Get(
int index, const SharedStringAccessGuardIfNeeded& access_guard) const {
int index, PtrComprCageBase cage_base,
const SharedStringAccessGuardIfNeeded& access_guard) const {
DCHECK(index >= 0 && index < this->length());
// Check for a flattened cons string
if (second().length() == 0) {
String left = first();
if (second(cage_base).length() == 0) {
String left = first(cage_base);
return left.Get(index);
}
String string = String::cast(*this);
while (true) {
if (StringShape(string).IsCons()) {
if (StringShape(string, cage_base).IsCons()) {
ConsString cons_string = ConsString::cast(string);
String left = cons_string.first();
if (left.length() > index) {
string = left;
} else {
index -= left.length();
string = cons_string.second();
string = cons_string.second(cage_base);
}
} else {
return string.Get(index, access_guard);
return string.Get(index, cage_base, access_guard);
}
}
@ -1539,13 +1557,15 @@ uint16_t ConsString::Get(
}
uint16_t ThinString::Get(
int index, const SharedStringAccessGuardIfNeeded& access_guard) const {
return actual().Get(index, access_guard);
int index, PtrComprCageBase cage_base,
const SharedStringAccessGuardIfNeeded& access_guard) const {
return actual(cage_base).Get(index, cage_base, access_guard);
}
uint16_t SlicedString::Get(
int index, const SharedStringAccessGuardIfNeeded& access_guard) const {
return parent().Get(offset() + index, access_guard);
int index, PtrComprCageBase cage_base,
const SharedStringAccessGuardIfNeeded& access_guard) const {
return parent(cage_base).Get(offset() + index, cage_base, access_guard);
}
int ExternalString::ExternalPayloadSize() const {
@ -1744,10 +1764,10 @@ template EXPORT_TEMPLATE_DEFINE(V8_EXPORT_PRIVATE) void String::WriteToFlat(
template EXPORT_TEMPLATE_DEFINE(V8_EXPORT_PRIVATE) void String::WriteToFlat(
String source, uint8_t* sink, int from, int to);
template EXPORT_TEMPLATE_DEFINE(V8_EXPORT_PRIVATE) void String::WriteToFlat(
String source, uint16_t* sink, int from, int to,
String source, uint16_t* sink, int from, int to, PtrComprCageBase cage_base,
const SharedStringAccessGuardIfNeeded&);
template EXPORT_TEMPLATE_DEFINE(V8_EXPORT_PRIVATE) void String::WriteToFlat(
String source, uint8_t* sink, int from, int to,
String source, uint8_t* sink, int from, int to, PtrComprCageBase cage_base,
const SharedStringAccessGuardIfNeeded&);
namespace {

View File

@ -10,6 +10,7 @@
#include "src/base/bits.h"
#include "src/base/export-template.h"
#include "src/base/strings.h"
#include "src/common/globals.h"
#include "src/objects/instance-type.h"
#include "src/objects/name.h"
#include "src/objects/smi.h"
@ -43,6 +44,7 @@ enum RobustnessFlag { ROBUST_STRING_TRAVERSAL, FAST_STRING_TRAVERSAL };
class StringShape {
public:
inline explicit StringShape(const String s);
inline explicit StringShape(const String s, PtrComprCageBase cage_base);
inline explicit StringShape(Map s);
inline explicit StringShape(InstanceType t);
inline bool IsSequential() const;
@ -220,13 +222,15 @@ class String : public TorqueGeneratedString<String, Name> {
// to this method are not efficient unless the string is flat.
// If it is called from a background thread, the LocalIsolate version should
// be used.
V8_INLINE uint16_t Get(int index, Isolate* isolate = nullptr) const;
V8_INLINE uint16_t Get(int index) const;
V8_INLINE uint16_t Get(int index, Isolate* isolate) const;
V8_INLINE uint16_t Get(int index, LocalIsolate* local_isolate) const;
// Method to pass down the access_guard. Useful for recursive calls such as
// ThinStrings where we go String::Get into ThinString::Get into String::Get
// again for the internalized string.
V8_INLINE uint16_t
Get(int index, const SharedStringAccessGuardIfNeeded& access_guard) const;
Get(int index, PtrComprCageBase cage_base,
const SharedStringAccessGuardIfNeeded& access_guard) const;
// ES6 section 7.1.3.1 ToNumber Applied to the String Type
static Handle<Object> ToNumber(Isolate* isolate, Handle<String> subject);
@ -429,6 +433,7 @@ class String : public TorqueGeneratedString<String, Name> {
DECL_VERIFIER(String)
inline bool IsFlat() const;
inline bool IsFlat(PtrComprCageBase cage_base) const;
// Max char codes.
static const int32_t kMaxOneByteCharCode = unibrow::Latin1::kMaxChar;
@ -474,6 +479,7 @@ class String : public TorqueGeneratedString<String, Name> {
static void WriteToFlat(String source, sinkchar* sink, int from, int to);
template <typename sinkchar>
static void WriteToFlat(String source, sinkchar* sink, int from, int to,
PtrComprCageBase cage_base,
const SharedStringAccessGuardIfNeeded&);
static inline bool IsAscii(const char* chars, int length) {
@ -551,7 +557,8 @@ class String : public TorqueGeneratedString<String, Name> {
// Implementation of the Get() public methods. Do not use directly.
V8_INLINE uint16_t
GetImpl(int index, const SharedStringAccessGuardIfNeeded& access_guard) const;
GetImpl(int index, PtrComprCageBase cage_base,
const SharedStringAccessGuardIfNeeded& access_guard) const;
// Implementation of the IsEqualTo() public methods. Do not use directly.
template <EqualityType kEqType, typename Char>
@ -596,11 +603,13 @@ void String::WriteToFlat(String source, uint8_t* sink, int from, int to);
extern template EXPORT_TEMPLATE_DECLARE(V8_EXPORT_PRIVATE)
void String::WriteToFlat(String source, uint16_t* sink, int from, int to);
extern template EXPORT_TEMPLATE_DECLARE(V8_EXPORT_PRIVATE)
void String::WriteToFlat(String source, uint8_t* sink, int from, int to ,
const SharedStringAccessGuardIfNeeded&);
void String::WriteToFlat(String source, uint8_t* sink, int from, int to,
PtrComprCageBase cage_base,
const SharedStringAccessGuardIfNeeded&);
extern template EXPORT_TEMPLATE_DECLARE(V8_EXPORT_PRIVATE)
void String::WriteToFlat(String source, uint16_t* sink, int from, int to,
const SharedStringAccessGuardIfNeeded&);
PtrComprCageBase cage_base,
const SharedStringAccessGuardIfNeeded&);
// clang-format on
class SubStringRange {
@ -650,7 +659,7 @@ class SeqOneByteString
// defined for convenience and it will check that the access guard is not
// needed.
inline uint8_t Get(int index) const;
inline uint8_t Get(int index,
inline uint8_t Get(int index, PtrComprCageBase cage_base,
const SharedStringAccessGuardIfNeeded& access_guard) const;
inline void SeqOneByteStringSet(int index, uint16_t value);
@ -698,7 +707,8 @@ class SeqTwoByteString
// Dispatched behavior.
inline uint16_t Get(
int index, const SharedStringAccessGuardIfNeeded& access_guard) const;
int index, PtrComprCageBase cage_base,
const SharedStringAccessGuardIfNeeded& access_guard) const;
inline void SeqTwoByteStringSet(int index, uint16_t value);
// Get the address of the characters in this string.
@ -756,7 +766,8 @@ class ConsString : public TorqueGeneratedConsString<ConsString, String> {
// Dispatched behavior.
V8_EXPORT_PRIVATE uint16_t
Get(int index, const SharedStringAccessGuardIfNeeded& access_guard) const;
Get(int index, PtrComprCageBase cage_base,
const SharedStringAccessGuardIfNeeded& access_guard) const;
// Minimum length for a cons string.
static const int kMinLength = 13;
@ -780,7 +791,8 @@ class ThinString : public TorqueGeneratedThinString<ThinString, String> {
DECL_GETTER(unchecked_actual, HeapObject)
V8_EXPORT_PRIVATE uint16_t
Get(int index, const SharedStringAccessGuardIfNeeded& access_guard) const;
Get(int index, PtrComprCageBase cage_base,
const SharedStringAccessGuardIfNeeded& access_guard) const;
DECL_VERIFIER(ThinString)
@ -805,7 +817,8 @@ class SlicedString : public TorqueGeneratedSlicedString<SlicedString, String> {
WriteBarrierMode mode = UPDATE_WRITE_BARRIER);
// Dispatched behavior.
V8_EXPORT_PRIVATE uint16_t
Get(int index, const SharedStringAccessGuardIfNeeded& access_guard) const;
Get(int index, PtrComprCageBase cage_base,
const SharedStringAccessGuardIfNeeded& access_guard) const;
// Minimum length for a sliced string.
static const int kMinLength = 13;
@ -891,7 +904,7 @@ class ExternalOneByteString
inline const uint8_t* GetChars() const;
// Dispatched behavior.
inline uint8_t Get(int index,
inline uint8_t Get(int index, PtrComprCageBase cage_base,
const SharedStringAccessGuardIfNeeded& access_guard) const;
class BodyDescriptor;
@ -935,7 +948,8 @@ class ExternalTwoByteString
// Dispatched behavior.
inline uint16_t Get(
int index, const SharedStringAccessGuardIfNeeded& access_guard) const;
int index, PtrComprCageBase cage_base,
const SharedStringAccessGuardIfNeeded& access_guard) const;
// For regexp code.
inline const uint16_t* ExternalTwoByteStringGetData(unsigned start);