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

Unified Diff: src/ast-numbering.cc

Issue 1262803002: Stop overallocating feedback vector slots. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fixed nit. Created 5 years, 5 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/ast.h ('k') | src/type-info.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ast-numbering.cc
diff --git a/src/ast-numbering.cc b/src/ast-numbering.cc
index e14b84dfe8fc26dbc27ca768e59099a7f9f432a8..8676eeb995e064ffd5bb77c7097903459286de83 100644
--- a/src/ast-numbering.cc
+++ b/src/ast-numbering.cc
@@ -11,7 +11,7 @@ namespace internal {
class AstNumberingVisitor final : public AstVisitor {
public:
- explicit AstNumberingVisitor(Isolate* isolate, Zone* zone)
+ AstNumberingVisitor(Isolate* isolate, Zone* zone)
: AstVisitor(),
next_id_(BailoutId::FirstUsable().ToInt()),
properties_(zone),
@@ -30,6 +30,10 @@ class AstNumberingVisitor final : public AstVisitor {
bool Finish(FunctionLiteral* node);
+ void VisitVariableProxyReference(VariableProxy* node);
+ void VisitPropertyReference(Property* node);
+ void VisitReference(Expression* expr);
+
void VisitStatements(ZoneList<Statement*>* statements) override;
void VisitDeclarations(ZoneList<Declaration*>* declarations) override;
void VisitArguments(ZoneList<Expression*>* arguments);
@@ -145,16 +149,21 @@ void AstNumberingVisitor::VisitRegExpLiteral(RegExpLiteral* node) {
}
-void AstNumberingVisitor::VisitVariableProxy(VariableProxy* node) {
+void AstNumberingVisitor::VisitVariableProxyReference(VariableProxy* node) {
IncrementNodeCount();
if (node->var()->IsLookupSlot()) {
DisableCrankshaft(kReferenceToAVariableWhichRequiresDynamicLookup);
}
- ReserveFeedbackSlots(node);
node->set_base_id(ReserveIdRange(VariableProxy::num_ids()));
}
+void AstNumberingVisitor::VisitVariableProxy(VariableProxy* node) {
+ VisitVariableProxyReference(node);
+ ReserveFeedbackSlots(node);
+}
+
+
void AstNumberingVisitor::VisitThisFunction(ThisFunction* node) {
IncrementNodeCount();
node->set_base_id(ReserveIdRange(ThisFunction::num_ids()));
@@ -304,20 +313,35 @@ void AstNumberingVisitor::VisitTryFinallyStatement(TryFinallyStatement* node) {
}
-void AstNumberingVisitor::VisitProperty(Property* node) {
+void AstNumberingVisitor::VisitPropertyReference(Property* node) {
IncrementNodeCount();
- ReserveFeedbackSlots(node);
node->set_base_id(ReserveIdRange(Property::num_ids()));
Visit(node->key());
Visit(node->obj());
}
+void AstNumberingVisitor::VisitReference(Expression* expr) {
+ DCHECK(expr->IsProperty() || expr->IsVariableProxy());
+ if (expr->IsProperty()) {
+ VisitPropertyReference(expr->AsProperty());
+ } else {
+ VisitVariableProxyReference(expr->AsVariableProxy());
+ }
+}
+
+
+void AstNumberingVisitor::VisitProperty(Property* node) {
+ VisitPropertyReference(node);
+ ReserveFeedbackSlots(node);
+}
+
+
void AstNumberingVisitor::VisitAssignment(Assignment* node) {
IncrementNodeCount();
node->set_base_id(ReserveIdRange(Assignment::num_ids()));
if (node->is_compound()) VisitBinaryOperation(node->binary_operation());
- Visit(node->target());
+ VisitReference(node->target());
Visit(node->value());
ReserveFeedbackSlots(node);
}
« no previous file with comments | « src/ast.h ('k') | src/type-info.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698