| 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 <limits> |
| 6 |
| 5 #include "src/compiler/js-builtin-reducer.h" | 7 #include "src/compiler/js-builtin-reducer.h" |
| 6 #include "src/compiler/js-graph.h" | 8 #include "src/compiler/js-graph.h" |
| 7 #include "src/compiler/node-properties-inl.h" | 9 #include "src/compiler/node-properties-inl.h" |
| 8 #include "src/compiler/typer.h" | 10 #include "src/compiler/typer.h" |
| 9 #include "test/unittests/compiler/graph-unittest.h" | 11 #include "test/unittests/compiler/graph-unittest.h" |
| 10 #include "test/unittests/compiler/node-test-utils.h" | 12 #include "test/unittests/compiler/node-test-utils.h" |
| 11 #include "testing/gmock-support.h" | 13 #include "testing/gmock-support.h" |
| 12 | 14 |
| 13 using testing::Capture; | 15 using testing::Capture; |
| 14 | 16 |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 TEST_F(JSBuiltinReducerTest, MathMax0) { | 127 TEST_F(JSBuiltinReducerTest, MathMax0) { |
| 126 Handle<JSFunction> f = MathFunction("max"); | 128 Handle<JSFunction> f = MathFunction("max"); |
| 127 | 129 |
| 128 Node* fun = HeapConstant(Unique<HeapObject>::CreateUninitialized(f)); | 130 Node* fun = HeapConstant(Unique<HeapObject>::CreateUninitialized(f)); |
| 129 Node* call = | 131 Node* call = |
| 130 graph()->NewNode(javascript()->CallFunction(2, NO_CALL_FUNCTION_FLAGS), | 132 graph()->NewNode(javascript()->CallFunction(2, NO_CALL_FUNCTION_FLAGS), |
| 131 fun, UndefinedConstant()); | 133 fun, UndefinedConstant()); |
| 132 Reduction r = Reduce(call); | 134 Reduction r = Reduce(call); |
| 133 | 135 |
| 134 ASSERT_TRUE(r.Changed()); | 136 ASSERT_TRUE(r.Changed()); |
| 135 EXPECT_THAT(r.replacement(), IsNumberConstant(-V8_INFINITY)); | 137 EXPECT_THAT(r.replacement(), |
| 138 IsNumberConstant(-std::numeric_limits<double>::infinity())); |
| 136 } | 139 } |
| 137 | 140 |
| 138 | 141 |
| 139 TEST_F(JSBuiltinReducerTest, MathMax1) { | 142 TEST_F(JSBuiltinReducerTest, MathMax1) { |
| 140 Handle<JSFunction> f = MathFunction("max"); | 143 Handle<JSFunction> f = MathFunction("max"); |
| 141 | 144 |
| 142 TRACED_FOREACH(Type*, t0, kNumberTypes) { | 145 TRACED_FOREACH(Type*, t0, kNumberTypes) { |
| 143 Node* p0 = Parameter(t0, 0); | 146 Node* p0 = Parameter(t0, 0); |
| 144 Node* fun = HeapConstant(Unique<HeapObject>::CreateUninitialized(f)); | 147 Node* fun = HeapConstant(Unique<HeapObject>::CreateUninitialized(f)); |
| 145 Node* call = | 148 Node* call = |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 297 graph()->NewNode(javascript()->CallFunction(3, NO_CALL_FUNCTION_FLAGS), | 300 graph()->NewNode(javascript()->CallFunction(3, NO_CALL_FUNCTION_FLAGS), |
| 298 fun, UndefinedConstant(), p0); | 301 fun, UndefinedConstant(), p0); |
| 299 Reduction r = Reduce(call, MachineOperatorBuilder::Flag::kNoFlags); | 302 Reduction r = Reduce(call, MachineOperatorBuilder::Flag::kNoFlags); |
| 300 | 303 |
| 301 ASSERT_FALSE(r.Changed()); | 304 ASSERT_FALSE(r.Changed()); |
| 302 } | 305 } |
| 303 } | 306 } |
| 304 } // namespace compiler | 307 } // namespace compiler |
| 305 } // namespace internal | 308 } // namespace internal |
| 306 } // namespace v8 | 309 } // namespace v8 |
| OLD | NEW |