Commit f9cbfafa authored by Adam Klein's avatar Adam Klein Committed by Commit Bot

[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/648196Reviewed-by: 's avatarMythri Alle <mythria@chromium.org>
Commit-Queue: Adam Klein <adamk@chromium.org>
Cr-Commit-Position: refs/heads/master@{#47833}
parent fbd1d1ad
...@@ -139,11 +139,6 @@ bool Expression::IsValidReferenceExpression() const { ...@@ -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()) ||
......
...@@ -267,9 +267,6 @@ class Expression : public AstNode { ...@@ -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) {}
......
...@@ -2464,7 +2464,9 @@ void BytecodeGenerator::BuildVariableAssignment( ...@@ -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) { ...@@ -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();
......
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