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.h" | 10 #include "src/compiler/node-properties.h" |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 EXPECT_THAT(r.replacement(), IsFalseConstant()); | 183 EXPECT_THAT(r.replacement(), IsFalseConstant()); |
184 } | 184 } |
185 | 185 |
186 | 186 |
187 TEST_F(JSTypedLoweringTest, JSUnaryNotWithString) { | 187 TEST_F(JSTypedLoweringTest, JSUnaryNotWithString) { |
188 Node* input = Parameter(Type::String(), 0); | 188 Node* input = Parameter(Type::String(), 0); |
189 Node* context = Parameter(Type::Any(), 1); | 189 Node* context = Parameter(Type::Any(), 1); |
190 Reduction r = | 190 Reduction r = |
191 Reduce(graph()->NewNode(javascript()->UnaryNot(), input, context)); | 191 Reduce(graph()->NewNode(javascript()->UnaryNot(), input, context)); |
192 ASSERT_TRUE(r.Changed()); | 192 ASSERT_TRUE(r.Changed()); |
193 EXPECT_THAT(r.replacement(), | 193 EXPECT_THAT( |
194 IsNumberEqual(IsLoadField(AccessBuilder::ForStringLength(), input, | 194 r.replacement(), |
195 graph()->start(), graph()->start()), | 195 IsNumberEqual(IsLoadField(AccessBuilder::ForStringLength(zone()), input, |
196 IsNumberConstant(0.0))); | 196 graph()->start(), graph()->start()), |
| 197 IsNumberConstant(0.0))); |
197 } | 198 } |
198 | 199 |
199 | 200 |
200 TEST_F(JSTypedLoweringTest, JSUnaryNotWithAny) { | 201 TEST_F(JSTypedLoweringTest, JSUnaryNotWithAny) { |
201 Node* input = Parameter(Type::Any(), 0); | 202 Node* input = Parameter(Type::Any(), 0); |
202 Node* context = Parameter(Type::Any(), 1); | 203 Node* context = Parameter(Type::Any(), 1); |
203 Reduction r = | 204 Reduction r = |
204 Reduce(graph()->NewNode(javascript()->UnaryNot(), input, context)); | 205 Reduce(graph()->NewNode(javascript()->UnaryNot(), input, context)); |
205 ASSERT_FALSE(r.Changed()); | 206 ASSERT_FALSE(r.Changed()); |
206 } | 207 } |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
385 | 386 |
386 TEST_F(JSTypedLoweringTest, JSToBooleanWithString) { | 387 TEST_F(JSTypedLoweringTest, JSToBooleanWithString) { |
387 Node* input = Parameter(Type::String(), 0); | 388 Node* input = Parameter(Type::String(), 0); |
388 Node* context = Parameter(Type::Any(), 1); | 389 Node* context = Parameter(Type::Any(), 1); |
389 Reduction r = | 390 Reduction r = |
390 Reduce(graph()->NewNode(javascript()->ToBoolean(), input, context)); | 391 Reduce(graph()->NewNode(javascript()->ToBoolean(), input, context)); |
391 ASSERT_TRUE(r.Changed()); | 392 ASSERT_TRUE(r.Changed()); |
392 EXPECT_THAT( | 393 EXPECT_THAT( |
393 r.replacement(), | 394 r.replacement(), |
394 IsNumberLessThan(IsNumberConstant(0.0), | 395 IsNumberLessThan(IsNumberConstant(0.0), |
395 IsLoadField(AccessBuilder::ForStringLength(), input, | 396 IsLoadField(AccessBuilder::ForStringLength(zone()), |
396 graph()->start(), graph()->start()))); | 397 input, graph()->start(), graph()->start()))); |
397 } | 398 } |
398 | 399 |
399 | 400 |
400 TEST_F(JSTypedLoweringTest, JSToBooleanWithAny) { | 401 TEST_F(JSTypedLoweringTest, JSToBooleanWithAny) { |
401 Node* input = Parameter(Type::Any(), 0); | 402 Node* input = Parameter(Type::Any(), 0); |
402 Node* context = Parameter(Type::Any(), 1); | 403 Node* context = Parameter(Type::Any(), 1); |
403 Reduction r = | 404 Reduction r = |
404 Reduce(graph()->NewNode(javascript()->ToBoolean(), input, context)); | 405 Reduce(graph()->NewNode(javascript()->ToBoolean(), input, context)); |
405 ASSERT_FALSE(r.Changed()); | 406 ASSERT_FALSE(r.Changed()); |
406 } | 407 } |
(...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
847 IsStoreElement( | 848 IsStoreElement( |
848 access, IsIntPtrConstant(bit_cast<intptr_t>(&backing_store[0])), | 849 access, IsIntPtrConstant(bit_cast<intptr_t>(&backing_store[0])), |
849 key, value, effect, control)); | 850 key, value, effect, control)); |
850 } | 851 } |
851 } | 852 } |
852 } | 853 } |
853 | 854 |
854 } // namespace compiler | 855 } // namespace compiler |
855 } // namespace internal | 856 } // namespace internal |
856 } // namespace v8 | 857 } // namespace v8 |
OLD | NEW |