Better fix for LiteralCompareTypeof
authorjkummerow@chromium.org <jkummerow@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Wed, 17 Jul 2013 15:58:59 +0000 (15:58 +0000)
committerjkummerow@chromium.org <jkummerow@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Wed, 17 Jul 2013 15:58:59 +0000 (15:58 +0000)
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

src/arm/full-codegen-arm.cc
src/ast.cc
src/hydrogen.cc
src/ia32/full-codegen-ia32.cc
src/mips/full-codegen-mips.cc
src/x64/full-codegen-x64.cc

index 0638720f306c9ae7ffc229d113ffdd9b5726903d..9040a75a31c196f9f67aff84e556ba018190c4dd 100644 (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);
 
index 779391f1c2bc68e62bab535f93da6428d51bfc0c..f34c7bb24aac7d500016acb4d62a846eadf82ce1 100644 (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;
   }
index 3a1598431f1057ef0ceda75572875ccec50b166d..6744dbb10f0f89bbc9660251b5e0146daca1ed37 100644 (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());
index fcfefaae567f75b7043030c9f84c48a34a167b91..5b14afbf033a62251510dcdb521e094291b4bcaf 100644 (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);
 
index f4d02d236fff3139f5e24bc7739d0ac61d0973ae..43325dfb2ca12f7199bc716834dc0b6c232f8a1a 100644 (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);
 
index 47e8c465d00bdd351b85f0a72612c5abd7ef3224..66bc38b2601e6df026f548dd7fe10c20de03343f 100644 (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);