Commit a5020673 authored by verwaest's avatar verwaest Committed by Commit bot

Devirtualize AssignFeedbackVectorSlots

In AstNumberingVisitor we always know what node we're dealing with, so there's no reason for this method to be virtual. This additionally deletes 3 calls to AssignFeedbackVectorSlots that would always end up in the empty version.

BUG=

Review-Url: https://codereview.chromium.org/2128613003
Cr-Commit-Position: refs/heads/master@{#37582}
parent 6bf6ab79
......@@ -213,7 +213,6 @@ void AstNumberingVisitor::VisitYield(Yield* node) {
node->set_yield_id(yield_count_);
yield_count_++;
IncrementNodeCount();
ReserveFeedbackSlots(node);
node->set_base_id(ReserveIdRange(Yield::num_ids()));
Visit(node->generator_object());
Visit(node->expression());
......@@ -259,7 +258,6 @@ void AstNumberingVisitor::VisitFunctionDeclaration(FunctionDeclaration* node) {
void AstNumberingVisitor::VisitCallRuntime(CallRuntime* node) {
IncrementNodeCount();
ReserveFeedbackSlots(node);
node->set_base_id(ReserveIdRange(CallRuntime::num_ids()));
VisitArguments(node->arguments());
}
......@@ -395,7 +393,6 @@ void AstNumberingVisitor::VisitForOfStatement(ForOfStatement* node) {
Visit(node->assign_each());
Visit(node->body());
node->set_yield_count(yield_count_ - node->first_yield_id());
ReserveFeedbackSlots(node);
}
......
......@@ -213,14 +213,6 @@ class AstNode: public ZoneObject {
virtual IterationStatement* AsIterationStatement() { return NULL; }
virtual MaterializedLiteral* AsMaterializedLiteral() { return NULL; }
// The interface for feedback slots, with default no-op implementations for
// node types which don't actually have this. Note that this is conceptually
// not really nice, but multiple inheritance would introduce yet another
// vtable entry per node, something we don't want for space reasons.
virtual void AssignFeedbackVectorSlots(Isolate* isolate,
FeedbackVectorSpec* spec,
FeedbackVectorSlotCache* cache) {}
private:
// Hidden to prevent accidental usage. It would have to load the
// current zone from the TLS.
......@@ -802,7 +794,7 @@ class ForInStatement final : public ForEachStatement {
// Type feedback information.
void AssignFeedbackVectorSlots(Isolate* isolate, FeedbackVectorSpec* spec,
FeedbackVectorSlotCache* cache) override;
FeedbackVectorSlotCache* cache);
FeedbackVectorSlot EachFeedbackSlot() const { return each_slot_; }
FeedbackVectorSlot ForInFeedbackSlot() {
DCHECK(!for_in_feedback_slot_.IsInvalid());
......@@ -1509,7 +1501,7 @@ class ObjectLiteral final : public MaterializedLiteral {
// Object literals need one feedback slot for each non-trivial value, as well
// as some slots for home objects.
void AssignFeedbackVectorSlots(Isolate* isolate, FeedbackVectorSpec* spec,
FeedbackVectorSlotCache* cache) override;
FeedbackVectorSlotCache* cache);
protected:
ObjectLiteral(Zone* zone, ZoneList<Property*>* properties, int literal_index,
......@@ -1635,7 +1627,7 @@ class ArrayLiteral final : public MaterializedLiteral {
};
void AssignFeedbackVectorSlots(Isolate* isolate, FeedbackVectorSpec* spec,
FeedbackVectorSlotCache* cache) override;
FeedbackVectorSlotCache* cache);
FeedbackVectorSlot LiteralFeedbackSlot() const { return literal_slot_; }
protected:
......@@ -1708,7 +1700,7 @@ class VariableProxy final : public Expression {
}
void AssignFeedbackVectorSlots(Isolate* isolate, FeedbackVectorSpec* spec,
FeedbackVectorSlotCache* cache) override;
FeedbackVectorSlotCache* cache);
FeedbackVectorSlot VariableFeedbackSlot() { return variable_feedback_slot_; }
......@@ -1808,7 +1800,7 @@ class Property final : public Expression {
bool IsSuperAccess() { return obj()->IsSuperPropertyReference(); }
void AssignFeedbackVectorSlots(Isolate* isolate, FeedbackVectorSpec* spec,
FeedbackVectorSlotCache* cache) override {
FeedbackVectorSlotCache* cache) {
FeedbackVectorSlotKind kind = key()->IsPropertyName()
? FeedbackVectorSlotKind::LOAD_IC
: FeedbackVectorSlotKind::KEYED_LOAD_IC;
......@@ -1863,7 +1855,7 @@ class Call final : public Expression {
// Type feedback information.
void AssignFeedbackVectorSlots(Isolate* isolate, FeedbackVectorSpec* spec,
FeedbackVectorSlotCache* cache) override;
FeedbackVectorSlotCache* cache);
FeedbackVectorSlot CallFeedbackSlot() const { return stub_slot_; }
......@@ -1987,7 +1979,7 @@ class CallNew final : public Expression {
// Type feedback information.
void AssignFeedbackVectorSlots(Isolate* isolate, FeedbackVectorSpec* spec,
FeedbackVectorSlotCache* cache) override {
FeedbackVectorSlotCache* cache) {
callnew_feedback_slot_ = spec->AddGeneralSlot();
// Construct calls have two slots, one right after the other.
// The second slot stores the call count for monomorphic calls.
......@@ -2235,7 +2227,7 @@ class CountOperation final : public Expression {
}
void AssignFeedbackVectorSlots(Isolate* isolate, FeedbackVectorSpec* spec,
FeedbackVectorSlotCache* cache) override;
FeedbackVectorSlotCache* cache);
FeedbackVectorSlot CountSlot() const { return slot_; }
protected:
......@@ -2427,7 +2419,7 @@ class Assignment final : public Expression {
}
void AssignFeedbackVectorSlots(Isolate* isolate, FeedbackVectorSpec* spec,
FeedbackVectorSlotCache* cache) override;
FeedbackVectorSlotCache* cache);
FeedbackVectorSlot AssignmentSlot() const { return slot_; }
protected:
......@@ -2775,7 +2767,7 @@ class ClassLiteral final : public Expression {
// Object literals need one feedback slot for each non-trivial value, as well
// as some slots for home objects.
void AssignFeedbackVectorSlots(Isolate* isolate, FeedbackVectorSpec* spec,
FeedbackVectorSlotCache* cache) override;
FeedbackVectorSlotCache* cache);
bool NeedsProxySlot() const {
return class_variable_proxy() != nullptr &&
......
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