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 "src/v8.h" | 5 #include "src/v8.h" |
6 #include "test/cctest/cctest.h" | 6 #include "test/cctest/cctest.h" |
7 | 7 |
8 #include "src/base/bits.h" | 8 #include "src/base/bits.h" |
9 #include "src/compiler/common-operator.h" | 9 #include "src/compiler/common-operator.h" |
10 #include "src/compiler/control-reducer.h" | 10 #include "src/compiler/control-reducer.h" |
(...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
393 T.jsgraph.NullConstant(), T.jsgraph.ZeroConstant(), | 393 T.jsgraph.NullConstant(), T.jsgraph.ZeroConstant(), |
394 T.jsgraph.OneConstant(), T.jsgraph.NaNConstant(), | 394 T.jsgraph.OneConstant(), T.jsgraph.NaNConstant(), |
395 T.jsgraph.Constant(21), T.jsgraph.Constant(22.2)}; | 395 T.jsgraph.Constant(21), T.jsgraph.Constant(22.2)}; |
396 | 396 |
397 for (size_t i = 0; i < arraysize(other_constants); i++) { | 397 for (size_t i = 0; i < arraysize(other_constants); i++) { |
398 CheckTrimConstant(&T, other_constants[i]); | 398 CheckTrimConstant(&T, other_constants[i]); |
399 } | 399 } |
400 } | 400 } |
401 | 401 |
402 | 402 |
| 403 TEST(Trim_EmptyFrameState1) { |
| 404 ControlReducerTester T; |
| 405 |
| 406 Node* node = T.jsgraph.EmptyFrameState(); |
| 407 T.Trim(); |
| 408 |
| 409 for (Node* input : node->inputs()) { |
| 410 CHECK_NOT_NULL(input); |
| 411 } |
| 412 } |
| 413 |
| 414 |
| 415 TEST(Trim_EmptyFrameState2) { |
| 416 ControlReducerTester T; |
| 417 CheckTrimConstant(&T, T.jsgraph.EmptyFrameState()); |
| 418 } |
| 419 |
| 420 |
403 TEST(CReducePhi1) { | 421 TEST(CReducePhi1) { |
404 ControlReducerTester R; | 422 ControlReducerTester R; |
405 | 423 |
406 R.ReducePhi(R.leaf[0], R.Phi(R.leaf[0])); | 424 R.ReducePhi(R.leaf[0], R.Phi(R.leaf[0])); |
407 R.ReducePhi(R.leaf[1], R.Phi(R.leaf[1])); | 425 R.ReducePhi(R.leaf[1], R.Phi(R.leaf[1])); |
408 R.ReducePhi(R.leaf[2], R.Phi(R.leaf[2])); | 426 R.ReducePhi(R.leaf[2], R.Phi(R.leaf[2])); |
409 R.ReducePhi(R.leaf[3], R.Phi(R.leaf[3])); | 427 R.ReducePhi(R.leaf[3], R.Phi(R.leaf[3])); |
410 } | 428 } |
411 | 429 |
412 | 430 |
(...skipping 1108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1521 | 1539 |
1522 Node* ret = R.Return(d1.phi, R.start, d1.merge); | 1540 Node* ret = R.Return(d1.phi, R.start, d1.merge); |
1523 | 1541 |
1524 R.ReduceGraph(); // d1 gets folded true. | 1542 R.ReduceGraph(); // d1 gets folded true. |
1525 | 1543 |
1526 CheckInputs(ret, y2, R.start, R.start); | 1544 CheckInputs(ret, y2, R.start, R.start); |
1527 CheckDeadDiamond(d1); | 1545 CheckDeadDiamond(d1); |
1528 CheckDeadDiamond(d2); | 1546 CheckDeadDiamond(d2); |
1529 CheckDeadDiamond(d3); | 1547 CheckDeadDiamond(d3); |
1530 } | 1548 } |
OLD | NEW |