| 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 // %_MathClz32 | |
| 246 | |
| 247 TEST_F(JSIntrinsicLoweringTest, InlineMathClz32) { | |
| 248 Node* const input = Parameter(0); | |
| 249 Node* const context = Parameter(1); | |
| 250 Node* const effect = graph()->start(); | |
| 251 Node* const control = graph()->start(); | |
| 252 Reduction const r = Reduce( | |
| 253 graph()->NewNode(javascript()->CallRuntime(Runtime::kInlineMathClz32, 1), | |
| 254 input, context, effect, control)); | |
| 255 ASSERT_TRUE(r.Changed()); | |
| 256 EXPECT_THAT(r.replacement(), IsWord32Clz(input)); | |
| 257 } | |
| 258 | |
| 259 | |
| 260 // ----------------------------------------------------------------------------- | |
| 261 // %_ValueOf | 245 // %_ValueOf |
| 262 | 246 |
| 263 | 247 |
| 264 TEST_F(JSIntrinsicLoweringTest, InlineValueOf) { | 248 TEST_F(JSIntrinsicLoweringTest, InlineValueOf) { |
| 265 Node* const input = Parameter(0); | 249 Node* const input = Parameter(0); |
| 266 Node* const context = Parameter(1); | 250 Node* const context = Parameter(1); |
| 267 Node* const effect = graph()->start(); | 251 Node* const effect = graph()->start(); |
| 268 Node* const control = graph()->start(); | 252 Node* const control = graph()->start(); |
| 269 Reduction const r = Reduce( | 253 Reduction const r = Reduce( |
| 270 graph()->NewNode(javascript()->CallRuntime(Runtime::kInlineValueOf, 1), | 254 graph()->NewNode(javascript()->CallRuntime(Runtime::kInlineValueOf, 1), |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 313 ASSERT_TRUE(r.Changed()); | 297 ASSERT_TRUE(r.Changed()); |
| 314 EXPECT_THAT( | 298 EXPECT_THAT( |
| 315 r.replacement(), | 299 r.replacement(), |
| 316 IsLoadContext( | 300 IsLoadContext( |
| 317 ContextAccess(0, Context::ORDINARY_HAS_INSTANCE_INDEX, true), _)); | 301 ContextAccess(0, Context::ORDINARY_HAS_INSTANCE_INDEX, true), _)); |
| 318 } | 302 } |
| 319 | 303 |
| 320 } // namespace compiler | 304 } // namespace compiler |
| 321 } // namespace internal | 305 } // namespace internal |
| 322 } // namespace v8 | 306 } // namespace v8 |
| OLD | NEW |