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
This commit is contained in:
jkummerow@chromium.org 2013-07-17 15:58:59 +00:00
parent 9d6445cf32
commit 9ed1fe1ac4
6 changed files with 7 additions and 8 deletions

View File

@ -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);

View File

@ -363,7 +363,7 @@ static bool MatchLiteralCompareTypeof(Expression* left,
Expression** expr,
Handle<String>* check) {
if (IsTypeof(left) && right->IsStringLiteral() && Token::IsEqualityOp(op)) {
*expr = left;
*expr = left->AsUnaryOperation()->expression();
*check = Handle<String>::cast(right->AsLiteral()->value());
return true;
}

View File

@ -8134,9 +8134,8 @@ void HOptimizedGraphBuilder::VisitArithmeticExpression(BinaryOperation* expr) {
void HOptimizedGraphBuilder::HandleLiteralCompareTypeof(CompareOperation* expr,
Expression* sub_expr,
Handle<String> 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());

View File

@ -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);

View File

@ -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);

View File

@ -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);