Index: src/ast.cc |
diff --git a/src/ast.cc b/src/ast.cc |
index 5141a382f00100ec8dd3ab4f883fcae53a90e3ef..06846ffb8f5c431c938beb5ced8bb0f2ad55d0b2 100644 |
--- a/src/ast.cc |
+++ b/src/ast.cc |
@@ -294,6 +294,41 @@ ObjectLiteralProperty::ObjectLiteralProperty(AstValueFactory* ast_value_factory, |
} |
+FeedbackVectorRequirements ClassLiteral::ComputeFeedbackRequirements( |
+ Isolate* isolate, const ICSlotCache* cache) { |
+ if (!FLAG_vector_stores) return FeedbackVectorRequirements(0, 0); |
+ |
+ // This logic that computes the number of slots needed for vector store |
+ // ICs must mirror FullCodeGenerator::VisitClassLiteral. |
+ int ic_slots = 0; |
+ for (int i = 0; i < properties()->length(); i++) { |
+ ObjectLiteral::Property* property = properties()->at(i); |
+ |
+ Expression* value = property->value(); |
+ if (FunctionLiteral::NeedsHomeObject(value)) ic_slots++; |
+ } |
+ |
+#ifdef DEBUG |
+ // FullCodeGenerator::VisitClassLiteral verifies that it consumes slot_count_ |
+ // slots. |
+ slot_count_ = ic_slots; |
+#endif |
+ return FeedbackVectorRequirements(0, ic_slots); |
+} |
+ |
+ |
+FeedbackVectorICSlot ClassLiteral::SlotForHomeObject(Expression* value, |
+ int* slot_index) const { |
+ if (FLAG_vector_stores && FunctionLiteral::NeedsHomeObject(value)) { |
+ DCHECK(slot_index != NULL && *slot_index >= 0 && *slot_index < slot_count_); |
+ FeedbackVectorICSlot slot = GetNthSlot(*slot_index); |
+ *slot_index += 1; |
+ return slot; |
+ } |
+ return FeedbackVectorICSlot::Invalid(); |
+} |
+ |
+ |
bool ObjectLiteral::Property::IsCompileTimeValue() { |
return kind_ == CONSTANT || |
(kind_ == MATERIALIZED_LITERAL && |