Commit 27ff0671 authored by ishell's avatar ishell Committed by Commit bot

Removing the Class/ObjectLiteral::LayoutFeedbackSlots().

Review URL: https://codereview.chromium.org/1372003002

Cr-Commit-Position: refs/heads/master@{#30974}
parent 8dc8903f
......@@ -457,7 +457,6 @@ void AstNumberingVisitor::VisitClassLiteral(ClassLiteral* node) {
VisitObjectLiteralProperty(node->properties()->at(i));
}
ReserveFeedbackSlots(node);
node->LayoutFeedbackSlots();
}
......@@ -473,7 +472,6 @@ void AstNumberingVisitor::VisitObjectLiteral(ObjectLiteral* node) {
// marked expressions, no store code will be is emitted.
node->CalculateEmitStore(zone());
ReserveFeedbackSlots(node);
node->LayoutFeedbackSlots();
}
......
......@@ -227,7 +227,7 @@ ObjectLiteralProperty::ObjectLiteralProperty(Expression* key, Expression* value,
bool is_computed_name)
: key_(key),
value_(value),
ic_slot_or_count_(FeedbackVectorICSlot::Invalid().ToInt()),
slot_(FeedbackVectorICSlot::Invalid()),
kind_(kind),
emit_store_(true),
is_static_(is_static),
......@@ -240,7 +240,7 @@ ObjectLiteralProperty::ObjectLiteralProperty(AstValueFactory* ast_value_factory,
bool is_computed_name)
: key_(key),
value_(value),
ic_slot_or_count_(FeedbackVectorICSlot::Invalid().ToInt()),
slot_(FeedbackVectorICSlot::Invalid()),
emit_store_(true),
is_static_(is_static),
is_computed_name_(is_computed_name) {
......@@ -265,36 +265,16 @@ void ClassLiteral::AssignFeedbackVectorSlots(Isolate* isolate,
// This logic that computes the number of slots needed for vector store
// ICs must mirror FullCodeGenerator::VisitClassLiteral.
int ic_slots = 0;
if (NeedsProxySlot()) {
ic_slots++;
slot_ = spec->AddStoreICSlot();
}
for (int i = 0; i < properties()->length(); i++) {
ObjectLiteral::Property* property = properties()->at(i);
// In case we don't end up using any slots.
property->set_ic_slot_count(0);
Expression* value = property->value();
if (FunctionLiteral::NeedsHomeObject(value)) {
property->set_ic_slot_count(1);
ic_slots++;
}
}
if (ic_slots > 0) {
slot_ = spec->AddStoreICSlots(ic_slots);
property->set_slot(spec->AddStoreICSlot());
}
}
void ClassLiteral::LayoutFeedbackSlots() {
int base_slot = slot_.ToInt();
if (NeedsProxySlot()) base_slot++;
for (int i = 0; i < properties()->length(); i++) {
ObjectLiteral::Property* property = properties()->at(i);
base_slot += property->set_base_slot(base_slot);
}
}
......@@ -316,15 +296,6 @@ bool ObjectLiteral::Property::emit_store() {
}
void ObjectLiteral::LayoutFeedbackSlots() {
int base_slot = slot_.ToInt();
for (int i = 0; i < properties()->length(); i++) {
ObjectLiteral::Property* property = properties()->at(i);
base_slot += property->set_base_slot(base_slot);
}
}
void ObjectLiteral::AssignFeedbackVectorSlots(Isolate* isolate,
FeedbackVectorSpec* spec,
ICSlotCache* cache) {
......@@ -335,9 +306,6 @@ void ObjectLiteral::AssignFeedbackVectorSlots(Isolate* isolate,
int property_index = 0;
for (; property_index < properties()->length(); property_index++) {
ObjectLiteral::Property* property = properties()->at(property_index);
// In case we don't end up using any slots.
property->set_ic_slot_count(0);
if (property->is_computed_name()) break;
if (property->IsCompileTimeValue()) continue;
......@@ -353,28 +321,27 @@ void ObjectLiteral::AssignFeedbackVectorSlots(Isolate* isolate,
// contains computed properties with an uninitialized value.
if (key->value()->IsInternalizedString()) {
if (property->emit_store()) {
int slot_count = 1;
property->set_slot(spec->AddStoreICSlot());
if (FunctionLiteral::NeedsHomeObject(value)) {
slot_count++;
spec->AddStoreICSlot();
}
property->set_ic_slot_count(slot_count);
}
break;
}
if (property->emit_store() && FunctionLiteral::NeedsHomeObject(value)) {
property->set_ic_slot_count(1);
property->set_slot(spec->AddStoreICSlot());
}
break;
case ObjectLiteral::Property::PROTOTYPE:
break;
case ObjectLiteral::Property::GETTER:
if (property->emit_store() && FunctionLiteral::NeedsHomeObject(value)) {
property->set_ic_slot_count(1);
property->set_slot(spec->AddStoreICSlot());
}
break;
case ObjectLiteral::Property::SETTER:
if (property->emit_store() && FunctionLiteral::NeedsHomeObject(value)) {
property->set_ic_slot_count(1);
property->set_slot(spec->AddStoreICSlot());
}
break;
}
......@@ -386,20 +353,9 @@ void ObjectLiteral::AssignFeedbackVectorSlots(Isolate* isolate,
Expression* value = property->value();
if (property->kind() != ObjectLiteral::Property::PROTOTYPE) {
if (FunctionLiteral::NeedsHomeObject(value)) {
property->set_ic_slot_count(1);
}
property->set_slot(spec->AddStoreICSlot());
}
}
// How many slots did we allocate?
int ic_slots = 0;
for (int i = 0; i < properties()->length(); i++) {
ObjectLiteral::Property* property = properties()->at(i);
ic_slots += property->ic_slot_count();
}
if (ic_slots > 0) {
slot_ = spec->AddStoreICSlots(ic_slots);
}
}
......
......@@ -1390,37 +1390,14 @@ class ObjectLiteralProperty final : public ZoneObject {
bool is_computed_name() const { return is_computed_name_; }
FeedbackVectorICSlot GetSlot(int offset = 0) const {
if (ic_slot_or_count_ == FeedbackVectorICSlot::Invalid().ToInt()) {
return FeedbackVectorICSlot::Invalid();
}
return FeedbackVectorICSlot(ic_slot_or_count_ + offset);
}
int ic_slot_count() const {
if (ic_slot_or_count_ == FeedbackVectorICSlot::Invalid().ToInt()) {
return 0;
}
return ic_slot_or_count_;
if (slot_.IsInvalid()) return slot_;
int slot = slot_.ToInt();
return FeedbackVectorICSlot(slot + offset);
}
FeedbackVectorICSlot slot() const { return slot_; }
void set_slot(FeedbackVectorICSlot slot) { slot_ = slot; }
void set_receiver_type(Handle<Map> map) { receiver_type_ = map; }
void set_ic_slot_count(int count) {
// Should only be called once.
if (count == 0) {
ic_slot_or_count_ = FeedbackVectorICSlot::Invalid().ToInt();
} else {
ic_slot_or_count_ = count;
}
}
int set_base_slot(int slot) {
if (ic_slot_count() > 0) {
int count = ic_slot_count();
ic_slot_or_count_ = slot;
return count;
}
return 0;
}
protected:
friend class AstNodeFactory;
......@@ -1434,7 +1411,7 @@ class ObjectLiteralProperty final : public ZoneObject {
private:
Expression* key_;
Expression* value_;
int ic_slot_or_count_;
FeedbackVectorICSlot slot_;
Kind kind_;
bool emit_store_;
bool is_static_;
......@@ -1517,10 +1494,6 @@ class ObjectLiteral final : public MaterializedLiteral {
void AssignFeedbackVectorSlots(Isolate* isolate, FeedbackVectorSpec* spec,
ICSlotCache* cache) override;
// After feedback slots were assigned, propagate information to the properties
// which need it.
void LayoutFeedbackSlots();
protected:
ObjectLiteral(Zone* zone, ZoneList<Property*>* properties, int literal_index,
int boilerplate_properties, bool has_function, bool is_strong,
......@@ -2684,10 +2657,6 @@ class ClassLiteral final : public Expression {
FeedbackVectorICSlot ProxySlot() const { return slot_; }
// After feedback slots were assigned, propagate information to the properties
// which need it.
void LayoutFeedbackSlots();
protected:
ClassLiteral(Zone* zone, const AstRawString* name, Scope* scope,
VariableProxy* class_variable_proxy, Expression* extends,
......
......@@ -106,8 +106,8 @@ class FeedbackVectorSpec {
return AddSlot(FeedbackVectorSlotKind::KEYED_LOAD_IC);
}
FeedbackVectorICSlot AddStoreICSlots(int count) {
return AddSlots(FeedbackVectorSlotKind::STORE_IC, count);
FeedbackVectorICSlot AddStoreICSlot() {
return AddSlot(FeedbackVectorSlotKind::STORE_IC);
}
FeedbackVectorSlot AddStubSlot() {
......
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