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/compiler/change-lowering.h" | 5 #include "src/compiler/change-lowering.h" |
6 #include "src/compiler/js-graph.h" | 6 #include "src/compiler/js-graph.h" |
7 #include "src/compiler/node-properties-inl.h" | 7 #include "src/compiler/node-properties-inl.h" |
8 #include "src/compiler/simplified-operator.h" | 8 #include "src/compiler/simplified-operator.h" |
9 #include "src/compiler/typer.h" | |
10 #include "test/compiler-unittests/graph-unittest.h" | 9 #include "test/compiler-unittests/graph-unittest.h" |
11 #include "testing/gmock-support.h" | 10 #include "testing/gmock-support.h" |
12 | 11 |
13 using testing::_; | 12 using testing::_; |
14 using testing::AllOf; | 13 using testing::AllOf; |
15 using testing::Capture; | 14 using testing::Capture; |
16 using testing::CaptureEq; | 15 using testing::CaptureEq; |
17 | 16 |
18 namespace v8 { | 17 namespace v8 { |
19 namespace internal { | 18 namespace internal { |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 STATIC_ASSERT(SmiTagging<4>::kSmiValueSize == 31); | 76 STATIC_ASSERT(SmiTagging<4>::kSmiValueSize == 31); |
78 STATIC_ASSERT(SmiTagging<8>::kSmiValueSize == 32); | 77 STATIC_ASSERT(SmiTagging<8>::kSmiValueSize == 32); |
79 return Is32() ? 31 : 32; | 78 return Is32() ? 31 : 32; |
80 } | 79 } |
81 | 80 |
82 Node* Parameter(int32_t index = 0) { | 81 Node* Parameter(int32_t index = 0) { |
83 return graph()->NewNode(common()->Parameter(index), graph()->start()); | 82 return graph()->NewNode(common()->Parameter(index), graph()->start()); |
84 } | 83 } |
85 | 84 |
86 Reduction Reduce(Node* node) { | 85 Reduction Reduce(Node* node) { |
87 Typer typer(zone()); | 86 JSGraph jsgraph(graph(), common()); |
88 JSGraph jsgraph(graph(), common(), &typer); | |
89 CompilationInfo info(isolate(), zone()); | 87 CompilationInfo info(isolate(), zone()); |
90 Linkage linkage(&info); | 88 Linkage linkage(&info); |
91 MachineOperatorBuilder machine(zone(), WordRepresentation()); | 89 MachineOperatorBuilder machine(zone(), WordRepresentation()); |
92 ChangeLowering reducer(&jsgraph, &linkage, &machine); | 90 ChangeLowering reducer(&jsgraph, &linkage, &machine); |
93 return reducer.Reduce(node); | 91 return reducer.Reduce(node); |
94 } | 92 } |
95 | 93 |
96 SimplifiedOperatorBuilder* simplified() { return &simplified_; } | 94 SimplifiedOperatorBuilder* simplified() { return &simplified_; } |
97 | 95 |
98 Matcher<Node*> IsAllocateHeapNumber(const Matcher<Node*>& effect_matcher, | 96 Matcher<Node*> IsAllocateHeapNumber(const Matcher<Node*>& effect_matcher, |
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
469 IsIfTrue(AllOf(CaptureEq(&branch), | 467 IsIfTrue(AllOf(CaptureEq(&branch), |
470 IsBranch(IsUint32LessThanOrEqual( | 468 IsBranch(IsUint32LessThanOrEqual( |
471 val, IsInt32Constant(SmiMaxValue())), | 469 val, IsInt32Constant(SmiMaxValue())), |
472 graph()->start()))), | 470 graph()->start()))), |
473 AllOf(CaptureEq(&if_false), IsIfFalse(CaptureEq(&branch)))))); | 471 AllOf(CaptureEq(&if_false), IsIfFalse(CaptureEq(&branch)))))); |
474 } | 472 } |
475 | 473 |
476 } // namespace compiler | 474 } // namespace compiler |
477 } // namespace internal | 475 } // namespace internal |
478 } // namespace v8 | 476 } // namespace v8 |
OLD | NEW |