Reviewers: danno,

Message:
PTAL.

Description:
Fix LiteralCompareTypeof breakage introduced in r15723

Please review this at https://codereview.chromium.org/19556003/

SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge

Affected files:
  M src/arm/full-codegen-arm.cc
  M src/ast.cc
  M src/hydrogen.cc
  M src/ia32/full-codegen-ia32.cc
  M src/mips/full-codegen-mips.cc
  M src/x64/full-codegen-x64.cc


Index: src/arm/full-codegen-arm.cc
diff --git a/src/arm/full-codegen-arm.cc b/src/arm/full-codegen-arm.cc
index 9040a75a31c196f9f67aff84e556ba018190c4dd..0638720f306c9ae7ffc229d113ffdd9b5726903d 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);
+    VisitForTypeofValue(sub_expr->AsUnaryOperation()->expression());
   }
   PrepareForBailoutBeforeSplit(expr, true, if_true, if_false);

Index: src/ast.cc
diff --git a/src/ast.cc b/src/ast.cc
index 964f5bc76e2ea88b9b0f16fac9f167ed3d5bd927..35e961769abc91c861637b78b8720415833f7024 100644
--- a/src/ast.cc
+++ b/src/ast.cc
@@ -357,7 +357,7 @@ static bool MatchLiteralCompareTypeof(Expression* left,
                                       Expression** expr,
                                       Handle<String>* check) {
if (IsTypeof(left) && right->IsStringLiteral() && Token::IsEqualityOp(op)) {
-    *expr = left->AsUnaryOperation()->expression();
+    *expr = left;
     *check = Handle<String>::cast(right->AsLiteral()->value());
     return true;
   }
Index: src/hydrogen.cc
diff --git a/src/hydrogen.cc b/src/hydrogen.cc
index 7d120b7f81749248831427c13e952e86df40e850..f723e8a14183ae4da589e8e7e80edbd31abc2d59 100644
--- a/src/hydrogen.cc
+++ b/src/hydrogen.cc
@@ -8135,7 +8135,8 @@ void HOptimizedGraphBuilder::HandleLiteralCompareTypeof(CompareOperation* expr, Expression* sub_expr, Handle<String> check) {
   CHECK_ALIVE(VisitForValue(sub_expr));
-  HValue* value = Pop();
+  HTypeof* htypeof = HTypeof::cast(Pop());
+  HValue* value = htypeof->value();
   HTypeofIsAndBranch* instr = new(zone()) HTypeofIsAndBranch(value, check);
   instr->set_position(expr->position());
   return ast_context()->ReturnControl(instr, expr->id());
Index: src/ia32/full-codegen-ia32.cc
diff --git a/src/ia32/full-codegen-ia32.cc b/src/ia32/full-codegen-ia32.cc
index 5b14afbf033a62251510dcdb521e094291b4bcaf..fcfefaae567f75b7043030c9f84c48a34a167b91 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);
+    VisitForTypeofValue(sub_expr->AsUnaryOperation()->expression());
   }
   PrepareForBailoutBeforeSplit(expr, true, if_true, if_false);

Index: src/mips/full-codegen-mips.cc
diff --git a/src/mips/full-codegen-mips.cc b/src/mips/full-codegen-mips.cc
index 43325dfb2ca12f7199bc716834dc0b6c232f8a1a..f4d02d236fff3139f5e24bc7739d0ac61d0973ae 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);
+    VisitForTypeofValue(sub_expr->AsUnaryOperation()->expression());
   }
   PrepareForBailoutBeforeSplit(expr, true, if_true, if_false);

Index: src/x64/full-codegen-x64.cc
diff --git a/src/x64/full-codegen-x64.cc b/src/x64/full-codegen-x64.cc
index 66bc38b2601e6df026f548dd7fe10c20de03343f..47e8c465d00bdd351b85f0a72612c5abd7ef3224 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);
+    VisitForTypeofValue(sub_expr->AsUnaryOperation()->expression());
   }
   PrepareForBailoutBeforeSplit(expr, true, if_true, if_false);



--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to