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(
typedef compiler::Node Node;
CodeStubAssembler assembler(state);
assembler.Comment(
"StoreGlobalStub: cell_type=%d, constant_type=%d, check_global=%d",
cell_type(), PropertyCellType::kConstantType == cell_type()
? static_cast<int>(constant_type())
: -1,
check_global());
assembler.Comment("StoreGlobalStub: cell_type=%d, constant_type=%d",
cell_type(),
PropertyCellType::kConstantType == cell_type()
? static_cast<int>(constant_type())
: -1);
Node* receiver = assembler.Parameter(Descriptor::kReceiver);
Node* name = assembler.Parameter(Descriptor::kName);
......@@ -1512,18 +1511,6 @@ void StoreGlobalStub::GenerateAssembly(
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(
StoreGlobalStub::property_cell_placeholder(isolate())));
Node* cell = assembler.LoadWeakCellValue(weak_cell);
......
......@@ -898,14 +898,12 @@ class KeyedStoreSloppyArgumentsStub : public TurboFanCodeStub {
class StoreGlobalStub : public TurboFanCodeStub {
public:
StoreGlobalStub(Isolate* isolate, PropertyCellType type,
Maybe<PropertyCellConstantType> constant_type,
bool check_global)
Maybe<PropertyCellConstantType> constant_type)
: TurboFanCodeStub(isolate) {
PropertyCellConstantType encoded_constant_type =
constant_type.FromMaybe(PropertyCellConstantType::kSmi);
minor_key_ = CellTypeBits::encode(type) |
ConstantTypeBits::encode(encoded_constant_type) |
CheckGlobalBits::encode(check_global);
ConstantTypeBits::encode(encoded_constant_type);
}
Code::Kind GetCodeKind() const override { return Code::HANDLER; }
......@@ -915,17 +913,8 @@ class StoreGlobalStub : public TurboFanCodeStub {
return isolate->factory()->uninitialized_value();
}
static Handle<HeapObject> global_map_placeholder(Isolate* isolate) {
return isolate->factory()->termination_exception();
}
Handle<Code> GetCodeCopyFromTemplate(Handle<JSGlobalObject> global,
Handle<PropertyCell> cell) {
Handle<Code> GetCodeCopyFromTemplate(Handle<PropertyCell> cell) {
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()),
isolate()->factory()->NewWeakCell(cell));
return CodeStub::GetCodeCopy(pattern);
......@@ -940,13 +929,10 @@ class StoreGlobalStub : public TurboFanCodeStub {
return ConstantTypeBits::decode(minor_key_);
}
bool check_global() const { return CheckGlobalBits::decode(minor_key_); }
private:
class CellTypeBits : public BitField<PropertyCellType, 0, 2> {};
class ConstantTypeBits
: public BitField<PropertyCellConstantType, CellTypeBits::kNext, 2> {};
class CheckGlobalBits : public BitField<bool, ConstantTypeBits::kNext, 1> {};
DEFINE_CALL_INTERFACE_DESCRIPTOR(StoreWithVector);
DEFINE_TURBOFAN_CODE_STUB(StoreGlobal, TurboFanCodeStub);
......
......@@ -1848,18 +1848,19 @@ Handle<Object> StoreIC::StoreTransition(Handle<Map> receiver_map,
return handler_array;
}
static Handle<Code> PropertyCellStoreHandler(
Isolate* isolate, Handle<JSObject> receiver, Handle<JSGlobalObject> holder,
Handle<Name> name, Handle<PropertyCell> cell, PropertyCellType type) {
static Handle<Code> PropertyCellStoreHandler(Isolate* isolate,
Handle<JSObject> store_target,
Handle<Name> name,
Handle<PropertyCell> cell,
PropertyCellType type) {
auto constant_type = Nothing<PropertyCellConstantType>();
if (type == PropertyCellType::kConstantType) {
constant_type = Just(cell->GetConstantType());
}
StoreGlobalStub stub(isolate, type, constant_type,
receiver->IsJSGlobalProxy());
auto code = stub.GetCodeCopyFromTemplate(holder, cell);
StoreGlobalStub stub(isolate, type, constant_type);
auto code = stub.GetCodeCopyFromTemplate(cell);
// TODO(verwaest): Move caching of these NORMAL stubs outside as well.
HeapObject::UpdateMapCodeCache(receiver, name, code);
HeapObject::UpdateMapCodeCache(store_target, name, code);
return code;
}
......@@ -2010,9 +2011,9 @@ Handle<Object> StoreIC::CompileHandler(LookupIterator* lookup,
TRACE_HANDLER_STATS(isolate(), StoreIC_StoreGlobalTransition);
Handle<PropertyCell> cell = lookup->transition_cell();
cell->set_value(*value);
Handle<Code> code = PropertyCellStoreHandler(
isolate(), store_target, Handle<JSGlobalObject>::cast(store_target),
lookup->name(), cell, PropertyCellType::kConstant);
Handle<Code> code =
PropertyCellStoreHandler(isolate(), receiver, lookup->name(), cell,
PropertyCellType::kConstant);
cell->set_value(isolate()->heap()->the_hole_value());
return code;
}
......@@ -2078,7 +2079,6 @@ Handle<Object> StoreIC::CompileHandler(LookupIterator* lookup,
auto updated_type =
PropertyCell::UpdatedType(cell, value, lookup->property_details());
auto code = PropertyCellStoreHandler(isolate(), receiver,
Handle<JSGlobalObject>::cast(holder),
lookup->name(), cell, updated_type);
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