[offthread] Deisolatify dictionaries
Remove Isolate parameters from some dictionary methods, and change others to use ReadOnlyRoots instead, to prepare for Isolate templatization in a future patch. One small side-effect is that the global dictionary's property cell's dependent code deoptimization has to dynamically get the Isolate when it needs to actually mark code for deoptimization, for method signature consistency. Given that this is the slow path anyway, it shouldn't matter. Bug: chromium:1011762 Change-Id: I707de9a74ca3b30423a1e5830a10729d6a404786 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2080369 Commit-Queue: Ulan Degenbaev <ulan@chromium.org> Auto-Submit: Leszek Swirski <leszeks@chromium.org> Reviewed-by: Ulan Degenbaev <ulan@chromium.org> Reviewed-by: Igor Sheludko <ishell@chromium.org> Reviewed-by: Toon Verwaest <verwaest@chromium.org> Cr-Commit-Position: refs/heads/master@{#66574}
This commit is contained in:
parent
2f52803ea6
commit
e0c03dc34c
@ -1096,10 +1096,10 @@ void Heap::DeoptMarkedAllocationSites() {
|
||||
// TODO(hpayer): If iterating over the allocation sites list becomes a
|
||||
// performance issue, use a cache data structure in heap instead.
|
||||
|
||||
ForeachAllocationSite(allocation_sites_list(), [this](AllocationSite site) {
|
||||
ForeachAllocationSite(allocation_sites_list(), [](AllocationSite site) {
|
||||
if (site.deopt_dependent_code()) {
|
||||
site.dependent_code().MarkCodeForDeoptimization(
|
||||
isolate_, DependentCode::kAllocationSiteTenuringChangedGroup);
|
||||
DependentCode::kAllocationSiteTenuringChangedGroup);
|
||||
site.set_deopt_dependent_code(false);
|
||||
}
|
||||
});
|
||||
|
@ -225,7 +225,7 @@ bool AllocationSite::DigestTransitionFeedback(Handle<AllocationSite> site,
|
||||
}
|
||||
JSObject::TransitionElementsKind(boilerplate, to_kind);
|
||||
site->dependent_code().DeoptimizeDependentCodeGroup(
|
||||
isolate, DependentCode::kAllocationSiteTransitionChangedGroup);
|
||||
DependentCode::kAllocationSiteTransitionChangedGroup);
|
||||
result = true;
|
||||
}
|
||||
}
|
||||
@ -245,7 +245,7 @@ bool AllocationSite::DigestTransitionFeedback(Handle<AllocationSite> site,
|
||||
}
|
||||
site->SetElementsKind(to_kind);
|
||||
site->dependent_code().DeoptimizeDependentCodeGroup(
|
||||
isolate, DependentCode::kAllocationSiteTransitionChangedGroup);
|
||||
DependentCode::kAllocationSiteTransitionChangedGroup);
|
||||
result = true;
|
||||
}
|
||||
}
|
||||
|
@ -4,6 +4,7 @@
|
||||
|
||||
#include <iomanip>
|
||||
|
||||
#include "src/execution/isolate-utils.h"
|
||||
#include "src/objects/code.h"
|
||||
|
||||
#include "src/codegen/assembler-inl.h"
|
||||
@ -963,14 +964,14 @@ bool DependentCode::Compact() {
|
||||
}
|
||||
|
||||
bool DependentCode::MarkCodeForDeoptimization(
|
||||
Isolate* isolate, DependentCode::DependencyGroup group) {
|
||||
DependentCode::DependencyGroup group) {
|
||||
if (this->length() == 0 || this->group() > group) {
|
||||
// There is no such group.
|
||||
return false;
|
||||
}
|
||||
if (this->group() < group) {
|
||||
// The group comes later in the list.
|
||||
return next_link().MarkCodeForDeoptimization(isolate, group);
|
||||
return next_link().MarkCodeForDeoptimization(group);
|
||||
}
|
||||
DCHECK_EQ(group, this->group());
|
||||
DisallowHeapAllocation no_allocation_scope;
|
||||
@ -994,12 +995,12 @@ bool DependentCode::MarkCodeForDeoptimization(
|
||||
}
|
||||
|
||||
void DependentCode::DeoptimizeDependentCodeGroup(
|
||||
Isolate* isolate, DependentCode::DependencyGroup group) {
|
||||
DependentCode::DependencyGroup group) {
|
||||
DisallowHeapAllocation no_allocation_scope;
|
||||
bool marked = MarkCodeForDeoptimization(isolate, group);
|
||||
bool marked = MarkCodeForDeoptimization(group);
|
||||
if (marked) {
|
||||
DCHECK(AllowCodeDependencyChange::IsAllowed());
|
||||
Deoptimizer::DeoptimizeMarkedCode(isolate);
|
||||
Deoptimizer::DeoptimizeMarkedCode(GetIsolateFromWritableObject(*this));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -659,9 +659,9 @@ class DependentCode : public WeakFixedArray {
|
||||
Handle<HeapObject> object,
|
||||
DependencyGroup group);
|
||||
|
||||
void DeoptimizeDependentCodeGroup(Isolate* isolate, DependencyGroup group);
|
||||
void DeoptimizeDependentCodeGroup(DependencyGroup group);
|
||||
|
||||
bool MarkCodeForDeoptimization(Isolate* isolate, DependencyGroup group);
|
||||
bool MarkCodeForDeoptimization(DependencyGroup group);
|
||||
|
||||
// The following low-level accessors are exposed only for tests.
|
||||
inline DependencyGroup group();
|
||||
|
@ -23,7 +23,7 @@ class CompilationCacheShape : public BaseShape<HashTableKey*> {
|
||||
return key->IsMatch(value);
|
||||
}
|
||||
|
||||
static inline uint32_t Hash(Isolate* isolate, HashTableKey* key) {
|
||||
static inline uint32_t Hash(ReadOnlyRoots roots, HashTableKey* key) {
|
||||
return key->Hash();
|
||||
}
|
||||
|
||||
|
@ -54,10 +54,9 @@ PropertyDetails Dictionary<Derived, Shape>::DetailsAt(InternalIndex entry) {
|
||||
}
|
||||
|
||||
template <typename Derived, typename Shape>
|
||||
void Dictionary<Derived, Shape>::DetailsAtPut(Isolate* isolate,
|
||||
InternalIndex entry,
|
||||
void Dictionary<Derived, Shape>::DetailsAtPut(InternalIndex entry,
|
||||
PropertyDetails value) {
|
||||
Shape::DetailsAtPut(isolate, Derived::cast(*this), entry, value);
|
||||
Shape::DetailsAtPut(Derived::cast(*this), entry, value);
|
||||
}
|
||||
|
||||
template <typename Derived, typename Shape>
|
||||
@ -128,16 +127,15 @@ void NumberDictionary::set_requires_slow_elements() {
|
||||
}
|
||||
|
||||
template <typename Derived, typename Shape>
|
||||
void Dictionary<Derived, Shape>::ClearEntry(Isolate* isolate,
|
||||
InternalIndex entry) {
|
||||
void Dictionary<Derived, Shape>::ClearEntry(InternalIndex entry) {
|
||||
Object the_hole = this->GetReadOnlyRoots().the_hole_value();
|
||||
PropertyDetails details = PropertyDetails::Empty();
|
||||
Derived::cast(*this).SetEntry(isolate, entry, the_hole, the_hole, details);
|
||||
Derived::cast(*this).SetEntry(entry, the_hole, the_hole, details);
|
||||
}
|
||||
|
||||
template <typename Derived, typename Shape>
|
||||
void Dictionary<Derived, Shape>::SetEntry(Isolate* isolate, InternalIndex entry,
|
||||
Object key, Object value,
|
||||
void Dictionary<Derived, Shape>::SetEntry(InternalIndex entry, Object key,
|
||||
Object value,
|
||||
PropertyDetails details) {
|
||||
DCHECK(Dictionary::kEntrySize == 2 || Dictionary::kEntrySize == 3);
|
||||
DCHECK(!key.IsName() || details.dictionary_index() > 0);
|
||||
@ -146,7 +144,7 @@ void Dictionary<Derived, Shape>::SetEntry(Isolate* isolate, InternalIndex entry,
|
||||
WriteBarrierMode mode = this->GetWriteBarrierMode(no_gc);
|
||||
this->set(index + Derived::kEntryKeyIndex, key, mode);
|
||||
this->set(index + Derived::kEntryValueIndex, value, mode);
|
||||
if (Shape::kHasDetails) DetailsAtPut(isolate, entry, details);
|
||||
if (Shape::kHasDetails) DetailsAtPut(entry, details);
|
||||
}
|
||||
|
||||
template <typename Derived, typename Shape>
|
||||
@ -167,7 +165,7 @@ PropertyDetails BaseDictionaryShape<Key>::DetailsAt(Dictionary dict,
|
||||
|
||||
template <typename Key>
|
||||
template <typename Dictionary>
|
||||
void BaseDictionaryShape<Key>::DetailsAtPut(Isolate* isolate, Dictionary dict,
|
||||
void BaseDictionaryShape<Key>::DetailsAtPut(Dictionary dict,
|
||||
InternalIndex entry,
|
||||
PropertyDetails value) {
|
||||
STATIC_ASSERT(Dictionary::kEntrySize == 3);
|
||||
@ -234,12 +232,11 @@ Object GlobalDictionary::ValueAt(const Isolate* isolate, InternalIndex entry) {
|
||||
return CellAt(isolate, entry).value(isolate);
|
||||
}
|
||||
|
||||
void GlobalDictionary::SetEntry(Isolate* isolate, InternalIndex entry,
|
||||
Object key, Object value,
|
||||
void GlobalDictionary::SetEntry(InternalIndex entry, Object key, Object value,
|
||||
PropertyDetails details) {
|
||||
DCHECK_EQ(key, PropertyCell::cast(value).name());
|
||||
set(EntryToIndex(entry) + kEntryKeyIndex, value);
|
||||
DetailsAtPut(isolate, entry, details);
|
||||
DetailsAtPut(entry, details);
|
||||
}
|
||||
|
||||
void GlobalDictionary::ValueAtPut(InternalIndex entry, Object value) {
|
||||
@ -251,8 +248,8 @@ bool NumberDictionaryBaseShape::IsMatch(uint32_t key, Object other) {
|
||||
return key == static_cast<uint32_t>(other.Number());
|
||||
}
|
||||
|
||||
uint32_t NumberDictionaryBaseShape::Hash(Isolate* isolate, uint32_t key) {
|
||||
return ComputeSeededHash(key, HashSeed(isolate));
|
||||
uint32_t NumberDictionaryBaseShape::Hash(ReadOnlyRoots roots, uint32_t key) {
|
||||
return ComputeSeededHash(key, HashSeed(roots));
|
||||
}
|
||||
|
||||
uint32_t NumberDictionaryBaseShape::HashForObject(ReadOnlyRoots roots,
|
||||
@ -281,7 +278,7 @@ bool NameDictionaryShape::IsMatch(Handle<Name> key, Object other) {
|
||||
return *key == other;
|
||||
}
|
||||
|
||||
uint32_t NameDictionaryShape::Hash(Isolate* isolate, Handle<Name> key) {
|
||||
uint32_t NameDictionaryShape::Hash(ReadOnlyRoots roots, Handle<Name> key) {
|
||||
return key->Hash();
|
||||
}
|
||||
|
||||
@ -313,14 +310,13 @@ PropertyDetails GlobalDictionaryShape::DetailsAt(Dictionary dict,
|
||||
}
|
||||
|
||||
template <typename Dictionary>
|
||||
void GlobalDictionaryShape::DetailsAtPut(Isolate* isolate, Dictionary dict,
|
||||
InternalIndex entry,
|
||||
void GlobalDictionaryShape::DetailsAtPut(Dictionary dict, InternalIndex entry,
|
||||
PropertyDetails value) {
|
||||
DCHECK(entry.is_found());
|
||||
PropertyCell cell = dict.CellAt(entry);
|
||||
if (cell.property_details().IsReadOnly() != value.IsReadOnly()) {
|
||||
cell.dependent_code().DeoptimizeDependentCodeGroup(
|
||||
isolate, DependentCode::kPropertyCellChangedGroup);
|
||||
DependentCode::kPropertyCellChangedGroup);
|
||||
}
|
||||
cell.set_property_details(value);
|
||||
}
|
||||
|
@ -41,8 +41,7 @@ class EXPORT_TEMPLATE_DECLARE(V8_EXPORT_PRIVATE) Dictionary
|
||||
inline PropertyDetails DetailsAt(InternalIndex entry);
|
||||
|
||||
// Set the details for entry.
|
||||
inline void DetailsAtPut(Isolate* isolate, InternalIndex entry,
|
||||
PropertyDetails value);
|
||||
inline void DetailsAtPut(InternalIndex entry, PropertyDetails value);
|
||||
|
||||
// Delete a property from the dictionary.
|
||||
V8_WARN_UNUSED_RESULT static Handle<Derived> DeleteEntry(
|
||||
@ -66,9 +65,9 @@ class EXPORT_TEMPLATE_DECLARE(V8_EXPORT_PRIVATE) Dictionary
|
||||
Object SlowReverseLookup(Object value);
|
||||
|
||||
// Sets the entry to (key, value) pair.
|
||||
inline void ClearEntry(Isolate* isolate, InternalIndex entry);
|
||||
inline void SetEntry(Isolate* isolate, InternalIndex entry, Object key,
|
||||
Object value, PropertyDetails details);
|
||||
inline void ClearEntry(InternalIndex entry);
|
||||
inline void SetEntry(InternalIndex entry, Object key, Object value,
|
||||
PropertyDetails details);
|
||||
|
||||
// Garbage collection support.
|
||||
inline ObjectSlot RawFieldOfValueAt(InternalIndex entry);
|
||||
@ -102,14 +101,14 @@ class BaseDictionaryShape : public BaseShape<Key> {
|
||||
static inline PropertyDetails DetailsAt(Dictionary dict, InternalIndex entry);
|
||||
|
||||
template <typename Dictionary>
|
||||
static inline void DetailsAtPut(Isolate* isolate, Dictionary dict,
|
||||
InternalIndex entry, PropertyDetails value);
|
||||
static inline void DetailsAtPut(Dictionary dict, InternalIndex entry,
|
||||
PropertyDetails value);
|
||||
};
|
||||
|
||||
class NameDictionaryShape : public BaseDictionaryShape<Handle<Name>> {
|
||||
public:
|
||||
static inline bool IsMatch(Handle<Name> key, Object other);
|
||||
static inline uint32_t Hash(Isolate* isolate, Handle<Name> key);
|
||||
static inline uint32_t Hash(ReadOnlyRoots roots, Handle<Name> key);
|
||||
static inline uint32_t HashForObject(ReadOnlyRoots roots, Object object);
|
||||
static inline Handle<Object> AsHandle(Isolate* isolate, Handle<Name> key);
|
||||
static inline Handle<Map> GetMap(ReadOnlyRoots roots);
|
||||
@ -212,8 +211,8 @@ class V8_EXPORT_PRIVATE GlobalDictionaryShape : public NameDictionaryShape {
|
||||
static inline PropertyDetails DetailsAt(Dictionary dict, InternalIndex entry);
|
||||
|
||||
template <typename Dictionary>
|
||||
static inline void DetailsAtPut(Isolate* isolate, Dictionary dict,
|
||||
InternalIndex entry, PropertyDetails value);
|
||||
static inline void DetailsAtPut(Dictionary dict, InternalIndex entry,
|
||||
PropertyDetails value);
|
||||
|
||||
static inline Object Unwrap(Object key);
|
||||
static inline bool IsKey(ReadOnlyRoots roots, Object k);
|
||||
@ -232,8 +231,8 @@ class V8_EXPORT_PRIVATE GlobalDictionary
|
||||
inline Object ValueAt(const Isolate* isolate, InternalIndex entry);
|
||||
inline PropertyCell CellAt(InternalIndex entry);
|
||||
inline PropertyCell CellAt(const Isolate* isolate, InternalIndex entry);
|
||||
inline void SetEntry(Isolate* isolate, InternalIndex entry, Object key,
|
||||
Object value, PropertyDetails details);
|
||||
inline void SetEntry(InternalIndex entry, Object key, Object value,
|
||||
PropertyDetails details);
|
||||
inline Name NameAt(InternalIndex entry);
|
||||
inline Name NameAt(const Isolate* isolate, InternalIndex entry);
|
||||
inline void ValueAtPut(InternalIndex entry, Object value);
|
||||
@ -248,7 +247,7 @@ class NumberDictionaryBaseShape : public BaseDictionaryShape<uint32_t> {
|
||||
static inline bool IsMatch(uint32_t key, Object other);
|
||||
static inline Handle<Object> AsHandle(Isolate* isolate, uint32_t key);
|
||||
|
||||
static inline uint32_t Hash(Isolate* isolate, uint32_t key);
|
||||
static inline uint32_t Hash(ReadOnlyRoots roots, uint32_t key);
|
||||
static inline uint32_t HashForObject(ReadOnlyRoots roots, Object object);
|
||||
};
|
||||
|
||||
@ -273,8 +272,8 @@ class SimpleNumberDictionaryShape : public NumberDictionaryBaseShape {
|
||||
}
|
||||
|
||||
template <typename Dictionary>
|
||||
static inline void DetailsAtPut(Isolate* isolate, Dictionary dict,
|
||||
InternalIndex entry, PropertyDetails value) {
|
||||
static inline void DetailsAtPut(Dictionary dict, InternalIndex entry,
|
||||
PropertyDetails value) {
|
||||
UNREACHABLE();
|
||||
}
|
||||
|
||||
|
@ -1384,7 +1384,7 @@ class DictionaryElementsAccessor
|
||||
if (dict->IsKey(roots, index)) {
|
||||
uint32_t number = static_cast<uint32_t>(index.Number());
|
||||
if (length <= number && number < old_length) {
|
||||
dict->ClearEntry(isolate, entry);
|
||||
dict->ClearEntry(entry);
|
||||
removed_entries++;
|
||||
}
|
||||
}
|
||||
@ -1461,7 +1461,7 @@ class DictionaryElementsAccessor
|
||||
details = PropertyDetails(kData, attributes, PropertyCellType::kNoCell,
|
||||
details.dictionary_index());
|
||||
|
||||
dictionary.DetailsAtPut(object->GetIsolate(), entry, details);
|
||||
dictionary.DetailsAtPut(entry, details);
|
||||
}
|
||||
|
||||
static void AddImpl(Handle<JSObject> object, uint32_t index,
|
||||
|
@ -133,7 +133,13 @@ Handle<Map> EphemeronHashTableShape::GetMap(ReadOnlyRoots roots) {
|
||||
|
||||
template <typename Derived, typename Shape>
|
||||
InternalIndex HashTable<Derived, Shape>::FindEntry(Isolate* isolate, Key key) {
|
||||
return FindEntry(ReadOnlyRoots(isolate), key, Shape::Hash(isolate, key));
|
||||
return FindEntry(ReadOnlyRoots(isolate), key);
|
||||
}
|
||||
|
||||
template <typename Derived, typename Shape>
|
||||
InternalIndex HashTable<Derived, Shape>::FindEntry(ReadOnlyRoots roots,
|
||||
Key key) {
|
||||
return FindEntry(roots, key, Shape::Hash(roots, key));
|
||||
}
|
||||
|
||||
// Find entry for key otherwise return kNotFound.
|
||||
@ -237,7 +243,7 @@ bool ObjectHashTableShape::IsMatch(Handle<Object> key, Object other) {
|
||||
return key->SameValue(other);
|
||||
}
|
||||
|
||||
uint32_t ObjectHashTableShape::Hash(Isolate* isolate, Handle<Object> key) {
|
||||
uint32_t ObjectHashTableShape::Hash(ReadOnlyRoots roots, Handle<Object> key) {
|
||||
return Smi::ToInt(key->GetHash());
|
||||
}
|
||||
|
||||
|
@ -38,7 +38,7 @@ namespace internal {
|
||||
// // Tells whether key matches other.
|
||||
// static bool IsMatch(Key key, Object other);
|
||||
// // Returns the hash value for key.
|
||||
// static uint32_t Hash(Isolate* isolate, Key key);
|
||||
// static uint32_t Hash(ReadOnlyRoots roots, Key key);
|
||||
// // Returns the hash value for object.
|
||||
// static uint32_t HashForObject(ReadOnlyRoots roots, Object object);
|
||||
// // Convert key to an object.
|
||||
@ -140,6 +140,7 @@ class EXPORT_TEMPLATE_DECLARE(V8_EXPORT_PRIVATE) HashTable
|
||||
|
||||
// Find entry for key otherwise return kNotFound.
|
||||
inline InternalIndex FindEntry(ReadOnlyRoots roots, Key key, int32_t hash);
|
||||
inline InternalIndex FindEntry(ReadOnlyRoots roots, Key key);
|
||||
inline InternalIndex FindEntry(Isolate* isolate, Key key);
|
||||
|
||||
// Rehashes the table in-place.
|
||||
@ -273,7 +274,7 @@ class HashTableKey {
|
||||
class ObjectHashTableShape : public BaseShape<Handle<Object>> {
|
||||
public:
|
||||
static inline bool IsMatch(Handle<Object> key, Object other);
|
||||
static inline uint32_t Hash(Isolate* isolate, Handle<Object> key);
|
||||
static inline uint32_t Hash(ReadOnlyRoots roots, Handle<Object> key);
|
||||
static inline uint32_t HashForObject(ReadOnlyRoots roots, Object object);
|
||||
static inline Handle<Object> AsHandle(Handle<Object> key);
|
||||
static const int kPrefixSize = 0;
|
||||
|
@ -2377,7 +2377,7 @@ void JSObject::SetNormalizedProperty(Handle<JSObject> object, Handle<Name> name,
|
||||
int enumeration_index = original_details.dictionary_index();
|
||||
DCHECK_GT(enumeration_index, 0);
|
||||
details = details.set_index(enumeration_index);
|
||||
dictionary->SetEntry(isolate, entry, *name, *value, details);
|
||||
dictionary->SetEntry(entry, *name, *value, details);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -3797,7 +3797,7 @@ void JSObject::ApplyAttributesToDictionary(
|
||||
if (v.IsAccessorPair()) attrs &= ~READ_ONLY;
|
||||
}
|
||||
details = details.CopyAddAttributes(static_cast<PropertyAttributes>(attrs));
|
||||
dictionary->DetailsAtPut(isolate, i, details);
|
||||
dictionary->DetailsAtPut(i, details);
|
||||
}
|
||||
}
|
||||
|
||||
@ -5107,7 +5107,7 @@ void SetInstancePrototype(Isolate* isolate, Handle<JSFunction> function,
|
||||
|
||||
// Deoptimize all code that embeds the previous initial map.
|
||||
initial_map->dependent_code().DeoptimizeDependentCodeGroup(
|
||||
isolate, DependentCode::kInitialMapChangedGroup);
|
||||
DependentCode::kInitialMapChangedGroup);
|
||||
} else {
|
||||
// Put the value in the initial map field until an initial map is
|
||||
// needed. At that point, a new initial map is created and the
|
||||
|
@ -161,7 +161,7 @@ bool JSFinalizationRegistry::RemoveUnregisterToken(
|
||||
}
|
||||
if (new_key_list_head.IsUndefined(isolate)) {
|
||||
DCHECK(was_present);
|
||||
key_map.ClearEntry(isolate, entry);
|
||||
key_map.ClearEntry(entry);
|
||||
key_map.ElementRemoved();
|
||||
} else {
|
||||
key_map.ValueAtPut(entry, new_key_list_head);
|
||||
|
@ -126,7 +126,7 @@ void AddToDictionaryTemplate(Isolate* isolate, Handle<Dictionary> dictionary,
|
||||
Key key, int key_index,
|
||||
ClassBoilerplate::ValueKind value_kind,
|
||||
Smi value) {
|
||||
InternalIndex entry = dictionary->FindEntry(isolate, key);
|
||||
InternalIndex entry = dictionary->FindEntry(ReadOnlyRoots(isolate), key);
|
||||
|
||||
if (entry.is_not_found()) {
|
||||
// Entry not found, add new one.
|
||||
@ -184,7 +184,7 @@ void AddToDictionaryTemplate(Isolate* isolate, Handle<Dictionary> dictionary,
|
||||
// was not defined yet, so overwrite property to kData.
|
||||
PropertyDetails details(kData, DONT_ENUM, PropertyCellType::kNoCell,
|
||||
enum_order);
|
||||
dictionary->DetailsAtPut(isolate, entry, details);
|
||||
dictionary->DetailsAtPut(entry, details);
|
||||
dictionary->ValueAtPut(entry, value);
|
||||
|
||||
} else {
|
||||
@ -218,7 +218,7 @@ void AddToDictionaryTemplate(Isolate* isolate, Handle<Dictionary> dictionary,
|
||||
if (!existing_value.IsSmi() || Smi::ToInt(existing_value) < key_index) {
|
||||
PropertyDetails details(kData, DONT_ENUM, PropertyCellType::kNoCell,
|
||||
enum_order);
|
||||
dictionary->DetailsAtPut(isolate, entry, details);
|
||||
dictionary->DetailsAtPut(entry, details);
|
||||
dictionary->ValueAtPut(entry, value);
|
||||
}
|
||||
}
|
||||
@ -242,7 +242,7 @@ void AddToDictionaryTemplate(Isolate* isolate, Handle<Dictionary> dictionary,
|
||||
pair->set(component, value);
|
||||
PropertyDetails details(kAccessor, DONT_ENUM, PropertyCellType::kNoCell,
|
||||
enum_order);
|
||||
dictionary->DetailsAtPut(isolate, entry, details);
|
||||
dictionary->DetailsAtPut(entry, details);
|
||||
dictionary->ValueAtPut(entry, *pair);
|
||||
}
|
||||
}
|
||||
|
@ -537,8 +537,7 @@ void LookupIterator::ReconfigureDataProperty(Handle<Object> value,
|
||||
int enumeration_index = original_details.dictionary_index();
|
||||
DCHECK_GT(enumeration_index, 0);
|
||||
details = details.set_index(enumeration_index);
|
||||
dictionary->SetEntry(isolate(), dictionary_entry(), *name(), *value,
|
||||
details);
|
||||
dictionary->SetEntry(dictionary_entry(), *name(), *value, details);
|
||||
property_details_ = details;
|
||||
}
|
||||
state_ = DATA;
|
||||
|
@ -574,7 +574,7 @@ void Map::NotifyLeafMapLayoutChange(Isolate* isolate) {
|
||||
if (is_stable()) {
|
||||
mark_unstable();
|
||||
dependent_code().DeoptimizeDependentCodeGroup(
|
||||
isolate, DependentCode::kPrototypeCheckGroup);
|
||||
DependentCode::kPrototypeCheckGroup);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -601,7 +601,7 @@ void Map::DeprecateTransitionTree(Isolate* isolate) {
|
||||
LOG(isolate, MapEvent("Deprecate", handle(*this, isolate), Handle<Map>()));
|
||||
}
|
||||
dependent_code().DeoptimizeDependentCodeGroup(
|
||||
isolate, DependentCode::kTransitionGroup);
|
||||
DependentCode::kTransitionGroup);
|
||||
NotifyLeafMapLayoutChange(isolate);
|
||||
}
|
||||
|
||||
@ -782,7 +782,7 @@ void Map::GeneralizeField(Isolate* isolate, Handle<Map> map,
|
||||
field_owner->UpdateFieldType(isolate, modify_index, name, new_constness,
|
||||
new_representation, wrapped_type);
|
||||
field_owner->dependent_code().DeoptimizeDependentCodeGroup(
|
||||
isolate, DependentCode::kFieldOwnerGroup);
|
||||
DependentCode::kFieldOwnerGroup);
|
||||
|
||||
if (FLAG_trace_generalization) {
|
||||
map->PrintGeneralization(
|
||||
@ -2197,7 +2197,7 @@ Handle<Map> Map::TransitionToDataProperty(Isolate* isolate, Handle<Map> map,
|
||||
|
||||
// Deoptimize all code that embeds the previous initial map.
|
||||
initial_map->dependent_code().DeoptimizeDependentCodeGroup(
|
||||
isolate, DependentCode::kInitialMapChangedGroup);
|
||||
DependentCode::kInitialMapChangedGroup);
|
||||
if (!result->EquivalentToForNormalization(*map,
|
||||
CLEAR_INOBJECT_PROPERTIES)) {
|
||||
result =
|
||||
|
@ -6947,7 +6947,7 @@ Handle<StringSet> StringSet::Add(Isolate* isolate, Handle<StringSet> stringset,
|
||||
Handle<String> name) {
|
||||
if (!stringset->Has(isolate, name)) {
|
||||
stringset = EnsureCapacity(isolate, stringset);
|
||||
uint32_t hash = ShapeT::Hash(isolate, *name);
|
||||
uint32_t hash = ShapeT::Hash(ReadOnlyRoots(isolate), *name);
|
||||
InternalIndex entry = stringset->FindInsertionEntry(hash);
|
||||
stringset->set(EntryToIndex(entry), *name);
|
||||
stringset->ElementAdded();
|
||||
@ -7294,7 +7294,7 @@ int BaseNameDictionary<Derived, Shape>::NextEnumerationIndex(
|
||||
|
||||
PropertyDetails details = dictionary->DetailsAt(index);
|
||||
PropertyDetails new_details = details.set_index(enum_index);
|
||||
dictionary->DetailsAtPut(isolate, index, new_details);
|
||||
dictionary->DetailsAtPut(index, new_details);
|
||||
}
|
||||
|
||||
index = PropertyDetails::kInitialIndex + length;
|
||||
@ -7310,7 +7310,7 @@ Handle<Derived> Dictionary<Derived, Shape>::DeleteEntry(
|
||||
Isolate* isolate, Handle<Derived> dictionary, InternalIndex entry) {
|
||||
DCHECK(Shape::kEntrySize != 3 ||
|
||||
dictionary->DetailsAt(entry).IsConfigurable());
|
||||
dictionary->ClearEntry(isolate, entry);
|
||||
dictionary->ClearEntry(entry);
|
||||
dictionary->ElementRemoved();
|
||||
return Shrink(isolate, dictionary);
|
||||
}
|
||||
@ -7329,7 +7329,7 @@ Handle<Derived> Dictionary<Derived, Shape>::AtPut(Isolate* isolate,
|
||||
|
||||
// We don't need to copy over the enumeration index.
|
||||
dictionary->ValueAtPut(entry, *value);
|
||||
if (Shape::kEntrySize == 3) dictionary->DetailsAtPut(isolate, entry, details);
|
||||
if (Shape::kEntrySize == 3) dictionary->DetailsAtPut(entry, details);
|
||||
return dictionary;
|
||||
}
|
||||
|
||||
@ -7367,9 +7367,10 @@ Handle<Derived> Dictionary<Derived, Shape>::Add(Isolate* isolate,
|
||||
Key key, Handle<Object> value,
|
||||
PropertyDetails details,
|
||||
InternalIndex* entry_out) {
|
||||
uint32_t hash = Shape::Hash(isolate, key);
|
||||
uint32_t hash = Shape::Hash(ReadOnlyRoots(isolate), key);
|
||||
// Validate that the key is absent.
|
||||
SLOW_DCHECK(dictionary->FindEntry(isolate, key).is_not_found());
|
||||
SLOW_DCHECK(
|
||||
dictionary->FindEntry(ReadOnlyRoots(isolate), key).is_not_found());
|
||||
// Check whether the dictionary should be extended.
|
||||
dictionary = Derived::EnsureCapacity(isolate, dictionary);
|
||||
|
||||
@ -7377,7 +7378,7 @@ Handle<Derived> Dictionary<Derived, Shape>::Add(Isolate* isolate,
|
||||
Handle<Object> k = Shape::AsHandle(isolate, key);
|
||||
|
||||
InternalIndex entry = dictionary->FindInsertionEntry(hash);
|
||||
dictionary->SetEntry(isolate, entry, *k, *value, details);
|
||||
dictionary->SetEntry(entry, *k, *value, details);
|
||||
DCHECK(dictionary->KeyAt(entry).IsNumber() ||
|
||||
Shape::Unwrap(dictionary->KeyAt(entry)).IsUniqueName());
|
||||
dictionary->ElementAdded();
|
||||
@ -7912,7 +7913,7 @@ Handle<PropertyCell> PropertyCell::InvalidateEntry(
|
||||
details = details.set_cell_type(PropertyCellType::kInvalidated);
|
||||
cell->set_property_details(details);
|
||||
cell->dependent_code().DeoptimizeDependentCodeGroup(
|
||||
isolate, DependentCode::kPropertyCellChangedGroup);
|
||||
DependentCode::kPropertyCellChangedGroup);
|
||||
return new_cell;
|
||||
}
|
||||
|
||||
@ -8013,7 +8014,7 @@ Handle<PropertyCell> PropertyCell::PrepareForValue(
|
||||
if (!invalidate && (old_type != new_type ||
|
||||
original_details.IsReadOnly() != details.IsReadOnly())) {
|
||||
cell->dependent_code().DeoptimizeDependentCodeGroup(
|
||||
isolate, DependentCode::kPropertyCellChangedGroup);
|
||||
DependentCode::kPropertyCellChangedGroup);
|
||||
}
|
||||
return cell;
|
||||
}
|
||||
@ -8026,7 +8027,7 @@ void PropertyCell::SetValueWithInvalidation(Isolate* isolate,
|
||||
if (cell->value() != *new_value) {
|
||||
cell->set_value(*new_value);
|
||||
cell->dependent_code().DeoptimizeDependentCodeGroup(
|
||||
isolate, DependentCode::kPropertyCellChangedGroup);
|
||||
DependentCode::kPropertyCellChangedGroup);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -398,10 +398,10 @@ MaybeHandle<OrderedNameDictionary> OrderedNameDictionary::Add(
|
||||
return table;
|
||||
}
|
||||
|
||||
void OrderedNameDictionary::SetEntry(Isolate* isolate, int entry, Object key,
|
||||
Object value, PropertyDetails details) {
|
||||
void OrderedNameDictionary::SetEntry(int entry, Object key, Object value,
|
||||
PropertyDetails details) {
|
||||
DisallowHeapAllocation gc;
|
||||
DCHECK_IMPLIES(!key.IsName(), key.IsTheHole(isolate));
|
||||
DCHECK_IMPLIES(!key.IsName(), key.IsTheHole());
|
||||
DisallowHeapAllocation no_gc;
|
||||
int index = EntryToIndex(entry);
|
||||
this->set(index, key);
|
||||
@ -419,7 +419,7 @@ Handle<OrderedNameDictionary> OrderedNameDictionary::DeleteEntry(
|
||||
|
||||
Object hole = ReadOnlyRoots(isolate).the_hole_value();
|
||||
PropertyDetails details = PropertyDetails::Empty();
|
||||
table->SetEntry(isolate, entry, hole, hole, details);
|
||||
table->SetEntry(entry, hole, hole, details);
|
||||
|
||||
int nof = table->NumberOfElements();
|
||||
table->SetNumberOfElements(nof - 1);
|
||||
@ -718,10 +718,9 @@ MaybeHandle<SmallOrderedNameDictionary> SmallOrderedNameDictionary::Add(
|
||||
return table;
|
||||
}
|
||||
|
||||
void SmallOrderedNameDictionary::SetEntry(Isolate* isolate, int entry,
|
||||
Object key, Object value,
|
||||
void SmallOrderedNameDictionary::SetEntry(int entry, Object key, Object value,
|
||||
PropertyDetails details) {
|
||||
DCHECK_IMPLIES(!key.IsName(), key.IsTheHole(isolate));
|
||||
DCHECK_IMPLIES(!key.IsName(), key.IsTheHole());
|
||||
SetDataEntry(entry, SmallOrderedNameDictionary::kValueIndex, value);
|
||||
SetDataEntry(entry, SmallOrderedNameDictionary::kKeyIndex, key);
|
||||
|
||||
@ -766,7 +765,7 @@ Handle<SmallOrderedNameDictionary> SmallOrderedNameDictionary::DeleteEntry(
|
||||
DisallowHeapAllocation no_gc;
|
||||
Object hole = ReadOnlyRoots(isolate).the_hole_value();
|
||||
PropertyDetails details = PropertyDetails::Empty();
|
||||
table->SetEntry(isolate, entry, hole, hole, details);
|
||||
table->SetEntry(entry, hole, hole, details);
|
||||
|
||||
int nof = table->NumberOfElements();
|
||||
table->SetNumberOfElements(nof - 1);
|
||||
@ -1160,17 +1159,17 @@ MaybeHandle<HeapObject> OrderedNameDictionaryHandler::Add(
|
||||
isolate, Handle<OrderedNameDictionary>::cast(table), key, value, details);
|
||||
}
|
||||
|
||||
void OrderedNameDictionaryHandler::SetEntry(Isolate* isolate, HeapObject table,
|
||||
int entry, Object key, Object value,
|
||||
void OrderedNameDictionaryHandler::SetEntry(HeapObject table, int entry,
|
||||
Object key, Object value,
|
||||
PropertyDetails details) {
|
||||
DisallowHeapAllocation no_gc;
|
||||
if (table.IsSmallOrderedNameDictionary()) {
|
||||
return SmallOrderedNameDictionary::cast(table).SetEntry(isolate, entry, key,
|
||||
value, details);
|
||||
return SmallOrderedNameDictionary::cast(table).SetEntry(entry, key, value,
|
||||
details);
|
||||
}
|
||||
|
||||
DCHECK(table.IsOrderedNameDictionary());
|
||||
return OrderedNameDictionary::cast(table).SetEntry(isolate, entry, key, value,
|
||||
return OrderedNameDictionary::cast(table).SetEntry(entry, key, value,
|
||||
details);
|
||||
}
|
||||
|
||||
|
@ -701,8 +701,8 @@ class OrderedNameDictionary
|
||||
Isolate* isolate, Handle<OrderedNameDictionary> table, Handle<Name> key,
|
||||
Handle<Object> value, PropertyDetails details);
|
||||
|
||||
V8_EXPORT_PRIVATE void SetEntry(Isolate* isolate, int entry, Object key,
|
||||
Object value, PropertyDetails details);
|
||||
V8_EXPORT_PRIVATE void SetEntry(int entry, Object key, Object value,
|
||||
PropertyDetails details);
|
||||
|
||||
V8_EXPORT_PRIVATE static Handle<OrderedNameDictionary> DeleteEntry(
|
||||
Isolate* isolate, Handle<OrderedNameDictionary> table, int entry);
|
||||
@ -756,8 +756,8 @@ class V8_EXPORT_PRIVATE OrderedNameDictionaryHandler
|
||||
static Handle<HeapObject> DeleteEntry(Isolate* isolate,
|
||||
Handle<HeapObject> table, int entry);
|
||||
static int FindEntry(Isolate* isolate, HeapObject table, Name key);
|
||||
static void SetEntry(Isolate* isolate, HeapObject table, int entry,
|
||||
Object key, Object value, PropertyDetails details);
|
||||
static void SetEntry(HeapObject table, int entry, Object key, Object value,
|
||||
PropertyDetails details);
|
||||
|
||||
// Returns the value for entry.
|
||||
static Object ValueAt(HeapObject table, int entry);
|
||||
@ -829,8 +829,8 @@ class SmallOrderedNameDictionary
|
||||
Isolate* isolate, Handle<SmallOrderedNameDictionary> table,
|
||||
Handle<Name> key, Handle<Object> value, PropertyDetails details);
|
||||
|
||||
V8_EXPORT_PRIVATE void SetEntry(Isolate* isolate, int entry, Object key,
|
||||
Object value, PropertyDetails details);
|
||||
V8_EXPORT_PRIVATE void SetEntry(int entry, Object key, Object value,
|
||||
PropertyDetails details);
|
||||
|
||||
static inline Handle<Map> GetMap(ReadOnlyRoots roots);
|
||||
static inline bool Is(Handle<HeapObject> table);
|
||||
|
@ -32,7 +32,7 @@ bool StringSetShape::IsMatch(String key, Object value) {
|
||||
return key.Equals(String::cast(value));
|
||||
}
|
||||
|
||||
uint32_t StringSetShape::Hash(Isolate* isolate, String key) {
|
||||
uint32_t StringSetShape::Hash(ReadOnlyRoots roots, String key) {
|
||||
return key.Hash();
|
||||
}
|
||||
|
||||
@ -59,7 +59,7 @@ uint32_t StringTableKey::hash() const {
|
||||
}
|
||||
|
||||
// static
|
||||
uint32_t StringTableShape::Hash(Isolate* isolate, Key key) {
|
||||
uint32_t StringTableShape::Hash(ReadOnlyRoots roots, Key key) {
|
||||
return key->hash();
|
||||
}
|
||||
|
||||
|
@ -41,7 +41,7 @@ class V8_EXPORT_PRIVATE StringTableShape : public BaseShape<StringTableKey*> {
|
||||
public:
|
||||
static inline bool IsMatch(Key key, Object value);
|
||||
|
||||
static inline uint32_t Hash(Isolate* isolate, Key key);
|
||||
static inline uint32_t Hash(ReadOnlyRoots roots, Key key);
|
||||
|
||||
static inline uint32_t HashForObject(ReadOnlyRoots roots, Object object);
|
||||
|
||||
@ -100,7 +100,7 @@ class V8_EXPORT_PRIVATE StringTable
|
||||
class StringSetShape : public BaseShape<String> {
|
||||
public:
|
||||
static inline bool IsMatch(String key, Object value);
|
||||
static inline uint32_t Hash(Isolate* isolate, String key);
|
||||
static inline uint32_t Hash(ReadOnlyRoots roots, String key);
|
||||
static inline uint32_t HashForObject(ReadOnlyRoots roots, Object object);
|
||||
|
||||
static const int kPrefixSize = 0;
|
||||
|
@ -1950,7 +1950,7 @@ TEST(OrderedNameDictionarySetEntry) {
|
||||
Handle<String> other_value = isolate->factory()->InternalizeUtf8String("baz");
|
||||
PropertyDetails other_details =
|
||||
PropertyDetails(kAccessor, READ_ONLY, PropertyCellType::kNoCell);
|
||||
dict->SetEntry(isolate, entry, *key, *other_value, other_details);
|
||||
dict->SetEntry(entry, *key, *other_value, other_details);
|
||||
|
||||
entry = dict->FindEntry(isolate, *key);
|
||||
CHECK_EQ(0, entry);
|
||||
@ -1995,7 +1995,7 @@ TEST(SmallOrderedNameDictionarySetEntry) {
|
||||
Handle<String> other_value = factory->InternalizeUtf8String("baz");
|
||||
PropertyDetails other_details =
|
||||
PropertyDetails(kAccessor, READ_ONLY, PropertyCellType::kNoCell);
|
||||
dict->SetEntry(isolate, entry, *key, *other_value, other_details);
|
||||
dict->SetEntry(entry, *key, *other_value, other_details);
|
||||
|
||||
entry = dict->FindEntry(isolate, *key);
|
||||
CHECK_EQ(0, entry);
|
||||
|
Loading…
Reference in New Issue
Block a user