Revision: 23972
Author:   [email protected]
Date:     Tue Sep 16 11:33:30 2014 UTC
Log:      Fix typed lowering to number comparison.

[email protected]
TEST=mjsunit/regress/regress-3564
BUG=v8:3564
LOG=N

Review URL: https://codereview.chromium.org/574653002
https://code.google.com/p/v8/source/detail?r=23972

Added:
 /branches/bleeding_edge/test/mjsunit/regress/regress-3564.js
Modified:
 /branches/bleeding_edge/src/compiler/js-typed-lowering.cc

=======================================
--- /dev/null
+++ /branches/bleeding_edge/test/mjsunit/regress/regress-3564.js Tue Sep 16 11:33:30 2014 UTC
@@ -0,0 +1,24 @@
+// Copyright 2014 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Flags: --allow-natives-syntax
+
+function MyWrapper(v) {
+  return { valueOf: function() { return v } };
+}
+
+function f() {
+  assertTrue("a" < "x");
+  assertTrue("a" < new String("y"));
+  assertTrue("a" < new MyWrapper("z"));
+
+  assertFalse("a" > "x");
+  assertFalse("a" > new String("y"));
+  assertFalse("a" > new MyWrapper("z"));
+}
+
+f();
+f();
+%OptimizeFunctionOnNextCall(f);
+f();
=======================================
--- /branches/bleeding_edge/src/compiler/js-typed-lowering.cc Tue Sep 16 08:29:46 2014 UTC +++ /branches/bleeding_edge/src/compiler/js-typed-lowering.cc Tue Sep 16 11:33:30 2014 UTC
@@ -309,7 +309,9 @@
         return NoChange();
     }
     return r.ChangeToPureOperator(stringOp);
-  } else if (r.OneInputCannotBe(Type::String())) {
+  }
+ Type* maybe_string = Type::Union(Type::String(), Type::Receiver(), zone());
+  if (r.OneInputCannotBe(maybe_string)) {
     // If one input cannot be a string, then emit a number comparison.
     const Operator* less_than;
     const Operator* less_than_or_equal;

--
--
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/d/optout.

Reply via email to