[ast] Inline one DCHECK caller of IsValidReferenceExpressionOrThis()

Also further tighten-up that calling DCHECK in BytecodeGraphBuilder,
and narrow the other caller to IsValidReferenceExpression.

Bug: v8:6092
Change-Id: I432a3d6f5991f2d1adf4f4f86e80d6ed8be5a0e8
Reviewed-on: https://chromium-review.googlesource.com/648196
Reviewed-by: Mythri Alle <mythria@chromium.org>
Commit-Queue: Adam Klein <adamk@chromium.org>
Cr-Commit-Position: refs/heads/master@{#47833}
This commit is contained in:
Adam Klein 2017-09-01 15:44:55 -07:00 committed by Commit Bot
parent fbd1d1ad25
commit f9cbfafac6
3 changed files with 4 additions and 10 deletions

View File

@ -139,11 +139,6 @@ bool Expression::IsValidReferenceExpression() const {
(IsVariableProxy() && AsVariableProxy()->IsValidReferenceExpression()); (IsVariableProxy() && AsVariableProxy()->IsValidReferenceExpression());
} }
bool Expression::IsValidReferenceExpressionOrThis() const {
return IsValidReferenceExpression() ||
(IsVariableProxy() && AsVariableProxy()->is_this());
}
bool Expression::IsAnonymousFunctionDefinition() const { bool Expression::IsAnonymousFunctionDefinition() const {
return (IsFunctionLiteral() && return (IsFunctionLiteral() &&
AsFunctionLiteral()->IsAnonymousFunctionDefinition()) || AsFunctionLiteral()->IsAnonymousFunctionDefinition()) ||

View File

@ -267,9 +267,6 @@ class Expression : public AstNode {
// that this also checks for loads of the global "undefined" variable. // that this also checks for loads of the global "undefined" variable.
bool IsUndefinedLiteral() const; bool IsUndefinedLiteral() const;
// True iff the expression is a valid target for an assignment.
bool IsValidReferenceExpressionOrThis() const;
protected: protected:
Expression(int pos, NodeType type) : AstNode(pos, type) {} Expression(int pos, NodeType type) : AstNode(pos, type) {}

View File

@ -2464,7 +2464,9 @@ void BytecodeGenerator::BuildVariableAssignment(
} }
void BytecodeGenerator::VisitAssignment(Assignment* expr) { void BytecodeGenerator::VisitAssignment(Assignment* expr) {
DCHECK(expr->target()->IsValidReferenceExpressionOrThis()); DCHECK(expr->target()->IsValidReferenceExpression() ||
(expr->op() == Token::INIT && expr->target()->IsVariableProxy() &&
expr->target()->AsVariableProxy()->is_this()));
Register object, key; Register object, key;
RegisterList super_property_args; RegisterList super_property_args;
const AstRawString* name; const AstRawString* name;
@ -3522,7 +3524,7 @@ void BytecodeGenerator::VisitDelete(UnaryOperation* expr) {
} }
void BytecodeGenerator::VisitCountOperation(CountOperation* expr) { void BytecodeGenerator::VisitCountOperation(CountOperation* expr) {
DCHECK(expr->expression()->IsValidReferenceExpressionOrThis()); DCHECK(expr->expression()->IsValidReferenceExpression());
// Left-hand side can only be a property, a global or a variable slot. // Left-hand side can only be a property, a global or a variable slot.
Property* property = expr->expression()->AsProperty(); Property* property = expr->expression()->AsProperty();