| OLD | NEW |
| 1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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/access-builder.h" | 5 #include "src/compiler/access-builder.h" |
| 6 #include "src/compiler/diamond.h" | 6 #include "src/compiler/diamond.h" |
| 7 #include "src/compiler/js-graph.h" | 7 #include "src/compiler/js-graph.h" |
| 8 #include "src/compiler/js-intrinsic-lowering.h" | 8 #include "src/compiler/js-intrinsic-lowering.h" |
| 9 #include "src/compiler/js-operator.h" | 9 #include "src/compiler/js-operator.h" |
| 10 #include "test/unittests/compiler/graph-unittest.h" | 10 #include "test/unittests/compiler/graph-unittest.h" |
| (...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 253 Reduction const r = Reduce( | 253 Reduction const r = Reduce( |
| 254 graph()->NewNode(javascript()->CallRuntime(Runtime::kInlineMathFloor, 1), | 254 graph()->NewNode(javascript()->CallRuntime(Runtime::kInlineMathFloor, 1), |
| 255 input, context, effect, control), | 255 input, context, effect, control), |
| 256 MachineOperatorBuilder::kFloat64RoundDown); | 256 MachineOperatorBuilder::kFloat64RoundDown); |
| 257 ASSERT_TRUE(r.Changed()); | 257 ASSERT_TRUE(r.Changed()); |
| 258 EXPECT_THAT(r.replacement(), IsFloat64RoundDown(input)); | 258 EXPECT_THAT(r.replacement(), IsFloat64RoundDown(input)); |
| 259 } | 259 } |
| 260 | 260 |
| 261 | 261 |
| 262 // ----------------------------------------------------------------------------- | 262 // ----------------------------------------------------------------------------- |
| 263 // %_MathSqrt | |
| 264 | |
| 265 | |
| 266 TEST_F(JSIntrinsicLoweringTest, InlineMathSqrt) { | |
| 267 Node* const input = Parameter(0); | |
| 268 Node* const context = Parameter(1); | |
| 269 Node* const effect = graph()->start(); | |
| 270 Node* const control = graph()->start(); | |
| 271 Reduction const r = Reduce( | |
| 272 graph()->NewNode(javascript()->CallRuntime(Runtime::kInlineMathSqrt, 1), | |
| 273 input, context, effect, control)); | |
| 274 ASSERT_TRUE(r.Changed()); | |
| 275 EXPECT_THAT(r.replacement(), | |
| 276 IsFloat64Sqrt(IsGuard(Type::Number(), input, _))); | |
| 277 } | |
| 278 | |
| 279 | |
| 280 // ----------------------------------------------------------------------------- | |
| 281 // %_MathClz32 | 263 // %_MathClz32 |
| 282 | 264 |
| 283 TEST_F(JSIntrinsicLoweringTest, InlineMathClz32) { | 265 TEST_F(JSIntrinsicLoweringTest, InlineMathClz32) { |
| 284 Node* const input = Parameter(0); | 266 Node* const input = Parameter(0); |
| 285 Node* const context = Parameter(1); | 267 Node* const context = Parameter(1); |
| 286 Node* const effect = graph()->start(); | 268 Node* const effect = graph()->start(); |
| 287 Node* const control = graph()->start(); | 269 Node* const control = graph()->start(); |
| 288 Reduction const r = Reduce( | 270 Reduction const r = Reduce( |
| 289 graph()->NewNode(javascript()->CallRuntime(Runtime::kInlineMathClz32, 1), | 271 graph()->NewNode(javascript()->CallRuntime(Runtime::kInlineMathClz32, 1), |
| 290 input, context, effect, control)); | 272 input, context, effect, control)); |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 349 ASSERT_TRUE(r.Changed()); | 331 ASSERT_TRUE(r.Changed()); |
| 350 EXPECT_THAT( | 332 EXPECT_THAT( |
| 351 r.replacement(), | 333 r.replacement(), |
| 352 IsLoadContext( | 334 IsLoadContext( |
| 353 ContextAccess(0, Context::ORDINARY_HAS_INSTANCE_INDEX, true), _)); | 335 ContextAccess(0, Context::ORDINARY_HAS_INSTANCE_INDEX, true), _)); |
| 354 } | 336 } |
| 355 | 337 |
| 356 } // namespace compiler | 338 } // namespace compiler |
| 357 } // namespace internal | 339 } // namespace internal |
| 358 } // namespace v8 | 340 } // namespace v8 |
| OLD | NEW |