Reviewers: Vyacheslav Egorov,

Description:
Re-enable constructor inlining and inline === comparison with boolean constants.

This change revert r10974 which disabled those two optimizations.
They were not responsible for the problem in earley-boyer.

BUG=v8:2009


Please review this at https://chromiumcodereview.appspot.com/9699117/

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

Affected files:
  M     src/flag-definitions.h
  M     src/hydrogen.cc


Index: src/flag-definitions.h
===================================================================
--- src/flag-definitions.h      (revision 11067)
+++ src/flag-definitions.h      (working copy)
@@ -192,7 +192,7 @@
 DEFINE_bool(trace_osr, false, "trace on-stack replacement")
 DEFINE_int(stress_runs, 0, "number of stress runs")
 DEFINE_bool(optimize_closures, true, "optimize closures")
-DEFINE_bool(inline_construct, false, "inline constructor calls")
+DEFINE_bool(inline_construct, true, "inline constructor calls")
DEFINE_bool(inline_arguments, true, "inline functions with arguments object")
 DEFINE_int(loop_weight, 1, "loop weight for representation inference")

Index: src/hydrogen.cc
===================================================================
--- src/hydrogen.cc     (revision 11067)
+++ src/hydrogen.cc     (working copy)
@@ -6755,6 +6755,15 @@
 }


+static bool IsLiteralCompareBool(HValue* left,
+                                 Token::Value op,
+                                 HValue* right) {
+  return op == Token::EQ_STRICT &&
+ ((left->IsConstant() && HConstant::cast(left)->handle()->IsBoolean()) || + (right->IsConstant() && HConstant::cast(right)->handle()->IsBoolean()));
+}
+
+
 void HGraphBuilder::VisitCompareOperation(CompareOperation* expr) {
   ASSERT(!HasStackOverflow());
   ASSERT(current_block() != NULL);
@@ -6802,6 +6811,12 @@
   if (IsLiteralCompareNil(left, op, right, f->null_value(), &sub_expr)) {
     return HandleLiteralCompareNil(expr, sub_expr, kNullValue);
   }
+  if (IsLiteralCompareBool(left, op, right)) {
+    HCompareObjectEqAndBranch* result =
+        new(zone()) HCompareObjectEqAndBranch(left, right);
+    result->set_position(expr->position());
+    return ast_context()->ReturnControl(result, expr->id());
+  }

   if (op == Token::INSTANCEOF) {
     // Check to see if the rhs of the instanceof is a global function not


--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to