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 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
260 Node* const input = Parameter(0); | 260 Node* const input = Parameter(0); |
261 Node* const context = Parameter(1); | 261 Node* const context = Parameter(1); |
262 Node* const effect = graph()->start(); | 262 Node* const effect = graph()->start(); |
263 Node* const control = graph()->start(); | 263 Node* const control = graph()->start(); |
264 Node* const likely = | 264 Node* const likely = |
265 graph()->NewNode(javascript()->CallRuntime(Runtime::kInlineLikely, 1), | 265 graph()->NewNode(javascript()->CallRuntime(Runtime::kInlineLikely, 1), |
266 input, context, effect, control); | 266 input, context, effect, control); |
267 Node* const to_boolean = | 267 Node* const to_boolean = |
268 graph()->NewNode(javascript()->ToBoolean(), likely, context); | 268 graph()->NewNode(javascript()->ToBoolean(), likely, context); |
269 Diamond d(graph(), common(), to_boolean); | 269 Diamond d(graph(), common(), to_boolean); |
270 graph()->SetEnd(graph()->NewNode(common()->End(), d.merge)); | 270 graph()->SetEnd(graph()->NewNode(common()->End(1), d.merge)); |
271 | 271 |
272 ASSERT_EQ(BranchHint::kNone, BranchHintOf(d.branch->op())); | 272 ASSERT_EQ(BranchHint::kNone, BranchHintOf(d.branch->op())); |
273 Reduction const r = Reduce(likely); | 273 Reduction const r = Reduce(likely); |
274 ASSERT_TRUE(r.Changed()); | 274 ASSERT_TRUE(r.Changed()); |
275 EXPECT_THAT(r.replacement(), input); | 275 EXPECT_THAT(r.replacement(), input); |
276 ASSERT_EQ(BranchHint::kTrue, BranchHintOf(d.branch->op())); | 276 ASSERT_EQ(BranchHint::kTrue, BranchHintOf(d.branch->op())); |
277 } | 277 } |
278 | 278 |
279 | 279 |
280 // ----------------------------------------------------------------------------- | 280 // ----------------------------------------------------------------------------- |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
355 Node* const input = Parameter(0); | 355 Node* const input = Parameter(0); |
356 Node* const context = Parameter(1); | 356 Node* const context = Parameter(1); |
357 Node* const effect = graph()->start(); | 357 Node* const effect = graph()->start(); |
358 Node* const control = graph()->start(); | 358 Node* const control = graph()->start(); |
359 Node* const unlikely = | 359 Node* const unlikely = |
360 graph()->NewNode(javascript()->CallRuntime(Runtime::kInlineUnlikely, 1), | 360 graph()->NewNode(javascript()->CallRuntime(Runtime::kInlineUnlikely, 1), |
361 input, context, effect, control); | 361 input, context, effect, control); |
362 Node* const to_boolean = | 362 Node* const to_boolean = |
363 graph()->NewNode(javascript()->ToBoolean(), unlikely, context); | 363 graph()->NewNode(javascript()->ToBoolean(), unlikely, context); |
364 Diamond d(graph(), common(), to_boolean); | 364 Diamond d(graph(), common(), to_boolean); |
365 graph()->SetEnd(graph()->NewNode(common()->End(), d.merge)); | 365 graph()->SetEnd(graph()->NewNode(common()->End(1), d.merge)); |
366 | 366 |
367 ASSERT_EQ(BranchHint::kNone, BranchHintOf(d.branch->op())); | 367 ASSERT_EQ(BranchHint::kNone, BranchHintOf(d.branch->op())); |
368 Reduction const r = Reduce(unlikely); | 368 Reduction const r = Reduce(unlikely); |
369 ASSERT_TRUE(r.Changed()); | 369 ASSERT_TRUE(r.Changed()); |
370 EXPECT_THAT(r.replacement(), input); | 370 EXPECT_THAT(r.replacement(), input); |
371 ASSERT_EQ(BranchHint::kFalse, BranchHintOf(d.branch->op())); | 371 ASSERT_EQ(BranchHint::kFalse, BranchHintOf(d.branch->op())); |
372 } | 372 } |
373 | 373 |
374 | 374 |
375 // ----------------------------------------------------------------------------- | 375 // ----------------------------------------------------------------------------- |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
410 CaptureEq(&if_false0)))))), | 410 CaptureEq(&if_false0)))))), |
411 IsMerge( | 411 IsMerge( |
412 IsIfTrue(AllOf(CaptureEq(&branch0), | 412 IsIfTrue(AllOf(CaptureEq(&branch0), |
413 IsBranch(IsObjectIsSmi(input), control))), | 413 IsBranch(IsObjectIsSmi(input), control))), |
414 AllOf(CaptureEq(&if_false0), IsIfFalse(CaptureEq(&branch0)))))); | 414 AllOf(CaptureEq(&if_false0), IsIfFalse(CaptureEq(&branch0)))))); |
415 } | 415 } |
416 | 416 |
417 } // namespace compiler | 417 } // namespace compiler |
418 } // namespace internal | 418 } // namespace internal |
419 } // namespace v8 | 419 } // namespace v8 |
OLD | NEW |