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/code-stubs.h" | 5 #include "src/code-stubs.h" |
6 #include "src/compiler/change-lowering.h" | 6 #include "src/compiler/change-lowering.h" |
7 #include "src/compiler/js-graph.h" | 7 #include "src/compiler/js-graph.h" |
8 #include "src/compiler/linkage.h" | 8 #include "src/compiler/linkage.h" |
9 #include "src/compiler/node-properties-inl.h" | 9 #include "src/compiler/node-properties-inl.h" |
10 #include "src/compiler/simplified-operator.h" | 10 #include "src/compiler/simplified-operator.h" |
11 #include "test/unittests/compiler/compiler-test-utils.h" | 11 #include "test/unittests/compiler/compiler-test-utils.h" |
12 #include "test/unittests/compiler/graph-unittest.h" | 12 #include "test/unittests/compiler/graph-unittest.h" |
13 #include "test/unittests/compiler/node-test-utils.h" | 13 #include "test/unittests/compiler/node-test-utils.h" |
14 #include "testing/gmock-support.h" | 14 #include "testing/gmock-support.h" |
15 | 15 |
16 using testing::_; | 16 using testing::_; |
17 using testing::AllOf; | 17 using testing::AllOf; |
| 18 using testing::BitEq; |
18 using testing::Capture; | 19 using testing::Capture; |
19 using testing::CaptureEq; | 20 using testing::CaptureEq; |
20 | 21 |
21 namespace v8 { | 22 namespace v8 { |
22 namespace internal { | 23 namespace internal { |
23 namespace compiler { | 24 namespace compiler { |
24 | 25 |
25 class ChangeLoweringTest : public GraphTest { | 26 class ChangeLoweringTest : public GraphTest { |
26 public: | 27 public: |
27 ChangeLoweringTest() : simplified_(zone()) {} | 28 ChangeLoweringTest() : simplified_(zone()) {} |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 ChangeLowering reducer(&jsgraph, &linkage); | 72 ChangeLowering reducer(&jsgraph, &linkage); |
72 return reducer.Reduce(node); | 73 return reducer.Reduce(node); |
73 } | 74 } |
74 | 75 |
75 SimplifiedOperatorBuilder* simplified() { return &simplified_; } | 76 SimplifiedOperatorBuilder* simplified() { return &simplified_; } |
76 | 77 |
77 Matcher<Node*> IsAllocateHeapNumber(const Matcher<Node*>& effect_matcher, | 78 Matcher<Node*> IsAllocateHeapNumber(const Matcher<Node*>& effect_matcher, |
78 const Matcher<Node*>& control_matcher) { | 79 const Matcher<Node*>& control_matcher) { |
79 return IsCall(_, IsHeapConstant(Unique<HeapObject>::CreateImmovable( | 80 return IsCall(_, IsHeapConstant(Unique<HeapObject>::CreateImmovable( |
80 AllocateHeapNumberStub(isolate()).GetCode())), | 81 AllocateHeapNumberStub(isolate()).GetCode())), |
81 IsNumberConstant(0.0), effect_matcher, control_matcher); | 82 IsNumberConstant(BitEq(0.0)), effect_matcher, |
| 83 control_matcher); |
82 } | 84 } |
83 Matcher<Node*> IsLoadHeapNumber(const Matcher<Node*>& value_matcher, | 85 Matcher<Node*> IsLoadHeapNumber(const Matcher<Node*>& value_matcher, |
84 const Matcher<Node*>& control_matcher) { | 86 const Matcher<Node*>& control_matcher) { |
85 return IsLoad(kMachFloat64, value_matcher, | 87 return IsLoad(kMachFloat64, value_matcher, |
86 IsIntPtrConstant(HeapNumberValueOffset()), graph()->start(), | 88 IsIntPtrConstant(HeapNumberValueOffset()), graph()->start(), |
87 control_matcher); | 89 control_matcher); |
88 } | 90 } |
89 Matcher<Node*> IsIntPtrConstant(int value) { | 91 Matcher<Node*> IsIntPtrConstant(int value) { |
90 return Is32() ? IsInt32Constant(value) : IsInt64Constant(value); | 92 return Is32() ? IsInt32Constant(value) : IsInt64Constant(value); |
91 } | 93 } |
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
452 IsIfTrue(AllOf(CaptureEq(&branch), | 454 IsIfTrue(AllOf(CaptureEq(&branch), |
453 IsBranch(IsUint32LessThanOrEqual( | 455 IsBranch(IsUint32LessThanOrEqual( |
454 val, IsInt32Constant(SmiMaxValue())), | 456 val, IsInt32Constant(SmiMaxValue())), |
455 graph()->start()))), | 457 graph()->start()))), |
456 AllOf(CaptureEq(&if_false), IsIfFalse(CaptureEq(&branch)))))); | 458 AllOf(CaptureEq(&if_false), IsIfFalse(CaptureEq(&branch)))))); |
457 } | 459 } |
458 | 460 |
459 } // namespace compiler | 461 } // namespace compiler |
460 } // namespace internal | 462 } // namespace internal |
461 } // namespace v8 | 463 } // namespace v8 |
OLD | NEW |