Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(202)

Unified Diff: src/ast.h

Issue 1160173004: Vector ICs: ClassLiterals need to allocate a vector slot for home objects. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: REBASE. Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/arm64/full-codegen-arm64.cc ('k') | src/ast.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_;
};
« no previous file with comments | « src/arm64/full-codegen-arm64.cc ('k') | src/ast.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698