Commit f6e08f43 authored by Bill Budge's avatar Bill Budge Committed by Commit Bot

Revert "[ic] Inline constant fields in IC"

This reverts commit 8ee507f1.

Reason for revert: Speculative, to unblock the V8 roller

https://ci.chromium.org/p/chromium/builders/try/linux-rel/173637

Original change's description:
> [ic] Inline constant fields in IC
> 
> Previously, the handler would load the constant field from the holder
> everytime by using the descriptor index. Instead, this patch inlines
> the constant field directly into the handler.
> 
> Change-Id: Ia731811b135897033f4c5dc973031a30f25a64ed
> Bug: v8:9616
> Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1688829
> Commit-Queue: Sathya Gunasekaran  <gsathya@chromium.org>
> Reviewed-by: Igor Sheludko <ishell@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#63332}

TBR=gsathya@chromium.org,ishell@chromium.org,verwaest@chromium.org

Change-Id: I36c5648c56f1d78447b7a45504cdebf593c020a1
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: v8:9616
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1766148Reviewed-by: 's avatarBill Budge <bbudge@chromium.org>
Commit-Queue: Bill Budge <bbudge@chromium.org>
Cr-Commit-Position: refs/heads/master@{#63353}
parent 1a815e44
...@@ -301,7 +301,6 @@ void AccessorAssembler::HandleLoadICSmiHandlerCase( ...@@ -301,7 +301,6 @@ void AccessorAssembler::HandleLoadICSmiHandlerCase(
TNode<WordT> handler_word = SmiUntag(smi_handler); TNode<WordT> handler_word = SmiUntag(smi_handler);
TNode<IntPtrT> handler_kind = TNode<IntPtrT> handler_kind =
Signed(DecodeWord<LoadHandler::KindBits>(handler_word)); Signed(DecodeWord<LoadHandler::KindBits>(handler_word));
if (support_elements == kSupportElements) { if (support_elements == kSupportElements) {
Label if_element(this), if_indexed_string(this), if_property(this); Label if_element(this), if_indexed_string(this), if_property(this);
GotoIf(WordEqual(handler_kind, IntPtrConstant(LoadHandler::kElement)), GotoIf(WordEqual(handler_kind, IntPtrConstant(LoadHandler::kElement)),
...@@ -427,11 +426,9 @@ void AccessorAssembler::HandleLoadICSmiHandlerLoadNamedCase( ...@@ -427,11 +426,9 @@ void AccessorAssembler::HandleLoadICSmiHandlerLoadNamedCase(
module_export(this, Label::kDeferred), proxy(this, Label::kDeferred), module_export(this, Label::kDeferred), proxy(this, Label::kDeferred),
native_data_property(this, Label::kDeferred), native_data_property(this, Label::kDeferred),
api_getter(this, Label::kDeferred); api_getter(this, Label::kDeferred);
GotoIf(WordEqual(handler_kind, IntPtrConstant(LoadHandler::kField)), &field); GotoIf(WordEqual(handler_kind, IntPtrConstant(LoadHandler::kField)), &field);
GotoIf(WordEqual(handler_kind, GotoIf(WordEqual(handler_kind, IntPtrConstant(LoadHandler::kConstant)),
IntPtrConstant(LoadHandler::kConstantFromPrototype)),
&constant); &constant);
GotoIf(WordEqual(handler_kind, IntPtrConstant(LoadHandler::kNonExistent)), GotoIf(WordEqual(handler_kind, IntPtrConstant(LoadHandler::kNonExistent)),
...@@ -479,7 +476,11 @@ void AccessorAssembler::HandleLoadICSmiHandlerLoadNamedCase( ...@@ -479,7 +476,11 @@ void AccessorAssembler::HandleLoadICSmiHandlerLoadNamedCase(
BIND(&constant); BIND(&constant);
{ {
Comment("constant_load"); Comment("constant_load");
exit_point->Return(holder); TNode<IntPtrT> descriptor =
Signed(DecodeWord<LoadHandler::DescriptorBits>(handler_word));
Node* value = LoadDescriptorValue(LoadMap(holder), descriptor);
exit_point->Return(value);
} }
BIND(&normal); BIND(&normal);
...@@ -621,8 +622,7 @@ void AccessorAssembler::HandleLoadICSmiHandlerHasNamedCase( ...@@ -621,8 +622,7 @@ void AccessorAssembler::HandleLoadICSmiHandlerHasNamedCase(
GotoIf(WordEqual(handler_kind, IntPtrConstant(LoadHandler::kField)), GotoIf(WordEqual(handler_kind, IntPtrConstant(LoadHandler::kField)),
&return_true); &return_true);
GotoIf(WordEqual(handler_kind, GotoIf(WordEqual(handler_kind, IntPtrConstant(LoadHandler::kConstant)),
IntPtrConstant(LoadHandler::kConstantFromPrototype)),
&return_true); &return_true);
GotoIf(WordEqual(handler_kind, IntPtrConstant(LoadHandler::kNonExistent)), GotoIf(WordEqual(handler_kind, IntPtrConstant(LoadHandler::kNonExistent)),
...@@ -832,37 +832,21 @@ void AccessorAssembler::HandleLoadICProtoHandler( ...@@ -832,37 +832,21 @@ void AccessorAssembler::HandleLoadICProtoHandler(
}, },
miss, ic_mode); miss, ic_mode);
TNode<MaybeObject> maybe_holder_or_constant = TNode<MaybeObject> maybe_holder = LoadHandlerDataField(handler, 1);
LoadHandlerDataField(handler, 1);
Label load_from_cached_holder(this), is_smi(this), done(this); Label load_from_cached_holder(this), done(this);
GotoIf(TaggedIsSmi(maybe_holder_or_constant), &is_smi); Branch(IsStrongReferenceTo(maybe_holder, NullConstant()), &done,
Branch(IsStrongReferenceTo(maybe_holder_or_constant, NullConstant()), &done,
&load_from_cached_holder); &load_from_cached_holder);
BIND(&is_smi);
{
CSA_ASSERT(
this,
WordEqual(
Signed(DecodeWord<LoadHandler::KindBits>(SmiUntag(smi_handler))),
IntPtrConstant(LoadHandler::kConstantFromPrototype)));
if (access_mode == LoadAccessMode::kHas) {
exit_point->Return(TrueConstant());
} else {
exit_point->Return(maybe_holder_or_constant);
}
}
BIND(&load_from_cached_holder); BIND(&load_from_cached_holder);
{ {
// For regular holders, having passed the receiver map check and // For regular holders, having passed the receiver map check and the
// the validity cell check implies that |holder| is // validity cell check implies that |holder| is alive. However, for global
// alive. However, for global object receivers, |maybe_holder| may // object receivers, |maybe_holder| may be cleared.
// be cleared. CSA_ASSERT(this, IsWeakOrCleared(maybe_holder));
CSA_ASSERT(this, IsWeakOrCleared(maybe_holder_or_constant)); Node* holder = GetHeapObjectAssumeWeak(maybe_holder, miss);
Node* holder = GetHeapObjectAssumeWeak(maybe_holder_or_constant, miss);
var_holder->Bind(holder); var_holder->Bind(holder);
Goto(&done); Goto(&done);
} }
......
...@@ -51,8 +51,8 @@ Handle<Smi> LoadHandler::LoadField(Isolate* isolate, FieldIndex field_index) { ...@@ -51,8 +51,8 @@ Handle<Smi> LoadHandler::LoadField(Isolate* isolate, FieldIndex field_index) {
return handle(Smi::FromInt(config), isolate); return handle(Smi::FromInt(config), isolate);
} }
Handle<Smi> LoadHandler::LoadConstantFromPrototype(Isolate* isolate) { Handle<Smi> LoadHandler::LoadConstant(Isolate* isolate, int descriptor) {
int config = KindBits::encode(kConstantFromPrototype); int config = KindBits::encode(kConstant) | DescriptorBits::encode(descriptor);
return handle(Smi::FromInt(config), isolate); return handle(Smi::FromInt(config), isolate);
} }
......
...@@ -37,7 +37,7 @@ class LoadHandler final : public DataHandler { ...@@ -37,7 +37,7 @@ class LoadHandler final : public DataHandler {
kNormal, kNormal,
kGlobal, kGlobal,
kField, kField,
kConstantFromPrototype, kConstant,
kAccessor, kAccessor,
kNativeDataProperty, kNativeDataProperty,
kApiGetter, kApiGetter,
...@@ -116,9 +116,8 @@ class LoadHandler final : public DataHandler { ...@@ -116,9 +116,8 @@ class LoadHandler final : public DataHandler {
// Creates a Smi-handler for loading a field from fast object. // Creates a Smi-handler for loading a field from fast object.
static inline Handle<Smi> LoadField(Isolate* isolate, FieldIndex field_index); static inline Handle<Smi> LoadField(Isolate* isolate, FieldIndex field_index);
// Creates a Smi-handler for loading a cached constant from fast // Creates a Smi-handler for loading a constant from fast object.
// prototype object. static inline Handle<Smi> LoadConstant(Isolate* isolate, int descriptor);
static inline Handle<Smi> LoadConstantFromPrototype(Isolate* isolate);
// Creates a Smi-handler for calling a getter on a fast object. // Creates a Smi-handler for calling a getter on a fast object.
static inline Handle<Smi> LoadAccessor(Isolate* isolate, int descriptor); static inline Handle<Smi> LoadAccessor(Isolate* isolate, int descriptor);
......
...@@ -897,18 +897,6 @@ Handle<Object> LoadIC::ComputeHandler(LookupIterator* lookup) { ...@@ -897,18 +897,6 @@ Handle<Object> LoadIC::ComputeHandler(LookupIterator* lookup) {
if (receiver_is_holder) return smi_handler; if (receiver_is_holder) return smi_handler;
TRACE_HANDLER_STATS(isolate(), LoadIC_LoadFieldFromPrototypeDH); TRACE_HANDLER_STATS(isolate(), LoadIC_LoadFieldFromPrototypeDH);
} }
if (lookup->constness() == PropertyConstness::kConst &&
!receiver_is_holder) {
DCHECK(!lookup->is_dictionary_holder());
smi_handler = LoadHandler::LoadConstantFromPrototype(isolate());
TRACE_HANDLER_STATS(isolate(), LoadIC_LoadConstantFromPrototypeDH);
Handle<Object> value = lookup->GetDataValue();
MaybeObjectHandle weak_value =
value->IsSmi() ? MaybeObjectHandle(*value, isolate())
: MaybeObjectHandle::Weak(*value, isolate());
return LoadHandler::LoadFromPrototype(isolate(), map, holder,
smi_handler, weak_value);
}
return LoadHandler::LoadFromPrototype(isolate(), map, holder, return LoadHandler::LoadFromPrototype(isolate(), map, holder,
smi_handler); smi_handler);
} }
......
...@@ -680,10 +680,6 @@ void Map::UpdateFieldType(Isolate* isolate, int descriptor, Handle<Name> name, ...@@ -680,10 +680,6 @@ void Map::UpdateFieldType(Isolate* isolate, int descriptor, Handle<Name> name,
if (details.location() != kField) return; if (details.location() != kField) return;
DCHECK_EQ(kData, details.kind()); DCHECK_EQ(kData, details.kind());
if (new_constness != details.constness() && is_prototype_map()) {
JSObject::InvalidatePrototypeChains(*this);
}
Zone zone(isolate->allocator(), ZONE_NAME); Zone zone(isolate->allocator(), ZONE_NAME);
ZoneQueue<Map> backlog(&zone); ZoneQueue<Map> backlog(&zone);
backlog.push(*this); backlog.push(*this);
......
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