Chromium Code Reviews| Index: src/ast.cc |
| diff --git a/src/ast.cc b/src/ast.cc |
| index 5141a382f00100ec8dd3ab4f883fcae53a90e3ef..7d6cfa8462ac95c3edaa976d542f6cc2f441366f 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. |
|
Jakob Kummerow
2015/06/08 08:27:28
nit: s/ics/ICs/
mvstanton
2015/06/08 08:39:13
Done.
|
| + 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 && |