Commit 65b23ac7 authored by adamk's avatar adamk Committed by Commit bot

[cleanup] Move ForEach vector feedback slots to ForInStatement

The "each" slot is only actually used by ForIn, so this simply cleans
up a TODO of mine and removes an IsForOfStatement() call.

Review URL: https://codereview.chromium.org/1742013002

Cr-Commit-Position: refs/heads/master@{#34369}
parent c5b2f153
......@@ -148,15 +148,11 @@ static void AssignVectorSlots(Expression* expr, FeedbackVectorSpec* spec,
}
}
void ForEachStatement::AssignFeedbackVectorSlots(
Isolate* isolate, FeedbackVectorSpec* spec,
FeedbackVectorSlotCache* cache) {
// TODO(adamk): for-of statements do not make use of this feedback slot.
// The each_slot_ should be specific to ForInStatement, and this work moved
// there.
if (IsForOfStatement()) return;
void ForInStatement::AssignFeedbackVectorSlots(Isolate* isolate,
FeedbackVectorSpec* spec,
FeedbackVectorSlotCache* cache) {
AssignVectorSlots(each(), spec, &each_slot_);
for_in_feedback_slot_ = spec->AddGeneralSlot();
}
......
......@@ -790,10 +790,6 @@ class ForEachStatement : public IterationStatement {
void set_each(Expression* e) { each_ = e; }
void set_subject(Expression* e) { subject_ = e; }
void AssignFeedbackVectorSlots(Isolate* isolate, FeedbackVectorSpec* spec,
FeedbackVectorSlotCache* cache) override;
FeedbackVectorSlot EachFeedbackSlot() const { return each_slot_; }
static const char* VisitModeString(VisitMode mode) {
return mode == ITERATE ? "for-of" : "for-in";
}
......@@ -805,7 +801,6 @@ class ForEachStatement : public IterationStatement {
private:
Expression* each_;
Expression* subject_;
FeedbackVectorSlot each_slot_;
};
......@@ -819,11 +814,8 @@ class ForInStatement final : public ForEachStatement {
// Type feedback information.
void AssignFeedbackVectorSlots(Isolate* isolate, FeedbackVectorSpec* spec,
FeedbackVectorSlotCache* cache) override {
ForEachStatement::AssignFeedbackVectorSlots(isolate, spec, cache);
for_in_feedback_slot_ = spec->AddGeneralSlot();
}
FeedbackVectorSlotCache* cache) override;
FeedbackVectorSlot EachFeedbackSlot() const { return each_slot_; }
FeedbackVectorSlot ForInFeedbackSlot() {
DCHECK(!for_in_feedback_slot_.IsInvalid());
return for_in_feedback_slot_;
......@@ -852,6 +844,7 @@ class ForInStatement final : public ForEachStatement {
int local_id(int n) const { return base_id() + parent_num_ids() + n; }
ForInType for_in_type_;
FeedbackVectorSlot each_slot_;
FeedbackVectorSlot for_in_feedback_slot_;
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment