From: jkummerow@chromium.org Date: Wed, 17 Jul 2013 15:58:59 +0000 (+0000) Subject: Better fix for LiteralCompareTypeof X-Git-Tag: upstream/4.7.83~13329 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=9ed1fe1ac42342f063a4ceeae5086c5ff6f1f971;p=platform%2Fupstream%2Fv8.git Better fix for LiteralCompareTypeof This reverts r15725 and replaces it with the following one-liner in hydrogen.cc's HandleLiteralCompareTypeof: - CHECK_ALIVE(VisitForValue(sub_expr)); + CHECK_ALIVE(VisitForTypeOf(sub_expr)); R=danno@chromium.org Review URL: https://codereview.chromium.org/19523005 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@15728 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- diff --git a/src/arm/full-codegen-arm.cc b/src/arm/full-codegen-arm.cc index 0638720..9040a75 100644 --- a/src/arm/full-codegen-arm.cc +++ b/src/arm/full-codegen-arm.cc @@ -4598,7 +4598,7 @@ void FullCodeGenerator::EmitLiteralCompareTypeof(Expression* expr, &if_true, &if_false, &fall_through); { AccumulatorValueContext context(this); - VisitForTypeofValue(sub_expr->AsUnaryOperation()->expression()); + VisitForTypeofValue(sub_expr); } PrepareForBailoutBeforeSplit(expr, true, if_true, if_false); diff --git a/src/ast.cc b/src/ast.cc index 779391f..f34c7bb 100644 --- a/src/ast.cc +++ b/src/ast.cc @@ -363,7 +363,7 @@ static bool MatchLiteralCompareTypeof(Expression* left, Expression** expr, Handle* check) { if (IsTypeof(left) && right->IsStringLiteral() && Token::IsEqualityOp(op)) { - *expr = left; + *expr = left->AsUnaryOperation()->expression(); *check = Handle::cast(right->AsLiteral()->value()); return true; } diff --git a/src/hydrogen.cc b/src/hydrogen.cc index 3a15984..6744dbb 100644 --- a/src/hydrogen.cc +++ b/src/hydrogen.cc @@ -8134,9 +8134,8 @@ void HOptimizedGraphBuilder::VisitArithmeticExpression(BinaryOperation* expr) { void HOptimizedGraphBuilder::HandleLiteralCompareTypeof(CompareOperation* expr, Expression* sub_expr, Handle check) { - CHECK_ALIVE(VisitForValue(sub_expr)); - HTypeof* htypeof = HTypeof::cast(Pop()); - HValue* value = htypeof->value(); + CHECK_ALIVE(VisitForTypeOf(sub_expr)); + HValue* value = Pop(); HTypeofIsAndBranch* instr = new(zone()) HTypeofIsAndBranch(value, check); instr->set_position(expr->position()); return ast_context()->ReturnControl(instr, expr->id()); diff --git a/src/ia32/full-codegen-ia32.cc b/src/ia32/full-codegen-ia32.cc index fcfefaa..5b14afb 100644 --- a/src/ia32/full-codegen-ia32.cc +++ b/src/ia32/full-codegen-ia32.cc @@ -4608,7 +4608,7 @@ void FullCodeGenerator::EmitLiteralCompareTypeof(Expression* expr, &if_true, &if_false, &fall_through); { AccumulatorValueContext context(this); - VisitForTypeofValue(sub_expr->AsUnaryOperation()->expression()); + VisitForTypeofValue(sub_expr); } PrepareForBailoutBeforeSplit(expr, true, if_true, if_false); diff --git a/src/mips/full-codegen-mips.cc b/src/mips/full-codegen-mips.cc index f4d02d2..43325df 100644 --- a/src/mips/full-codegen-mips.cc +++ b/src/mips/full-codegen-mips.cc @@ -4632,7 +4632,7 @@ void FullCodeGenerator::EmitLiteralCompareTypeof(Expression* expr, &if_true, &if_false, &fall_through); { AccumulatorValueContext context(this); - VisitForTypeofValue(sub_expr->AsUnaryOperation()->expression()); + VisitForTypeofValue(sub_expr); } PrepareForBailoutBeforeSplit(expr, true, if_true, if_false); diff --git a/src/x64/full-codegen-x64.cc b/src/x64/full-codegen-x64.cc index 47e8c46..66bc38b 100644 --- a/src/x64/full-codegen-x64.cc +++ b/src/x64/full-codegen-x64.cc @@ -4592,7 +4592,7 @@ void FullCodeGenerator::EmitLiteralCompareTypeof(Expression* expr, &if_true, &if_false, &fall_through); { AccumulatorValueContext context(this); - VisitForTypeofValue(sub_expr->AsUnaryOperation()->expression()); + VisitForTypeofValue(sub_expr); } PrepareForBailoutBeforeSplit(expr, true, if_true, if_false);