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/graph-inl.h" | 6 #include "src/compiler/graph-inl.h" |
7 #include "src/compiler/js-builtin-reducer.h" | 7 #include "src/compiler/js-builtin-reducer.h" |
8 #include "src/compiler/js-typed-lowering.h" | 8 #include "src/compiler/js-typed-lowering.h" |
9 #include "src/compiler/node-aux-data-inl.h" | 9 #include "src/compiler/node-aux-data-inl.h" |
10 #include "src/compiler/node-properties-inl.h" | 10 #include "src/compiler/node-properties-inl.h" |
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
376 | 376 |
377 Reduction JSTypedLowering::ReduceJSStrictEqual(Node* node, bool invert) { | 377 Reduction JSTypedLowering::ReduceJSStrictEqual(Node* node, bool invert) { |
378 JSBinopReduction r(this, node); | 378 JSBinopReduction r(this, node); |
379 if (r.left() == r.right()) { | 379 if (r.left() == r.right()) { |
380 // x === x is always true if x != NaN | 380 // x === x is always true if x != NaN |
381 if (!r.left_type()->Maybe(Type::NaN())) { | 381 if (!r.left_type()->Maybe(Type::NaN())) { |
382 return ReplaceEagerly(node, invert ? jsgraph()->FalseConstant() | 382 return ReplaceEagerly(node, invert ? jsgraph()->FalseConstant() |
383 : jsgraph()->TrueConstant()); | 383 : jsgraph()->TrueConstant()); |
384 } | 384 } |
385 } | 385 } |
| 386 /* TODO(neis): This is currently unsound. |
386 if (!r.left_type()->Maybe(r.right_type())) { | 387 if (!r.left_type()->Maybe(r.right_type())) { |
387 // Type intersection is empty; === is always false unless both | 388 // Type intersection is empty; === is always false unless both |
388 // inputs could be strings (one internalized and one not). | 389 // inputs could be strings (one internalized and one not). |
389 if (r.OneInputCannotBe(Type::String())) { | 390 if (r.OneInputCannotBe(Type::String())) { |
390 return ReplaceEagerly(node, invert ? jsgraph()->TrueConstant() | 391 return ReplaceEagerly(node, invert ? jsgraph()->TrueConstant() |
391 : jsgraph()->FalseConstant()); | 392 : jsgraph()->FalseConstant()); |
392 } | 393 } |
393 } | 394 } |
| 395 */ |
394 if (r.OneInputIs(Type::Undefined())) { | 396 if (r.OneInputIs(Type::Undefined())) { |
395 return r.ChangeToPureOperator( | 397 return r.ChangeToPureOperator( |
396 simplified()->ReferenceEqual(Type::Undefined()), invert); | 398 simplified()->ReferenceEqual(Type::Undefined()), invert); |
397 } | 399 } |
398 if (r.OneInputIs(Type::Null())) { | 400 if (r.OneInputIs(Type::Null())) { |
399 return r.ChangeToPureOperator(simplified()->ReferenceEqual(Type::Null()), | 401 return r.ChangeToPureOperator(simplified()->ReferenceEqual(Type::Null()), |
400 invert); | 402 invert); |
401 } | 403 } |
402 if (r.OneInputIs(Type::Boolean())) { | 404 if (r.OneInputIs(Type::Boolean())) { |
403 return r.ChangeToPureOperator(simplified()->ReferenceEqual(Type::Boolean()), | 405 return r.ChangeToPureOperator(simplified()->ReferenceEqual(Type::Boolean()), |
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
702 return JSBuiltinReducer(jsgraph()).Reduce(node); | 704 return JSBuiltinReducer(jsgraph()).Reduce(node); |
703 default: | 705 default: |
704 break; | 706 break; |
705 } | 707 } |
706 return NoChange(); | 708 return NoChange(); |
707 } | 709 } |
708 | 710 |
709 } // namespace compiler | 711 } // namespace compiler |
710 } // namespace internal | 712 } // namespace internal |
711 } // namespace v8 | 713 } // namespace v8 |
OLD | NEW |