Index: src/ast.h |
diff --git a/src/ast.h b/src/ast.h |
index 616ac5a8cb98e88307b9104c768e769e971cbdf4..73b06631e49c8312ed4435a59735222a0a3ad017 100644 |
--- a/src/ast.h |
+++ b/src/ast.h |
@@ -2705,6 +2705,28 @@ class ClassLiteral final : public Expression { |
// ClassLiteral can vary, so num_ids() is not a static method. |
int num_ids() const { return parent_num_ids() + 4 + properties()->length(); } |
+ // Object literals need one feedback slot for each non-trivial value, as well |
+ // as some slots for home objects. |
+ FeedbackVectorRequirements ComputeFeedbackRequirements( |
+ Isolate* isolate, const ICSlotCache* cache) override; |
+ void SetFirstFeedbackICSlot(FeedbackVectorICSlot slot, |
+ ICSlotCache* cache) override { |
+ slot_ = slot; |
+ } |
+ Code::Kind FeedbackICSlotKind(int index) override { return Code::STORE_IC; } |
+ FeedbackVectorICSlot GetNthSlot(int n) const { |
+ return FeedbackVectorICSlot(slot_.ToInt() + n); |
+ } |
+ |
+ // If value needs a home object, returns a valid feedback vector ic slot |
+ // given by slot_index, and increments slot_index. |
+ FeedbackVectorICSlot SlotForHomeObject(Expression* value, |
+ int* slot_index) const; |
+ |
+#ifdef DEBUG |
+ int slot_count() const { return slot_count_; } |
+#endif |
+ |
protected: |
ClassLiteral(Zone* zone, const AstRawString* name, Scope* scope, |
VariableProxy* class_variable_proxy, Expression* extends, |
@@ -2717,7 +2739,13 @@ class ClassLiteral final : public Expression { |
extends_(extends), |
constructor_(constructor), |
properties_(properties), |
- end_position_(end_position) {} |
+ end_position_(end_position), |
+#ifdef DEBUG |
+ slot_count_(0), |
+#endif |
+ slot_(FeedbackVectorICSlot::Invalid()) { |
+ } |
+ |
static int parent_num_ids() { return Expression::num_ids(); } |
private: |
@@ -2730,6 +2758,12 @@ class ClassLiteral final : public Expression { |
FunctionLiteral* constructor_; |
ZoneList<Property*>* properties_; |
int end_position_; |
+#ifdef DEBUG |
+ // slot_count_ helps validate that the logic to allocate ic slots and the |
+ // logic to use them are in sync. |
+ int slot_count_; |
+#endif |
+ FeedbackVectorICSlot slot_; |
}; |