OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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 <functional> | 5 #include <functional> |
6 | 6 |
7 #include "src/codegen.h" | 7 #include "src/codegen.h" |
8 #include "src/compiler/js-operator.h" | 8 #include "src/compiler/js-operator.h" |
9 #include "src/compiler/node-properties.h" | 9 #include "src/compiler/node-properties.h" |
10 #include "src/compiler/operator-properties.h" | 10 #include "src/compiler/operator-properties.h" |
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
283 TestBinaryBitOp(javascript_.ShiftLeft(hints_), shift_left); | 283 TestBinaryBitOp(javascript_.ShiftLeft(hints_), shift_left); |
284 } | 284 } |
285 | 285 |
286 | 286 |
287 TEST_F(TyperTest, TypeJSShiftRight) { | 287 TEST_F(TyperTest, TypeJSShiftRight) { |
288 TestBinaryBitOp(javascript_.ShiftRight(hints_), shift_right); | 288 TestBinaryBitOp(javascript_.ShiftRight(hints_), shift_right); |
289 } | 289 } |
290 | 290 |
291 | 291 |
292 TEST_F(TyperTest, TypeJSLessThan) { | 292 TEST_F(TyperTest, TypeJSLessThan) { |
293 TestBinaryCompareOp(javascript_.LessThan(), std::less<double>()); | 293 TestBinaryCompareOp(javascript_.LessThan(CompareOperationHints::Any()), |
| 294 std::less<double>()); |
294 } | 295 } |
295 | 296 |
296 | 297 |
297 TEST_F(TyperTest, TypeJSLessThanOrEqual) { | 298 TEST_F(TyperTest, TypeJSLessThanOrEqual) { |
298 TestBinaryCompareOp(javascript_.LessThanOrEqual(), std::less_equal<double>()); | 299 TestBinaryCompareOp(javascript_.LessThanOrEqual(CompareOperationHints::Any()), |
| 300 std::less_equal<double>()); |
299 } | 301 } |
300 | 302 |
301 | 303 |
302 TEST_F(TyperTest, TypeJSGreaterThan) { | 304 TEST_F(TyperTest, TypeJSGreaterThan) { |
303 TestBinaryCompareOp(javascript_.GreaterThan(), std::greater<double>()); | 305 TestBinaryCompareOp(javascript_.GreaterThan(CompareOperationHints::Any()), |
| 306 std::greater<double>()); |
304 } | 307 } |
305 | 308 |
306 | 309 |
307 TEST_F(TyperTest, TypeJSGreaterThanOrEqual) { | 310 TEST_F(TyperTest, TypeJSGreaterThanOrEqual) { |
308 TestBinaryCompareOp(javascript_.GreaterThanOrEqual(), | 311 TestBinaryCompareOp( |
309 std::greater_equal<double>()); | 312 javascript_.GreaterThanOrEqual(CompareOperationHints::Any()), |
| 313 std::greater_equal<double>()); |
310 } | 314 } |
311 | 315 |
312 | 316 |
313 TEST_F(TyperTest, TypeJSEqual) { | 317 TEST_F(TyperTest, TypeJSEqual) { |
314 TestBinaryCompareOp(javascript_.Equal(), std::equal_to<double>()); | 318 TestBinaryCompareOp(javascript_.Equal(CompareOperationHints::Any()), |
| 319 std::equal_to<double>()); |
315 } | 320 } |
316 | 321 |
317 | 322 |
318 TEST_F(TyperTest, TypeJSNotEqual) { | 323 TEST_F(TyperTest, TypeJSNotEqual) { |
319 TestBinaryCompareOp(javascript_.NotEqual(), std::not_equal_to<double>()); | 324 TestBinaryCompareOp(javascript_.NotEqual(CompareOperationHints::Any()), |
| 325 std::not_equal_to<double>()); |
320 } | 326 } |
321 | 327 |
322 | 328 |
323 // For numbers there's no difference between strict and non-strict equality. | 329 // For numbers there's no difference between strict and non-strict equality. |
324 TEST_F(TyperTest, TypeJSStrictEqual) { | 330 TEST_F(TyperTest, TypeJSStrictEqual) { |
325 TestBinaryCompareOp(javascript_.StrictEqual(), std::equal_to<double>()); | 331 TestBinaryCompareOp(javascript_.StrictEqual(CompareOperationHints::Any()), |
| 332 std::equal_to<double>()); |
326 } | 333 } |
327 | 334 |
328 | 335 |
329 TEST_F(TyperTest, TypeJSStrictNotEqual) { | 336 TEST_F(TyperTest, TypeJSStrictNotEqual) { |
330 TestBinaryCompareOp(javascript_.StrictNotEqual(), | 337 TestBinaryCompareOp(javascript_.StrictNotEqual(CompareOperationHints::Any()), |
331 std::not_equal_to<double>()); | 338 std::not_equal_to<double>()); |
332 } | 339 } |
333 | 340 |
334 | 341 |
335 //------------------------------------------------------------------------------ | 342 //------------------------------------------------------------------------------ |
336 // Monotonicity | 343 // Monotonicity |
337 | 344 |
338 | 345 #define TEST_BINARY_MONOTONICITY(name) \ |
339 #define TEST_BINARY_MONOTONICITY(name) \ | 346 TEST_F(TyperTest, Monotonicity_##name) { \ |
340 TEST_F(TyperTest, Monotonicity_##name) { \ | 347 TestBinaryMonotonicity(javascript_.name(CompareOperationHints::Any())); \ |
341 TestBinaryMonotonicity(javascript_.name()); \ | |
342 } | 348 } |
343 TEST_BINARY_MONOTONICITY(Equal) | 349 TEST_BINARY_MONOTONICITY(Equal) |
344 TEST_BINARY_MONOTONICITY(NotEqual) | 350 TEST_BINARY_MONOTONICITY(NotEqual) |
345 TEST_BINARY_MONOTONICITY(StrictEqual) | 351 TEST_BINARY_MONOTONICITY(StrictEqual) |
346 TEST_BINARY_MONOTONICITY(StrictNotEqual) | 352 TEST_BINARY_MONOTONICITY(StrictNotEqual) |
347 TEST_BINARY_MONOTONICITY(LessThan) | 353 TEST_BINARY_MONOTONICITY(LessThan) |
348 TEST_BINARY_MONOTONICITY(GreaterThan) | 354 TEST_BINARY_MONOTONICITY(GreaterThan) |
349 TEST_BINARY_MONOTONICITY(LessThanOrEqual) | 355 TEST_BINARY_MONOTONICITY(LessThanOrEqual) |
350 TEST_BINARY_MONOTONICITY(GreaterThanOrEqual) | 356 TEST_BINARY_MONOTONICITY(GreaterThanOrEqual) |
351 #undef TEST_BINARY_MONOTONICITY | 357 #undef TEST_BINARY_MONOTONICITY |
(...skipping 25 matching lines...) Expand all Loading... |
377 for (auto i : values) { | 383 for (auto i : values) { |
378 Node* c = graph()->NewNode(common()->Int32Constant(i)); | 384 Node* c = graph()->NewNode(common()->Int32Constant(i)); |
379 Type* type = NodeProperties::GetType(c); | 385 Type* type = NodeProperties::GetType(c); |
380 EXPECT_TRUE(type->Is(NewRange(i, i))); | 386 EXPECT_TRUE(type->Is(NewRange(i, i))); |
381 } | 387 } |
382 } | 388 } |
383 | 389 |
384 } // namespace compiler | 390 } // namespace compiler |
385 } // namespace internal | 391 } // namespace internal |
386 } // namespace v8 | 392 } // namespace v8 |
OLD | NEW |