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/access-builder.h" | 5 #include "src/compiler/access-builder.h" |
6 #include "src/compiler/js-graph.h" | 6 #include "src/compiler/js-graph.h" |
7 #include "src/compiler/js-operator.h" | 7 #include "src/compiler/js-operator.h" |
8 #include "src/compiler/js-typed-lowering.h" | 8 #include "src/compiler/js-typed-lowering.h" |
9 #include "src/compiler/machine-operator.h" | 9 #include "src/compiler/machine-operator.h" |
10 #include "src/compiler/node-properties-inl.h" | 10 #include "src/compiler/node-properties-inl.h" |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 graph()->NewNode(common()->Select(kMachAnyTagged, BranchHint::kTrue), p0, | 189 graph()->NewNode(common()->Select(kMachAnyTagged, BranchHint::kTrue), p0, |
190 p1, p2), | 190 p1, p2), |
191 context)); | 191 context)); |
192 ASSERT_TRUE(r.Changed()); | 192 ASSERT_TRUE(r.Changed()); |
193 EXPECT_THAT(r.replacement(), | 193 EXPECT_THAT(r.replacement(), |
194 IsSelect(kMachAnyTagged, p0, IsTrueConstant(), | 194 IsSelect(kMachAnyTagged, p0, IsTrueConstant(), |
195 IsBooleanNot(IsNumberEqual(p2, IsNumberConstant(0))))); | 195 IsBooleanNot(IsNumberEqual(p2, IsNumberConstant(0))))); |
196 } | 196 } |
197 | 197 |
198 | 198 |
199 // ----------------------------------------------------------------------------- | |
200 // JSToNumber | |
201 | |
202 | |
203 TEST_F(JSTypedLoweringTest, JSToNumberWithPlainPrimitive) { | |
204 Node* const input = Parameter(Type::PlainPrimitive(), 0); | |
205 Node* const context = Parameter(Type::Any(), 1); | |
206 Node* const effect = graph()->start(); | |
207 Node* const control = graph()->start(); | |
208 Reduction r = Reduce(graph()->NewNode(javascript()->ToNumber(), input, | |
209 context, effect, control)); | |
210 ASSERT_TRUE(r.Changed()); | |
211 EXPECT_THAT(r.replacement(), IsToNumber(input, IsNumberConstant(0), | |
212 graph()->start(), control)); | |
213 } | |
214 | |
215 | |
216 // ----------------------------------------------------------------------------- | 199 // ----------------------------------------------------------------------------- |
217 // JSStrictEqual | 200 // JSStrictEqual |
218 | 201 |
219 | 202 |
220 TEST_F(JSTypedLoweringTest, JSStrictEqualWithTheHole) { | 203 TEST_F(JSTypedLoweringTest, JSStrictEqualWithTheHole) { |
221 Node* const the_hole = HeapConstant(factory()->the_hole_value()); | 204 Node* const the_hole = HeapConstant(factory()->the_hole_value()); |
222 Node* const context = UndefinedConstant(); | 205 Node* const context = UndefinedConstant(); |
223 Node* const effect = graph()->start(); | 206 Node* const effect = graph()->start(); |
224 Node* const control = graph()->start(); | 207 Node* const control = graph()->start(); |
225 TRACED_FOREACH(Type*, type, kJSTypes) { | 208 TRACED_FOREACH(Type*, type, kJSTypes) { |
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
632 IsStoreElement( | 615 IsStoreElement( |
633 access, IsIntPtrConstant(bit_cast<intptr_t>(&backing_store[0])), | 616 access, IsIntPtrConstant(bit_cast<intptr_t>(&backing_store[0])), |
634 key, value, effect, control)); | 617 key, value, effect, control)); |
635 } | 618 } |
636 } | 619 } |
637 } | 620 } |
638 | 621 |
639 } // namespace compiler | 622 } // namespace compiler |
640 } // namespace internal | 623 } // namespace internal |
641 } // namespace v8 | 624 } // namespace v8 |
OLD | NEW |