Commit 9f720a68 authored by Toon Verwaest's avatar Toon Verwaest Committed by Commit Bot

[ic] Drop check_global from PropertyCellStore handler

We don't invalidate the map of the global object anymore.

BUG=v8:5561

Change-Id: I006066e9b675dd3d118efc8d00687b97419c427b
Reviewed-on: https://chromium-review.googlesource.com/456417Reviewed-by: 's avatarIgor Sheludko <ishell@chromium.org>
Commit-Queue: Toon Verwaest <verwaest@chromium.org>
Cr-Commit-Position: refs/heads/master@{#43906}
parent 9e074945
...@@ -1496,12 +1496,11 @@ void StoreGlobalStub::GenerateAssembly( ...@@ -1496,12 +1496,11 @@ void StoreGlobalStub::GenerateAssembly(
typedef compiler::Node Node; typedef compiler::Node Node;
CodeStubAssembler assembler(state); CodeStubAssembler assembler(state);
assembler.Comment( assembler.Comment("StoreGlobalStub: cell_type=%d, constant_type=%d",
"StoreGlobalStub: cell_type=%d, constant_type=%d, check_global=%d", cell_type(),
cell_type(), PropertyCellType::kConstantType == cell_type() PropertyCellType::kConstantType == cell_type()
? static_cast<int>(constant_type()) ? static_cast<int>(constant_type())
: -1, : -1);
check_global());
Node* receiver = assembler.Parameter(Descriptor::kReceiver); Node* receiver = assembler.Parameter(Descriptor::kReceiver);
Node* name = assembler.Parameter(Descriptor::kName); Node* name = assembler.Parameter(Descriptor::kName);
...@@ -1512,18 +1511,6 @@ void StoreGlobalStub::GenerateAssembly( ...@@ -1512,18 +1511,6 @@ void StoreGlobalStub::GenerateAssembly(
Label miss(&assembler); Label miss(&assembler);
if (check_global()) {
// Check that the map of the global has not changed: use a placeholder map
// that will be replaced later with the global object's map.
Node* proxy_map = assembler.LoadMap(receiver);
Node* global = assembler.LoadObjectField(proxy_map, Map::kPrototypeOffset);
Node* map_cell = assembler.HeapConstant(isolate()->factory()->NewWeakCell(
StoreGlobalStub::global_map_placeholder(isolate())));
Node* expected_map = assembler.LoadWeakCellValueUnchecked(map_cell);
Node* map = assembler.LoadMap(global);
assembler.GotoIf(assembler.WordNotEqual(expected_map, map), &miss);
}
Node* weak_cell = assembler.HeapConstant(isolate()->factory()->NewWeakCell( Node* weak_cell = assembler.HeapConstant(isolate()->factory()->NewWeakCell(
StoreGlobalStub::property_cell_placeholder(isolate()))); StoreGlobalStub::property_cell_placeholder(isolate())));
Node* cell = assembler.LoadWeakCellValue(weak_cell); Node* cell = assembler.LoadWeakCellValue(weak_cell);
......
...@@ -898,14 +898,12 @@ class KeyedStoreSloppyArgumentsStub : public TurboFanCodeStub { ...@@ -898,14 +898,12 @@ class KeyedStoreSloppyArgumentsStub : public TurboFanCodeStub {
class StoreGlobalStub : public TurboFanCodeStub { class StoreGlobalStub : public TurboFanCodeStub {
public: public:
StoreGlobalStub(Isolate* isolate, PropertyCellType type, StoreGlobalStub(Isolate* isolate, PropertyCellType type,
Maybe<PropertyCellConstantType> constant_type, Maybe<PropertyCellConstantType> constant_type)
bool check_global)
: TurboFanCodeStub(isolate) { : TurboFanCodeStub(isolate) {
PropertyCellConstantType encoded_constant_type = PropertyCellConstantType encoded_constant_type =
constant_type.FromMaybe(PropertyCellConstantType::kSmi); constant_type.FromMaybe(PropertyCellConstantType::kSmi);
minor_key_ = CellTypeBits::encode(type) | minor_key_ = CellTypeBits::encode(type) |
ConstantTypeBits::encode(encoded_constant_type) | ConstantTypeBits::encode(encoded_constant_type);
CheckGlobalBits::encode(check_global);
} }
Code::Kind GetCodeKind() const override { return Code::HANDLER; } Code::Kind GetCodeKind() const override { return Code::HANDLER; }
...@@ -915,17 +913,8 @@ class StoreGlobalStub : public TurboFanCodeStub { ...@@ -915,17 +913,8 @@ class StoreGlobalStub : public TurboFanCodeStub {
return isolate->factory()->uninitialized_value(); return isolate->factory()->uninitialized_value();
} }
static Handle<HeapObject> global_map_placeholder(Isolate* isolate) { Handle<Code> GetCodeCopyFromTemplate(Handle<PropertyCell> cell) {
return isolate->factory()->termination_exception();
}
Handle<Code> GetCodeCopyFromTemplate(Handle<JSGlobalObject> global,
Handle<PropertyCell> cell) {
FindAndReplacePattern pattern; FindAndReplacePattern pattern;
if (check_global()) {
pattern.Add(handle(global_map_placeholder(isolate())->map()),
Map::WeakCellForMap(Handle<Map>(global->map())));
}
pattern.Add(handle(property_cell_placeholder(isolate())->map()), pattern.Add(handle(property_cell_placeholder(isolate())->map()),
isolate()->factory()->NewWeakCell(cell)); isolate()->factory()->NewWeakCell(cell));
return CodeStub::GetCodeCopy(pattern); return CodeStub::GetCodeCopy(pattern);
...@@ -940,13 +929,10 @@ class StoreGlobalStub : public TurboFanCodeStub { ...@@ -940,13 +929,10 @@ class StoreGlobalStub : public TurboFanCodeStub {
return ConstantTypeBits::decode(minor_key_); return ConstantTypeBits::decode(minor_key_);
} }
bool check_global() const { return CheckGlobalBits::decode(minor_key_); }
private: private:
class CellTypeBits : public BitField<PropertyCellType, 0, 2> {}; class CellTypeBits : public BitField<PropertyCellType, 0, 2> {};
class ConstantTypeBits class ConstantTypeBits
: public BitField<PropertyCellConstantType, CellTypeBits::kNext, 2> {}; : public BitField<PropertyCellConstantType, CellTypeBits::kNext, 2> {};
class CheckGlobalBits : public BitField<bool, ConstantTypeBits::kNext, 1> {};
DEFINE_CALL_INTERFACE_DESCRIPTOR(StoreWithVector); DEFINE_CALL_INTERFACE_DESCRIPTOR(StoreWithVector);
DEFINE_TURBOFAN_CODE_STUB(StoreGlobal, TurboFanCodeStub); DEFINE_TURBOFAN_CODE_STUB(StoreGlobal, TurboFanCodeStub);
......
...@@ -1848,18 +1848,19 @@ Handle<Object> StoreIC::StoreTransition(Handle<Map> receiver_map, ...@@ -1848,18 +1848,19 @@ Handle<Object> StoreIC::StoreTransition(Handle<Map> receiver_map,
return handler_array; return handler_array;
} }
static Handle<Code> PropertyCellStoreHandler( static Handle<Code> PropertyCellStoreHandler(Isolate* isolate,
Isolate* isolate, Handle<JSObject> receiver, Handle<JSGlobalObject> holder, Handle<JSObject> store_target,
Handle<Name> name, Handle<PropertyCell> cell, PropertyCellType type) { Handle<Name> name,
Handle<PropertyCell> cell,
PropertyCellType type) {
auto constant_type = Nothing<PropertyCellConstantType>(); auto constant_type = Nothing<PropertyCellConstantType>();
if (type == PropertyCellType::kConstantType) { if (type == PropertyCellType::kConstantType) {
constant_type = Just(cell->GetConstantType()); constant_type = Just(cell->GetConstantType());
} }
StoreGlobalStub stub(isolate, type, constant_type, StoreGlobalStub stub(isolate, type, constant_type);
receiver->IsJSGlobalProxy()); auto code = stub.GetCodeCopyFromTemplate(cell);
auto code = stub.GetCodeCopyFromTemplate(holder, cell);
// TODO(verwaest): Move caching of these NORMAL stubs outside as well. // TODO(verwaest): Move caching of these NORMAL stubs outside as well.
HeapObject::UpdateMapCodeCache(receiver, name, code); HeapObject::UpdateMapCodeCache(store_target, name, code);
return code; return code;
} }
...@@ -2010,9 +2011,9 @@ Handle<Object> StoreIC::CompileHandler(LookupIterator* lookup, ...@@ -2010,9 +2011,9 @@ Handle<Object> StoreIC::CompileHandler(LookupIterator* lookup,
TRACE_HANDLER_STATS(isolate(), StoreIC_StoreGlobalTransition); TRACE_HANDLER_STATS(isolate(), StoreIC_StoreGlobalTransition);
Handle<PropertyCell> cell = lookup->transition_cell(); Handle<PropertyCell> cell = lookup->transition_cell();
cell->set_value(*value); cell->set_value(*value);
Handle<Code> code = PropertyCellStoreHandler( Handle<Code> code =
isolate(), store_target, Handle<JSGlobalObject>::cast(store_target), PropertyCellStoreHandler(isolate(), receiver, lookup->name(), cell,
lookup->name(), cell, PropertyCellType::kConstant); PropertyCellType::kConstant);
cell->set_value(isolate()->heap()->the_hole_value()); cell->set_value(isolate()->heap()->the_hole_value());
return code; return code;
} }
...@@ -2078,7 +2079,6 @@ Handle<Object> StoreIC::CompileHandler(LookupIterator* lookup, ...@@ -2078,7 +2079,6 @@ Handle<Object> StoreIC::CompileHandler(LookupIterator* lookup,
auto updated_type = auto updated_type =
PropertyCell::UpdatedType(cell, value, lookup->property_details()); PropertyCell::UpdatedType(cell, value, lookup->property_details());
auto code = PropertyCellStoreHandler(isolate(), receiver, auto code = PropertyCellStoreHandler(isolate(), receiver,
Handle<JSGlobalObject>::cast(holder),
lookup->name(), cell, updated_type); lookup->name(), cell, updated_type);
return code; return code;
} }
......
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