Commit 2701e67d authored by mstarzinger's avatar mstarzinger Committed by Commit bot

Remove obsolete isolate from CompareOperation predicate.

This removes the Isolate argument from the IsLiteralCompareUndefined
predicate as it is no longer required to determine the answer.

R=jkummerow@chromium.org

Review URL: https://codereview.chromium.org/1814823005

Cr-Commit-Position: refs/heads/master@{#34902}
parent d6ad4c7f
......@@ -62,8 +62,7 @@ bool Expression::IsNullLiteral() const {
return IsLiteral() && AsLiteral()->value()->IsNull();
}
bool Expression::IsUndefinedLiteral(Isolate* isolate) const {
bool Expression::IsUndefinedLiteral() const {
if (IsLiteral() && AsLiteral()->value()->IsUndefined()) {
return true;
}
......@@ -669,24 +668,21 @@ static bool IsVoidOfLiteral(Expression* expr) {
static bool MatchLiteralCompareUndefined(Expression* left,
Token::Value op,
Expression* right,
Expression** expr,
Isolate* isolate) {
Expression** expr) {
if (IsVoidOfLiteral(left) && Token::IsEqualityOp(op)) {
*expr = right;
return true;
}
if (left->IsUndefinedLiteral(isolate) && Token::IsEqualityOp(op)) {
if (left->IsUndefinedLiteral() && Token::IsEqualityOp(op)) {
*expr = right;
return true;
}
return false;
}
bool CompareOperation::IsLiteralCompareUndefined(
Expression** expr, Isolate* isolate) {
return MatchLiteralCompareUndefined(left_, op_, right_, expr, isolate) ||
MatchLiteralCompareUndefined(right_, op_, left_, expr, isolate);
bool CompareOperation::IsLiteralCompareUndefined(Expression** expr) {
return MatchLiteralCompareUndefined(left_, op_, right_, expr) ||
MatchLiteralCompareUndefined(right_, op_, left_, expr);
}
......
......@@ -330,8 +330,9 @@ class Expression : public AstNode {
// True iff the expression is the null literal.
bool IsNullLiteral() const;
// True if we can prove that the expression is the undefined literal.
bool IsUndefinedLiteral(Isolate* isolate) const;
// True if we can prove that the expression is the undefined literal. Note
// that this also checks for loads of the global "undefined" variable.
bool IsUndefinedLiteral() const;
// True iff the expression is a valid target for an assignment.
bool IsValidReferenceExpressionOrThis() const;
......@@ -2285,7 +2286,7 @@ class CompareOperation final : public Expression {
// Match special cases.
bool IsLiteralCompareTypeof(Expression** expr, Handle<String>* check);
bool IsLiteralCompareUndefined(Expression** expr, Isolate* isolate);
bool IsLiteralCompareUndefined(Expression** expr);
bool IsLiteralCompareNull(Expression** expr);
protected:
......
......@@ -2842,7 +2842,7 @@ void AstGraphBuilder::VisitCompareOperation(CompareOperation* expr) {
if (expr->IsLiteralCompareTypeof(&sub_expr, &check)) {
return VisitLiteralCompareTypeof(expr, sub_expr, check);
}
if (expr->IsLiteralCompareUndefined(&sub_expr, isolate())) {
if (expr->IsLiteralCompareUndefined(&sub_expr)) {
return VisitLiteralCompareNil(expr, sub_expr,
jsgraph()->UndefinedConstant());
}
......
......@@ -11462,7 +11462,7 @@ void HOptimizedGraphBuilder::VisitCompareOperation(CompareOperation* expr) {
if (expr->IsLiteralCompareTypeof(&sub_expr, &check)) {
return HandleLiteralCompareTypeof(expr, sub_expr, check);
}
if (expr->IsLiteralCompareUndefined(&sub_expr, isolate())) {
if (expr->IsLiteralCompareUndefined(&sub_expr)) {
return HandleLiteralCompareNil(expr, sub_expr, kUndefinedValue);
}
if (expr->IsLiteralCompareNull(&sub_expr)) {
......
......@@ -1758,7 +1758,7 @@ bool FullCodeGenerator::TryLiteralCompare(CompareOperation* expr) {
return true;
}
if (expr->IsLiteralCompareUndefined(&sub_expr, isolate())) {
if (expr->IsLiteralCompareUndefined(&sub_expr)) {
EmitLiteralCompareNil(expr, sub_expr, kUndefinedValue);
return true;
}
......
......@@ -1112,7 +1112,7 @@ void BytecodeGenerator::VisitForInAssignment(Expression* expr,
void BytecodeGenerator::VisitForInStatement(ForInStatement* stmt) {
if (stmt->subject()->IsNullLiteral() ||
stmt->subject()->IsUndefinedLiteral(isolate())) {
stmt->subject()->IsUndefinedLiteral()) {
// ForIn generates lots of code, skip if it wouldn't produce any effects.
return;
}
......
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