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/base/bits.h" | 5 #include "src/base/bits.h" |
6 #include "src/base/division-by-constant.h" | 6 #include "src/base/division-by-constant.h" |
7 #include "src/compiler/js-graph.h" | 7 #include "src/compiler/js-graph.h" |
8 #include "src/compiler/machine-operator-reducer.h" | 8 #include "src/compiler/machine-operator-reducer.h" |
9 #include "src/compiler/typer.h" | 9 #include "src/compiler/typer.h" |
10 #include "test/unittests/compiler/graph-unittest.h" | 10 #include "test/unittests/compiler/graph-unittest.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 namespace compiler { | 21 namespace compiler { |
22 | 22 |
23 class MachineOperatorReducerTest : public TypedGraphTest { | 23 class MachineOperatorReducerTest : public TypedGraphTest { |
24 public: | 24 public: |
25 explicit MachineOperatorReducerTest(int num_parameters = 2) | 25 explicit MachineOperatorReducerTest(int num_parameters = 2) |
26 : TypedGraphTest(num_parameters), machine_(zone()) {} | 26 : TypedGraphTest(num_parameters), machine_(zone()) {} |
27 | 27 |
28 protected: | 28 protected: |
29 Reduction Reduce(Node* node) { | 29 Reduction Reduce(Node* node) { |
30 JSOperatorBuilder javascript(zone()); | 30 JSOperatorBuilder javascript(zone()); |
31 JSGraph jsgraph(graph(), common(), &javascript, &machine_); | 31 JSGraph jsgraph(isolate(), graph(), common(), &javascript, &machine_); |
32 MachineOperatorReducer reducer(&jsgraph); | 32 MachineOperatorReducer reducer(&jsgraph); |
33 return reducer.Reduce(node); | 33 return reducer.Reduce(node); |
34 } | 34 } |
35 | 35 |
36 Matcher<Node*> IsTruncatingDiv(const Matcher<Node*>& dividend_matcher, | 36 Matcher<Node*> IsTruncatingDiv(const Matcher<Node*>& dividend_matcher, |
37 const int32_t divisor) { | 37 const int32_t divisor) { |
38 base::MagicNumbersForDivision<uint32_t> const mag = | 38 base::MagicNumbersForDivision<uint32_t> const mag = |
39 base::SignedDivisionByConstant(bit_cast<uint32_t>(divisor)); | 39 base::SignedDivisionByConstant(bit_cast<uint32_t>(divisor)); |
40 int32_t const multiplier = bit_cast<int32_t>(mag.multiplier); | 40 int32_t const multiplier = bit_cast<int32_t>(mag.multiplier); |
41 int32_t const shift = bit_cast<int32_t>(mag.shift); | 41 int32_t const shift = bit_cast<int32_t>(mag.shift); |
(...skipping 1375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1417 Reduction r = Reduce(node); | 1417 Reduction r = Reduce(node); |
1418 ASSERT_TRUE(r.Changed()); | 1418 ASSERT_TRUE(r.Changed()); |
1419 EXPECT_THAT(r.replacement(), | 1419 EXPECT_THAT(r.replacement(), |
1420 IsStore(rep, base, index, value, effect, control)); | 1420 IsStore(rep, base, index, value, effect, control)); |
1421 } | 1421 } |
1422 } | 1422 } |
1423 | 1423 |
1424 } // namespace compiler | 1424 } // namespace compiler |
1425 } // namespace internal | 1425 } // namespace internal |
1426 } // namespace v8 | 1426 } // namespace v8 |
OLD | NEW |