#include "src/objects/string-table.h"
#include <atomic>
#include "src/base/atomicops.h"
#include "src/base/macros.h"
#include "src/common/assert-scope.h"
#include "src/common/globals.h"
#include "src/common/ptr-compr-inl.h"
#include "src/execution/isolate-utils-inl.h"
#include "src/heap/safepoint.h"
#include "src/objects/internal-index.h"
#include "src/objects/object-list-macros.h"
#include "src/objects/off-heap-hash-table-inl.h"
#include "src/objects/slots-inl.h"
#include "src/objects/slots.h"
#include "src/objects/string-inl.h"
#include "src/objects/string-table-inl.h"
#include "src/snapshot/deserializer.h"
#include "src/utils/allocation.h"
#include "src/utils/ostreams.h"
namespace v8 {
namespace internal {
class StringTable::OffHeapStringHashSet
: public OffHeapHashTableBase<OffHeapStringHashSet> { … };
class StringTable::Data { … };
void* StringTable::Data::operator new(size_t size, int capacity) { … }
void StringTable::Data::operator delete(void* table) { … }
size_t StringTable::Data::GetCurrentMemoryUsage() const { … }
std::unique_ptr<StringTable::Data> StringTable::Data::New(int capacity) { … }
std::unique_ptr<StringTable::Data> StringTable::Data::Resize(
PtrComprCageBase cage_base, std::unique_ptr<Data> data, int capacity) { … }
void StringTable::Data::Print(PtrComprCageBase cage_base) const { … }
StringTable::StringTable(Isolate* isolate)
: … { … }
StringTable::~StringTable() { … }
int StringTable::Capacity() const { … }
int StringTable::NumberOfElements() const { … }
class InternalizedStringKey final : public StringTableKey { … };
namespace {
void SetInternalizedReference(Isolate* isolate, Tagged<String> string,
Tagged<String> internalized) { … }
}
DirectHandle<String> StringTable::LookupString(Isolate* isolate,
DirectHandle<String> string) { … }
template <typename StringTableKey, typename IsolateT>
DirectHandle<String> StringTable::LookupKey(IsolateT* isolate,
StringTableKey* key) { … }
template DirectHandle<String> StringTable::LookupKey(Isolate* isolate,
OneByteStringKey* key);
template DirectHandle<String> StringTable::LookupKey(Isolate* isolate,
TwoByteStringKey* key);
template DirectHandle<String> StringTable::LookupKey(
Isolate* isolate, SeqOneByteSubStringKey* key);
template DirectHandle<String> StringTable::LookupKey(
Isolate* isolate, SeqTwoByteSubStringKey* key);
template DirectHandle<String> StringTable::LookupKey(LocalIsolate* isolate,
OneByteStringKey* key);
template DirectHandle<String> StringTable::LookupKey(LocalIsolate* isolate,
TwoByteStringKey* key);
template DirectHandle<String> StringTable::LookupKey(
Isolate* isolate, StringTableInsertionKey* key);
template DirectHandle<String> StringTable::LookupKey(
LocalIsolate* isolate, StringTableInsertionKey* key);
StringTable::Data* StringTable::EnsureCapacity(PtrComprCageBase cage_base,
int additional_elements) { … }
namespace {
template <typename Char>
class CharBuffer { … };
}
template <typename Char>
Address StringTable::Data::TryStringToIndexOrLookupExisting(
Isolate* isolate, Tagged<String> string, Tagged<String> source,
size_t start) { … }
Address StringTable::TryStringToIndexOrLookupExisting(Isolate* isolate,
Address raw_string) { … }
void StringTable::InsertForIsolateDeserialization(
Isolate* isolate, const base::Vector<DirectHandle<String>>& strings) { … }
void StringTable::InsertEmptyStringForBootstrapping(Isolate* isolate) { … }
void StringTable::Print(PtrComprCageBase cage_base) const { … }
size_t StringTable::GetCurrentMemoryUsage() const { … }
void StringTable::IterateElements(RootVisitor* visitor) { … }
void StringTable::DropOldData() { … }
void StringTable::NotifyElementsRemoved(int count) { … }
}
}