Index: src/ast/ast.h |
diff --git a/src/ast/ast.h b/src/ast/ast.h |
index d60cee90a00dacacf4f0c9b152db0b4fa8da1492..7c94d2f9e4aa6afba863bc488e884f1284f79634 100644 |
--- a/src/ast/ast.h |
+++ b/src/ast/ast.h |
@@ -2569,6 +2569,20 @@ class FunctionLiteral final : public Expression { |
} |
LanguageMode language_mode() const; |
+ void AssignFeedbackVectorSlots(Isolate* isolate, FeedbackVectorSpec* spec, |
+ FeedbackVectorSlotCache* cache) { |
+ if (FLAG_strong_rooted_literals) { |
+ literal_feedback_slot_ = |
+ spec->AddCreateClosureSlot(materialized_literal_count_ + 1); |
+ } else { |
+ literal_feedback_slot_ = FeedbackVectorSlot::Invalid(); |
+ } |
+ } |
+ |
+ FeedbackVectorSlot LiteralFeedbackSlot() const { |
+ return literal_feedback_slot_; |
+ } |
+ |
static bool NeedsHomeObject(Expression* expr); |
int materialized_literal_count() { return materialized_literal_count_; } |
@@ -2756,6 +2770,7 @@ class FunctionLiteral final : public Expression { |
Handle<String> inferred_name_; |
AstProperties ast_properties_; |
int function_literal_id_; |
+ FeedbackVectorSlot literal_feedback_slot_; |
}; |
// Property is used for passing information |
@@ -2855,6 +2870,25 @@ class NativeFunctionLiteral final : public Expression { |
public: |
Handle<String> name() const { return name_->string(); } |
v8::Extension* extension() const { return extension_; } |
+ FeedbackVectorSlot LiteralFeedbackSlot() const { |
+ return literal_feedback_slot_; |
+ } |
+ |
+ void AssignFeedbackVectorSlots(Isolate* isolate, FeedbackVectorSpec* spec, |
+ FeedbackVectorSlotCache* cache) { |
+ // TODO(mvstanton): It's actually silly to create these slots. |
+ // At the very least, can we use the FeedbackVectorSlotCache to make |
+ // sure we only allocate 1 for a given function and constantly reuse it? |
+ if (FLAG_strong_rooted_literals) { |
+ // 0 is a magic number here. It means we are holding the literals |
+ // array for a native function literal, which needs to be |
+ // the empty literals array. |
+ // TODO(mvstanton): better way to deal with this? |
+ literal_feedback_slot_ = spec->AddCreateClosureSlot(0); |
+ } else { |
+ literal_feedback_slot_ = FeedbackVectorSlot::Invalid(); |
+ } |
+ } |
private: |
friend class AstNodeFactory; |
@@ -2867,6 +2901,7 @@ class NativeFunctionLiteral final : public Expression { |
const AstRawString* name_; |
v8::Extension* extension_; |
+ FeedbackVectorSlot literal_feedback_slot_; |
}; |