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.h" | 9 #include "src/compiler/node-properties.h" |
10 #include "src/compiler/simplified-operator.h" | 10 #include "src/compiler/simplified-operator.h" |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 | 144 |
145 | 145 |
146 TARGET_TEST_P(ChangeLoweringCommonTest, ChangeTaggedToInt32WithTaggedSigned) { | 146 TARGET_TEST_P(ChangeLoweringCommonTest, ChangeTaggedToInt32WithTaggedSigned) { |
147 Node* value = Parameter(Type::TaggedSigned()); | 147 Node* value = Parameter(Type::TaggedSigned()); |
148 Reduction r = | 148 Reduction r = |
149 Reduce(graph()->NewNode(simplified()->ChangeTaggedToInt32(), value)); | 149 Reduce(graph()->NewNode(simplified()->ChangeTaggedToInt32(), value)); |
150 ASSERT_TRUE(r.Changed()); | 150 ASSERT_TRUE(r.Changed()); |
151 EXPECT_THAT(r.replacement(), IsChangeSmiToInt32(value)); | 151 EXPECT_THAT(r.replacement(), IsChangeSmiToInt32(value)); |
152 } | 152 } |
153 | 153 |
154 | 154 TARGET_TEST_P(ChangeLoweringCommonTest, ChangeTaggedToInt32WithTaggedNumber) { |
155 TARGET_TEST_P(ChangeLoweringCommonTest, ChangeTaggedToInt32WithTaggedPointer) { | 155 Node* value = |
156 Node* value = Parameter(Type::TaggedPointer()); | 156 Parameter(Type::Intersect(Type::TaggedPointer(), Type::Number(), zone())); |
157 Reduction r = | 157 Reduction r = |
158 Reduce(graph()->NewNode(simplified()->ChangeTaggedToInt32(), value)); | 158 Reduce(graph()->NewNode(simplified()->ChangeTaggedToInt32(), value)); |
159 ASSERT_TRUE(r.Changed()); | 159 ASSERT_TRUE(r.Changed()); |
160 EXPECT_THAT(r.replacement(), IsChangeFloat64ToInt32( | 160 EXPECT_THAT(r.replacement(), IsChangeFloat64ToInt32( |
161 IsLoadHeapNumber(value, graph()->start()))); | 161 IsLoadHeapNumber(value, graph()->start()))); |
162 } | 162 } |
163 | 163 |
164 | 164 |
165 TARGET_TEST_P(ChangeLoweringCommonTest, ChangeTaggedToUint32WithTaggedSigned) { | 165 TARGET_TEST_P(ChangeLoweringCommonTest, ChangeTaggedToUint32WithTaggedSigned) { |
166 Node* value = Parameter(Type::TaggedSigned()); | 166 Node* value = Parameter(Type::TaggedSigned()); |
167 Reduction r = | 167 Reduction r = |
168 Reduce(graph()->NewNode(simplified()->ChangeTaggedToUint32(), value)); | 168 Reduce(graph()->NewNode(simplified()->ChangeTaggedToUint32(), value)); |
169 ASSERT_TRUE(r.Changed()); | 169 ASSERT_TRUE(r.Changed()); |
170 EXPECT_THAT(r.replacement(), IsChangeSmiToInt32(value)); | 170 EXPECT_THAT(r.replacement(), IsChangeSmiToInt32(value)); |
171 } | 171 } |
172 | 172 |
173 | 173 |
174 TARGET_TEST_P(ChangeLoweringCommonTest, ChangeTaggedToUint32WithTaggedPointer) { | 174 TARGET_TEST_P(ChangeLoweringCommonTest, ChangeTaggedToUint32WithTaggedPointer) { |
175 Node* value = Parameter(Type::TaggedPointer()); | 175 Node* value = |
| 176 Parameter(Type::Intersect(Type::TaggedPointer(), Type::Number(), zone())); |
176 Reduction r = | 177 Reduction r = |
177 Reduce(graph()->NewNode(simplified()->ChangeTaggedToUint32(), value)); | 178 Reduce(graph()->NewNode(simplified()->ChangeTaggedToUint32(), value)); |
178 ASSERT_TRUE(r.Changed()); | 179 ASSERT_TRUE(r.Changed()); |
179 EXPECT_THAT(r.replacement(), IsChangeFloat64ToUint32( | 180 EXPECT_THAT(r.replacement(), IsChangeFloat64ToUint32( |
180 IsLoadHeapNumber(value, graph()->start()))); | 181 IsLoadHeapNumber(value, graph()->start()))); |
181 } | 182 } |
182 | 183 |
183 | 184 |
184 TARGET_TEST_P(ChangeLoweringCommonTest, StoreFieldSmi) { | 185 TARGET_TEST_P(ChangeLoweringCommonTest, StoreFieldSmi) { |
185 FieldAccess access = {kTaggedBase, FixedArrayBase::kHeaderSize, | 186 FieldAccess access = {kTaggedBase, FixedArrayBase::kHeaderSize, |
(...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
619 CaptureEq(&branch), | 620 CaptureEq(&branch), |
620 IsBranch(IsUint32LessThanOrEqual( | 621 IsBranch(IsUint32LessThanOrEqual( |
621 value, IsInt32Constant(Smi::kMaxValue)), | 622 value, IsInt32Constant(Smi::kMaxValue)), |
622 graph()->start()))), | 623 graph()->start()))), |
623 AllOf(CaptureEq(&if_false), IsIfFalse(CaptureEq(&branch)))))); | 624 AllOf(CaptureEq(&if_false), IsIfFalse(CaptureEq(&branch)))))); |
624 } | 625 } |
625 | 626 |
626 } // namespace compiler | 627 } // namespace compiler |
627 } // namespace internal | 628 } // namespace internal |
628 } // namespace v8 | 629 } // namespace v8 |
OLD | NEW |