Index: test/mjsunit/harmony/math-sign.js |
diff --git a/src/hydrogen-bch.h b/test/mjsunit/harmony/math-sign.js |
similarity index 64% |
copy from src/hydrogen-bch.h |
copy to test/mjsunit/harmony/math-sign.js |
index a22dacdd4229748e2735b3c0d8519c927b2f617d..8a89d62828bdbd43a972498f0b32d1a27939171e 100644 |
--- a/src/hydrogen-bch.h |
+++ b/test/mjsunit/harmony/math-sign.js |
@@ -25,31 +25,24 @@ |
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
-#ifndef V8_HYDROGEN_BCH_H_ |
-#define V8_HYDROGEN_BCH_H_ |
- |
-#include "hydrogen.h" |
- |
-namespace v8 { |
-namespace internal { |
- |
- |
-class HBoundsCheckHoistingPhase : public HPhase { |
- public: |
- explicit HBoundsCheckHoistingPhase(HGraph* graph) |
- : HPhase("H_Bounds checks hoisting", graph) { } |
- |
- void Run() { |
- HoistRedundantBoundsChecks(); |
- } |
- |
- private: |
- void HoistRedundantBoundsChecks(); |
- |
- DISALLOW_COPY_AND_ASSIGN(HBoundsCheckHoistingPhase); |
-}; |
- |
- |
-} } // namespace v8::internal |
- |
-#endif // V8_HYDROGEN_BCE_H_ |
+// Flags: --harmony-maths |
+ |
+assertEquals("Infinity", String(1/Math.sign(0))); |
Dmitry Lomov (no reviews)
2013/10/21 06:57:58
Needs tests for +0 and -0:
var x = 1e-200
var y =
Sven Panne
2013/10/21 07:18:39
Why do we need this? I thought the line below alre
Yang
2013/10/21 07:53:23
The line below does test the -0 case. Using actual
|
+assertEquals("-Infinity", String(1/Math.sign(-0))); |
+assertEquals(1, Math.sign(100)); |
+assertEquals(-1, Math.sign(-199)); |
+assertEquals(1, Math.sign(100.1)); |
+assertTrue(isNaN(Math.sign("abc"))); |
+assertTrue(isNaN(Math.sign({}))); |
+assertEquals(0, Math.sign([])); |
+assertEquals(1, Math.sign([1])); |
+assertEquals(-1, Math.sign([-100.1])); |
+assertTrue(isNaN(Math.sign([1, 1]))); |
+assertEquals(1, Math.sign({ toString: function() { return "100"; } })); |
+assertEquals(1, Math.sign({ toString: function() { return 100; } })); |
+assertEquals(-1, Math.sign({ valueOf: function() { return -1.1; } })); |
+assertEquals(-1, Math.sign({ valueOf: function() { return "-1.1"; } })); |
+assertEquals(-1, Math.sign(-Infinity)); |
+assertEquals(1, Math.sign(Infinity)); |
+assertEquals(-1, Math.sign("-Infinity")); |
+assertEquals(1, Math.sign("Infinity")); |