[GetIsolate] Remove GetIsolate use in PropertyCell

Bug: v8:7786
Change-Id: I2d2e62001294c15411e26b022cad410d54577927
Reviewed-on: https://chromium-review.googlesource.com/1111837
Commit-Queue: Leszek Swirski <leszeks@chromium.org>
Reviewed-by: Dan Elphick <delphick@chromium.org>
Cr-Commit-Position: refs/heads/master@{#53988}
This commit is contained in:
Leszek Swirski 2018-06-23 10:07:20 +01:00 committed by Commit Bot
parent 83ac43275e
commit a7da55e66d
4 changed files with 33 additions and 31 deletions

View File

@ -3494,7 +3494,7 @@ void Isolate::UpdateNoElementsProtectorOnSetElement(Handle<JSObject> object) {
if (!IsNoElementsProtectorIntact()) return;
if (!IsArrayOrObjectOrStringPrototype(*object)) return;
PropertyCell::SetValueWithInvalidation(
factory()->no_elements_protector(),
this, factory()->no_elements_protector(),
handle(Smi::FromInt(kProtectorInvalid), this));
}
@ -3550,7 +3550,7 @@ void Isolate::InvalidateArrayIteratorProtector() {
DCHECK(factory()->array_iterator_protector()->value()->IsSmi());
DCHECK(IsArrayIteratorLookupChainIntact());
PropertyCell::SetValueWithInvalidation(
factory()->array_iterator_protector(),
this, factory()->array_iterator_protector(),
handle(Smi::FromInt(kProtectorInvalid), this));
DCHECK(!IsArrayIteratorLookupChainIntact());
}
@ -3559,7 +3559,7 @@ void Isolate::InvalidateArrayBufferNeuteringProtector() {
DCHECK(factory()->array_buffer_neutering_protector()->value()->IsSmi());
DCHECK(IsArrayBufferNeuteringIntact());
PropertyCell::SetValueWithInvalidation(
factory()->array_buffer_neutering_protector(),
this, factory()->array_buffer_neutering_protector(),
handle(Smi::FromInt(kProtectorInvalid), this));
DCHECK(!IsArrayBufferNeuteringIntact());
}
@ -3568,7 +3568,7 @@ void Isolate::InvalidatePromiseHookProtector() {
DCHECK(factory()->promise_hook_protector()->value()->IsSmi());
DCHECK(IsPromiseHookProtectorIntact());
PropertyCell::SetValueWithInvalidation(
factory()->promise_hook_protector(),
this, factory()->promise_hook_protector(),
handle(Smi::FromInt(kProtectorInvalid), this));
DCHECK(!IsPromiseHookProtectorIntact());
}
@ -3585,7 +3585,7 @@ void Isolate::InvalidatePromiseThenProtector() {
DCHECK(factory()->promise_then_protector()->value()->IsSmi());
DCHECK(IsPromiseThenLookupChainIntact());
PropertyCell::SetValueWithInvalidation(
factory()->promise_then_protector(),
this, factory()->promise_then_protector(),
handle(Smi::FromInt(kProtectorInvalid), this));
DCHECK(!IsPromiseThenLookupChainIntact());
}

View File

@ -407,8 +407,8 @@ void LookupIterator::PrepareForDataProperty(Handle<Object> value) {
Handle<PropertyCell> cell(dictionary->CellAt(dictionary_entry()),
isolate());
property_details_ = cell->property_details();
PropertyCell::PrepareForValue(dictionary, dictionary_entry(), value,
property_details_);
PropertyCell::PrepareForValue(isolate(), dictionary, dictionary_entry(),
value, property_details_);
return;
}
if (!holder_obj->HasFastProperties()) return;
@ -492,7 +492,7 @@ void LookupIterator::ReconfigureDataProperty(Handle<Object> value,
JSGlobalObject::cast(*holder_obj)->global_dictionary(), isolate());
Handle<PropertyCell> cell = PropertyCell::PrepareForValue(
dictionary, dictionary_entry(), value, details);
isolate(), dictionary, dictionary_entry(), value, details);
cell->set_value(*value);
property_details_ = cell->property_details();
} else {
@ -560,7 +560,7 @@ void LookupIterator::PrepareTransitionToDataProperty(
property_details_ = PropertyDetails(
kData, attributes, PropertyCellType::kUninitialized, index);
PropertyCellType new_type =
PropertyCell::UpdatedType(cell, value, property_details_);
PropertyCell::UpdatedType(isolate(), cell, value, property_details_);
property_details_ = property_details_.set_cell_type(new_type);
cell->set_property_details(property_details_);
number_ = entry;

View File

@ -2034,8 +2034,8 @@ void JSObject::SetNormalizedProperty(Handle<JSObject> object,
dictionary = GlobalDictionary::Add(dictionary, name, value, details);
global_obj->set_global_dictionary(*dictionary);
} else {
Handle<PropertyCell> cell =
PropertyCell::PrepareForValue(dictionary, entry, value, details);
Handle<PropertyCell> cell = PropertyCell::PrepareForValue(
isolate, dictionary, entry, value, details);
cell->set_value(*value);
}
} else {
@ -6687,7 +6687,7 @@ void JSReceiver::DeleteNormalizedProperty(Handle<JSReceiver> object,
JSGlobalObject::cast(*object)->global_dictionary(), isolate);
DCHECK_NE(GlobalDictionary::kNotFound, entry);
auto cell = PropertyCell::InvalidateEntry(dictionary, entry);
auto cell = PropertyCell::InvalidateEntry(isolate, dictionary, entry);
cell->set_value(isolate->heap()->the_hole_value());
cell->set_property_details(
PropertyDetails::Empty(PropertyCellType::kUninitialized));
@ -16879,7 +16879,7 @@ void JSGlobalObject::InvalidatePropertyCell(Handle<JSGlobalObject> global,
auto dictionary = handle(global->global_dictionary(), global->GetIsolate());
int entry = dictionary->FindEntry(name);
if (entry == GlobalDictionary::kNotFound) return;
PropertyCell::InvalidateEntry(dictionary, entry);
PropertyCell::InvalidateEntry(global->GetIsolate(), dictionary, entry);
}
Handle<PropertyCell> JSGlobalObject::EnsureEmptyPropertyCell(
@ -16898,7 +16898,7 @@ Handle<PropertyCell> JSGlobalObject::EnsureEmptyPropertyCell(
original_cell_type == PropertyCellType::kUninitialized);
DCHECK(cell->value()->IsTheHole(isolate));
if (original_cell_type == PropertyCellType::kInvalidated) {
cell = PropertyCell::InvalidateEntry(dictionary, entry);
cell = PropertyCell::InvalidateEntry(isolate, dictionary, entry);
}
PropertyDetails details(kData, NONE, cell_type);
cell->set_property_details(details);
@ -18682,8 +18682,7 @@ Handle<JSArrayBuffer> JSTypedArray::GetBuffer() {
}
Handle<PropertyCell> PropertyCell::InvalidateEntry(
Handle<GlobalDictionary> dictionary, int entry) {
Isolate* isolate = dictionary->GetIsolate();
Isolate* isolate, Handle<GlobalDictionary> dictionary, int entry) {
// Swap with a copy.
Handle<PropertyCell> cell(dictionary->CellAt(entry), isolate);
Handle<Name> name(cell->name(), isolate);
@ -18729,12 +18728,11 @@ static bool RemainsConstantType(Handle<PropertyCell> cell,
return false;
}
PropertyCellType PropertyCell::UpdatedType(Handle<PropertyCell> cell,
PropertyCellType PropertyCell::UpdatedType(Isolate* isolate,
Handle<PropertyCell> cell,
Handle<Object> value,
PropertyDetails details) {
PropertyCellType type = details.cell_type();
Isolate* isolate = cell->GetIsolate();
DCHECK(!value->IsTheHole(isolate));
if (cell->value()->IsTheHole(isolate)) {
switch (type) {
@ -18766,9 +18764,8 @@ PropertyCellType PropertyCell::UpdatedType(Handle<PropertyCell> cell,
}
Handle<PropertyCell> PropertyCell::PrepareForValue(
Handle<GlobalDictionary> dictionary, int entry, Handle<Object> value,
PropertyDetails details) {
Isolate* isolate = dictionary->GetIsolate();
Isolate* isolate, Handle<GlobalDictionary> dictionary, int entry,
Handle<Object> value, PropertyDetails details) {
DCHECK(!value->IsTheHole(isolate));
Handle<PropertyCell> cell(dictionary->CellAt(entry), isolate);
const PropertyDetails original_details = cell->property_details();
@ -18789,8 +18786,11 @@ Handle<PropertyCell> PropertyCell::PrepareForValue(
DCHECK_LT(0, index);
details = details.set_index(index);
PropertyCellType new_type = UpdatedType(cell, value, original_details);
if (invalidate) cell = PropertyCell::InvalidateEntry(dictionary, entry);
PropertyCellType new_type =
UpdatedType(isolate, cell, value, original_details);
if (invalidate) {
cell = PropertyCell::InvalidateEntry(isolate, dictionary, entry);
}
// Install new property details.
details = details.set_cell_type(new_type);
@ -18815,11 +18815,11 @@ Handle<PropertyCell> PropertyCell::PrepareForValue(
// static
void PropertyCell::SetValueWithInvalidation(Handle<PropertyCell> cell,
void PropertyCell::SetValueWithInvalidation(Isolate* isolate,
Handle<PropertyCell> cell,
Handle<Object> new_value) {
if (cell->value() != *new_value) {
cell->set_value(*new_value);
Isolate* isolate = cell->GetIsolate();
cell->dependent_code()->DeoptimizeDependentCodeGroup(
isolate, DependentCode::kPropertyCellChangedGroup);
}

View File

@ -4252,20 +4252,22 @@ class PropertyCell : public HeapObject {
// Computes the new type of the cell's contents for the given value, but
// without actually modifying the details.
static PropertyCellType UpdatedType(Handle<PropertyCell> cell,
static PropertyCellType UpdatedType(Isolate* isolate,
Handle<PropertyCell> cell,
Handle<Object> value,
PropertyDetails details);
// Prepares property cell at given entry for receiving given value.
// As a result the old cell could be invalidated and/or dependent code could
// be deoptimized. Returns the prepared property cell.
static Handle<PropertyCell> PrepareForValue(
Handle<GlobalDictionary> dictionary, int entry, Handle<Object> value,
PropertyDetails details);
Isolate* isolate, Handle<GlobalDictionary> dictionary, int entry,
Handle<Object> value, PropertyDetails details);
static Handle<PropertyCell> InvalidateEntry(
Handle<GlobalDictionary> dictionary, int entry);
Isolate* isolate, Handle<GlobalDictionary> dictionary, int entry);
static void SetValueWithInvalidation(Handle<PropertyCell> cell,
static void SetValueWithInvalidation(Isolate* isolate,
Handle<PropertyCell> cell,
Handle<Object> new_value);
DECL_CAST(PropertyCell)