OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/compiler/js-builtin-reducer.h" | 5 #include "src/compiler/js-builtin-reducer.h" |
6 #include "src/compiler/js-graph.h" | 6 #include "src/compiler/js-graph.h" |
7 #include "src/compiler/node-properties.h" | 7 #include "src/compiler/node-properties.h" |
8 #include "src/compiler/simplified-operator.h" | 8 #include "src/compiler/simplified-operator.h" |
9 #include "src/compiler/typer.h" | 9 #include "src/compiler/typer.h" |
10 #include "src/isolate-inl.h" | 10 #include "src/isolate-inl.h" |
(...skipping 1457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1468 Node* context = UndefinedConstant(); | 1468 Node* context = UndefinedConstant(); |
1469 Node* frame_state = graph()->start(); | 1469 Node* frame_state = graph()->start(); |
1470 TRACED_FOREACH(Type*, t0, kNumberTypes) { | 1470 TRACED_FOREACH(Type*, t0, kNumberTypes) { |
1471 Node* p0 = Parameter(t0, 0); | 1471 Node* p0 = Parameter(t0, 0); |
1472 Node* call = | 1472 Node* call = |
1473 graph()->NewNode(javascript()->Call(3), function, UndefinedConstant(), | 1473 graph()->NewNode(javascript()->Call(3), function, UndefinedConstant(), |
1474 p0, context, frame_state, effect, control); | 1474 p0, context, frame_state, effect, control); |
1475 Reduction r = Reduce(call); | 1475 Reduction r = Reduce(call); |
1476 | 1476 |
1477 ASSERT_TRUE(r.Changed()); | 1477 ASSERT_TRUE(r.Changed()); |
1478 EXPECT_THAT(r.replacement(), IsBooleanNot(IsNumberEqual(p0, p0))); | 1478 EXPECT_THAT(r.replacement(), IsObjectIsNaN(p0)); |
1479 } | 1479 } |
1480 } | 1480 } |
1481 | 1481 |
1482 // ----------------------------------------------------------------------------- | 1482 // ----------------------------------------------------------------------------- |
1483 // Number.isSafeInteger | 1483 // Number.isSafeInteger |
1484 | 1484 |
1485 TEST_F(JSBuiltinReducerTest, NumberIsSafeIntegerWithIntegral32) { | 1485 TEST_F(JSBuiltinReducerTest, NumberIsSafeIntegerWithIntegral32) { |
1486 Node* function = NumberFunction("isSafeInteger"); | 1486 Node* function = NumberFunction("isSafeInteger"); |
1487 | 1487 |
1488 Node* effect = graph()->start(); | 1488 Node* effect = graph()->start(); |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1579 Reduction r = Reduce(call); | 1579 Reduction r = Reduce(call); |
1580 | 1580 |
1581 ASSERT_TRUE(r.Changed()); | 1581 ASSERT_TRUE(r.Changed()); |
1582 EXPECT_THAT(r.replacement(), | 1582 EXPECT_THAT(r.replacement(), |
1583 IsStringFromCharCode(IsPlainPrimitiveToNumber(p0))); | 1583 IsStringFromCharCode(IsPlainPrimitiveToNumber(p0))); |
1584 } | 1584 } |
1585 | 1585 |
1586 } // namespace compiler | 1586 } // namespace compiler |
1587 } // namespace internal | 1587 } // namespace internal |
1588 } // namespace v8 | 1588 } // namespace v8 |
OLD | NEW |