| 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 "test/cctest/cctest.h" | 5 #include "test/cctest/cctest.h" |
| 6 | 6 |
| 7 #include "src/base/utils/random-number-generator.h" | 7 #include "src/base/utils/random-number-generator.h" |
| 8 #include "src/compiler/graph-inl.h" | 8 #include "src/compiler/graph-inl.h" |
| 9 #include "src/compiler/js-graph.h" | 9 #include "src/compiler/js-graph.h" |
| 10 #include "src/compiler/machine-operator-reducer.h" | 10 #include "src/compiler/machine-operator-reducer.h" |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 return OpParameter<double>(op); | 46 return OpParameter<double>(op); |
| 47 } | 47 } |
| 48 | 48 |
| 49 | 49 |
| 50 class ReducerTester : public HandleAndZoneScope { | 50 class ReducerTester : public HandleAndZoneScope { |
| 51 public: | 51 public: |
| 52 explicit ReducerTester(int num_parameters = 0) | 52 explicit ReducerTester(int num_parameters = 0) |
| 53 : isolate(main_isolate()), | 53 : isolate(main_isolate()), |
| 54 binop(NULL), | 54 binop(NULL), |
| 55 unop(NULL), | 55 unop(NULL), |
| 56 machine(main_zone()), | |
| 57 common(main_zone()), | 56 common(main_zone()), |
| 58 graph(main_zone()), | 57 graph(main_zone()), |
| 59 typer(main_zone()), | 58 typer(main_zone()), |
| 60 jsgraph(&graph, &common, &typer), | 59 jsgraph(&graph, &common, &typer), |
| 61 maxuint32(Constant<int32_t>(kMaxUInt32)) { | 60 maxuint32(Constant<int32_t>(kMaxUInt32)) { |
| 62 Node* s = graph.NewNode(common.Start(num_parameters)); | 61 Node* s = graph.NewNode(common.Start(num_parameters)); |
| 63 graph.SetStart(s); | 62 graph.SetStart(s); |
| 64 } | 63 } |
| 65 | 64 |
| 66 Isolate* isolate; | 65 Isolate* isolate; |
| (...skipping 593 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 660 Node* index = R.Constant<int32_t>(4); | 659 Node* index = R.Constant<int32_t>(4); |
| 661 Node* load = R.graph.NewNode(R.machine.Load(kMachInt32), base, index); | 660 Node* load = R.graph.NewNode(R.machine.Load(kMachInt32), base, index); |
| 662 | 661 |
| 663 { | 662 { |
| 664 MachineOperatorReducer reducer(&R.jsgraph); | 663 MachineOperatorReducer reducer(&R.jsgraph); |
| 665 Reduction reduction = reducer.Reduce(load); | 664 Reduction reduction = reducer.Reduce(load); |
| 666 CHECK(!reduction.Changed()); // loads should not be reduced. | 665 CHECK(!reduction.Changed()); // loads should not be reduced. |
| 667 } | 666 } |
| 668 | 667 |
| 669 { | 668 { |
| 670 Node* store = R.graph.NewNode(R.machine.Store(kMachInt32, kNoWriteBarrier), | 669 Node* store = R.graph.NewNode( |
| 671 base, index, load); | 670 R.machine.Store(StoreRepresentation(kMachInt32, kNoWriteBarrier)), base, |
| 671 index, load); |
| 672 MachineOperatorReducer reducer(&R.jsgraph); | 672 MachineOperatorReducer reducer(&R.jsgraph); |
| 673 Reduction reduction = reducer.Reduce(store); | 673 Reduction reduction = reducer.Reduce(store); |
| 674 CHECK(!reduction.Changed()); // stores should not be reduced. | 674 CHECK(!reduction.Changed()); // stores should not be reduced. |
| 675 } | 675 } |
| 676 } | 676 } |
| 677 | 677 |
| 678 | 678 |
| 679 static void CheckNans(ReducerTester* R) { | 679 static void CheckNans(ReducerTester* R) { |
| 680 Node* x = R->Parameter(); | 680 Node* x = R->Parameter(); |
| 681 std::vector<double> nans = ValueHelper::nan_vector(); | 681 std::vector<double> nans = ValueHelper::nan_vector(); |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 798 // TODO(titzer): test MachineOperatorReducer for Int64Mul | 798 // TODO(titzer): test MachineOperatorReducer for Int64Mul |
| 799 // TODO(titzer): test MachineOperatorReducer for Int64UMul | 799 // TODO(titzer): test MachineOperatorReducer for Int64UMul |
| 800 // TODO(titzer): test MachineOperatorReducer for Int64Div | 800 // TODO(titzer): test MachineOperatorReducer for Int64Div |
| 801 // TODO(titzer): test MachineOperatorReducer for Int64UDiv | 801 // TODO(titzer): test MachineOperatorReducer for Int64UDiv |
| 802 // TODO(titzer): test MachineOperatorReducer for Int64Mod | 802 // TODO(titzer): test MachineOperatorReducer for Int64Mod |
| 803 // TODO(titzer): test MachineOperatorReducer for Int64UMod | 803 // TODO(titzer): test MachineOperatorReducer for Int64UMod |
| 804 // TODO(titzer): test MachineOperatorReducer for Int64Neg | 804 // TODO(titzer): test MachineOperatorReducer for Int64Neg |
| 805 // TODO(titzer): test MachineOperatorReducer for ChangeInt32ToFloat64 | 805 // TODO(titzer): test MachineOperatorReducer for ChangeInt32ToFloat64 |
| 806 // TODO(titzer): test MachineOperatorReducer for ChangeFloat64ToInt32 | 806 // TODO(titzer): test MachineOperatorReducer for ChangeFloat64ToInt32 |
| 807 // TODO(titzer): test MachineOperatorReducer for Float64Compare | 807 // TODO(titzer): test MachineOperatorReducer for Float64Compare |
| OLD | NEW |