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}
This commit is contained in:
verwaest 2016-07-07 04:25:55 -07:00 committed by Commit bot
parent 6bf6ab79e3
commit a5020673cc
2 changed files with 10 additions and 21 deletions

View File

@ -213,7 +213,6 @@ void AstNumberingVisitor::VisitYield(Yield* node) {
node->set_yield_id(yield_count_); node->set_yield_id(yield_count_);
yield_count_++; yield_count_++;
IncrementNodeCount(); IncrementNodeCount();
ReserveFeedbackSlots(node);
node->set_base_id(ReserveIdRange(Yield::num_ids())); node->set_base_id(ReserveIdRange(Yield::num_ids()));
Visit(node->generator_object()); Visit(node->generator_object());
Visit(node->expression()); Visit(node->expression());
@ -259,7 +258,6 @@ void AstNumberingVisitor::VisitFunctionDeclaration(FunctionDeclaration* node) {
void AstNumberingVisitor::VisitCallRuntime(CallRuntime* node) { void AstNumberingVisitor::VisitCallRuntime(CallRuntime* node) {
IncrementNodeCount(); IncrementNodeCount();
ReserveFeedbackSlots(node);
node->set_base_id(ReserveIdRange(CallRuntime::num_ids())); node->set_base_id(ReserveIdRange(CallRuntime::num_ids()));
VisitArguments(node->arguments()); VisitArguments(node->arguments());
} }
@ -395,7 +393,6 @@ void AstNumberingVisitor::VisitForOfStatement(ForOfStatement* node) {
Visit(node->assign_each()); Visit(node->assign_each());
Visit(node->body()); Visit(node->body());
node->set_yield_count(yield_count_ - node->first_yield_id()); node->set_yield_count(yield_count_ - node->first_yield_id());
ReserveFeedbackSlots(node);
} }

View File

@ -213,14 +213,6 @@ class AstNode: public ZoneObject {
virtual IterationStatement* AsIterationStatement() { return NULL; } virtual IterationStatement* AsIterationStatement() { return NULL; }
virtual MaterializedLiteral* AsMaterializedLiteral() { 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: private:
// Hidden to prevent accidental usage. It would have to load the // Hidden to prevent accidental usage. It would have to load the
// current zone from the TLS. // current zone from the TLS.
@ -802,7 +794,7 @@ class ForInStatement final : public ForEachStatement {
// Type feedback information. // Type feedback information.
void AssignFeedbackVectorSlots(Isolate* isolate, FeedbackVectorSpec* spec, void AssignFeedbackVectorSlots(Isolate* isolate, FeedbackVectorSpec* spec,
FeedbackVectorSlotCache* cache) override; FeedbackVectorSlotCache* cache);
FeedbackVectorSlot EachFeedbackSlot() const { return each_slot_; } FeedbackVectorSlot EachFeedbackSlot() const { return each_slot_; }
FeedbackVectorSlot ForInFeedbackSlot() { FeedbackVectorSlot ForInFeedbackSlot() {
DCHECK(!for_in_feedback_slot_.IsInvalid()); 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 // Object literals need one feedback slot for each non-trivial value, as well
// as some slots for home objects. // as some slots for home objects.
void AssignFeedbackVectorSlots(Isolate* isolate, FeedbackVectorSpec* spec, void AssignFeedbackVectorSlots(Isolate* isolate, FeedbackVectorSpec* spec,
FeedbackVectorSlotCache* cache) override; FeedbackVectorSlotCache* cache);
protected: protected:
ObjectLiteral(Zone* zone, ZoneList<Property*>* properties, int literal_index, ObjectLiteral(Zone* zone, ZoneList<Property*>* properties, int literal_index,
@ -1635,7 +1627,7 @@ class ArrayLiteral final : public MaterializedLiteral {
}; };
void AssignFeedbackVectorSlots(Isolate* isolate, FeedbackVectorSpec* spec, void AssignFeedbackVectorSlots(Isolate* isolate, FeedbackVectorSpec* spec,
FeedbackVectorSlotCache* cache) override; FeedbackVectorSlotCache* cache);
FeedbackVectorSlot LiteralFeedbackSlot() const { return literal_slot_; } FeedbackVectorSlot LiteralFeedbackSlot() const { return literal_slot_; }
protected: protected:
@ -1708,7 +1700,7 @@ class VariableProxy final : public Expression {
} }
void AssignFeedbackVectorSlots(Isolate* isolate, FeedbackVectorSpec* spec, void AssignFeedbackVectorSlots(Isolate* isolate, FeedbackVectorSpec* spec,
FeedbackVectorSlotCache* cache) override; FeedbackVectorSlotCache* cache);
FeedbackVectorSlot VariableFeedbackSlot() { return variable_feedback_slot_; } FeedbackVectorSlot VariableFeedbackSlot() { return variable_feedback_slot_; }
@ -1808,7 +1800,7 @@ class Property final : public Expression {
bool IsSuperAccess() { return obj()->IsSuperPropertyReference(); } bool IsSuperAccess() { return obj()->IsSuperPropertyReference(); }
void AssignFeedbackVectorSlots(Isolate* isolate, FeedbackVectorSpec* spec, void AssignFeedbackVectorSlots(Isolate* isolate, FeedbackVectorSpec* spec,
FeedbackVectorSlotCache* cache) override { FeedbackVectorSlotCache* cache) {
FeedbackVectorSlotKind kind = key()->IsPropertyName() FeedbackVectorSlotKind kind = key()->IsPropertyName()
? FeedbackVectorSlotKind::LOAD_IC ? FeedbackVectorSlotKind::LOAD_IC
: FeedbackVectorSlotKind::KEYED_LOAD_IC; : FeedbackVectorSlotKind::KEYED_LOAD_IC;
@ -1863,7 +1855,7 @@ class Call final : public Expression {
// Type feedback information. // Type feedback information.
void AssignFeedbackVectorSlots(Isolate* isolate, FeedbackVectorSpec* spec, void AssignFeedbackVectorSlots(Isolate* isolate, FeedbackVectorSpec* spec,
FeedbackVectorSlotCache* cache) override; FeedbackVectorSlotCache* cache);
FeedbackVectorSlot CallFeedbackSlot() const { return stub_slot_; } FeedbackVectorSlot CallFeedbackSlot() const { return stub_slot_; }
@ -1987,7 +1979,7 @@ class CallNew final : public Expression {
// Type feedback information. // Type feedback information.
void AssignFeedbackVectorSlots(Isolate* isolate, FeedbackVectorSpec* spec, void AssignFeedbackVectorSlots(Isolate* isolate, FeedbackVectorSpec* spec,
FeedbackVectorSlotCache* cache) override { FeedbackVectorSlotCache* cache) {
callnew_feedback_slot_ = spec->AddGeneralSlot(); callnew_feedback_slot_ = spec->AddGeneralSlot();
// Construct calls have two slots, one right after the other. // Construct calls have two slots, one right after the other.
// The second slot stores the call count for monomorphic calls. // 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, void AssignFeedbackVectorSlots(Isolate* isolate, FeedbackVectorSpec* spec,
FeedbackVectorSlotCache* cache) override; FeedbackVectorSlotCache* cache);
FeedbackVectorSlot CountSlot() const { return slot_; } FeedbackVectorSlot CountSlot() const { return slot_; }
protected: protected:
@ -2427,7 +2419,7 @@ class Assignment final : public Expression {
} }
void AssignFeedbackVectorSlots(Isolate* isolate, FeedbackVectorSpec* spec, void AssignFeedbackVectorSlots(Isolate* isolate, FeedbackVectorSpec* spec,
FeedbackVectorSlotCache* cache) override; FeedbackVectorSlotCache* cache);
FeedbackVectorSlot AssignmentSlot() const { return slot_; } FeedbackVectorSlot AssignmentSlot() const { return slot_; }
protected: protected:
@ -2775,7 +2767,7 @@ class ClassLiteral final : public Expression {
// Object literals need one feedback slot for each non-trivial value, as well // Object literals need one feedback slot for each non-trivial value, as well
// as some slots for home objects. // as some slots for home objects.
void AssignFeedbackVectorSlots(Isolate* isolate, FeedbackVectorSpec* spec, void AssignFeedbackVectorSlots(Isolate* isolate, FeedbackVectorSpec* spec,
FeedbackVectorSlotCache* cache) override; FeedbackVectorSlotCache* cache);
bool NeedsProxySlot() const { bool NeedsProxySlot() const {
return class_variable_proxy() != nullptr && return class_variable_proxy() != nullptr &&