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 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 // ----------------------------------------------------------------------------- | 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 // ----------------------------------------------------------------------------- |
200 // JSStrictEqual | 217 // JSStrictEqual |
201 | 218 |
202 | 219 |
203 TEST_F(JSTypedLoweringTest, JSStrictEqualWithTheHole) { | 220 TEST_F(JSTypedLoweringTest, JSStrictEqualWithTheHole) { |
204 Node* const the_hole = HeapConstant(factory()->the_hole_value()); | 221 Node* const the_hole = HeapConstant(factory()->the_hole_value()); |
205 Node* const context = UndefinedConstant(); | 222 Node* const context = UndefinedConstant(); |
206 Node* const effect = graph()->start(); | 223 Node* const effect = graph()->start(); |
207 Node* const control = graph()->start(); | 224 Node* const control = graph()->start(); |
208 TRACED_FOREACH(Type*, type, kJSTypes) { | 225 TRACED_FOREACH(Type*, type, kJSTypes) { |
209 Node* const lhs = Parameter(type); | 226 Node* const lhs = Parameter(type); |
(...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
615 IsStoreElement( | 632 IsStoreElement( |
616 access, IsIntPtrConstant(bit_cast<intptr_t>(&backing_store[0])), | 633 access, IsIntPtrConstant(bit_cast<intptr_t>(&backing_store[0])), |
617 key, value, effect, control)); | 634 key, value, effect, control)); |
618 } | 635 } |
619 } | 636 } |
620 } | 637 } |
621 | 638 |
622 } // namespace compiler | 639 } // namespace compiler |
623 } // namespace internal | 640 } // namespace internal |
624 } // namespace v8 | 641 } // namespace v8 |
OLD | NEW |