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