| 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 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 235 Node* const control = graph()->start(); | 235 Node* const control = graph()->start(); |
| 236 Reduction const r = Reduce(graph()->NewNode( | 236 Reduction const r = Reduce(graph()->NewNode( |
| 237 javascript()->CallRuntime(Runtime::kInlineIsJSReceiver, 1), input, | 237 javascript()->CallRuntime(Runtime::kInlineIsJSReceiver, 1), input, |
| 238 context, effect, control)); | 238 context, effect, control)); |
| 239 ASSERT_TRUE(r.Changed()); | 239 ASSERT_TRUE(r.Changed()); |
| 240 EXPECT_THAT(r.replacement(), IsObjectIsReceiver(input)); | 240 EXPECT_THAT(r.replacement(), IsObjectIsReceiver(input)); |
| 241 } | 241 } |
| 242 | 242 |
| 243 | 243 |
| 244 // ----------------------------------------------------------------------------- | 244 // ----------------------------------------------------------------------------- |
| 245 // %_MathFloor | |
| 246 | |
| 247 | |
| 248 TEST_F(JSIntrinsicLoweringTest, InlineMathFloor) { | |
| 249 Node* const input = Parameter(0); | |
| 250 Node* const context = Parameter(1); | |
| 251 Node* const effect = graph()->start(); | |
| 252 Node* const control = graph()->start(); | |
| 253 Reduction const r = Reduce( | |
| 254 graph()->NewNode(javascript()->CallRuntime(Runtime::kInlineMathFloor, 1), | |
| 255 input, context, effect, control), | |
| 256 MachineOperatorBuilder::kFloat64RoundDown); | |
| 257 ASSERT_TRUE(r.Changed()); | |
| 258 EXPECT_THAT(r.replacement(), IsFloat64RoundDown(input)); | |
| 259 } | |
| 260 | |
| 261 | |
| 262 // ----------------------------------------------------------------------------- | |
| 263 // %_MathClz32 | 245 // %_MathClz32 |
| 264 | 246 |
| 265 TEST_F(JSIntrinsicLoweringTest, InlineMathClz32) { | 247 TEST_F(JSIntrinsicLoweringTest, InlineMathClz32) { |
| 266 Node* const input = Parameter(0); | 248 Node* const input = Parameter(0); |
| 267 Node* const context = Parameter(1); | 249 Node* const context = Parameter(1); |
| 268 Node* const effect = graph()->start(); | 250 Node* const effect = graph()->start(); |
| 269 Node* const control = graph()->start(); | 251 Node* const control = graph()->start(); |
| 270 Reduction const r = Reduce( | 252 Reduction const r = Reduce( |
| 271 graph()->NewNode(javascript()->CallRuntime(Runtime::kInlineMathClz32, 1), | 253 graph()->NewNode(javascript()->CallRuntime(Runtime::kInlineMathClz32, 1), |
| 272 input, context, effect, control)); | 254 input, context, effect, control)); |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 331 ASSERT_TRUE(r.Changed()); | 313 ASSERT_TRUE(r.Changed()); |
| 332 EXPECT_THAT( | 314 EXPECT_THAT( |
| 333 r.replacement(), | 315 r.replacement(), |
| 334 IsLoadContext( | 316 IsLoadContext( |
| 335 ContextAccess(0, Context::ORDINARY_HAS_INSTANCE_INDEX, true), _)); | 317 ContextAccess(0, Context::ORDINARY_HAS_INSTANCE_INDEX, true), _)); |
| 336 } | 318 } |
| 337 | 319 |
| 338 } // namespace compiler | 320 } // namespace compiler |
| 339 } // namespace internal | 321 } // namespace internal |
| 340 } // namespace v8 | 322 } // namespace v8 |
| OLD | NEW |