| 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. | |
| 387 if (!r.left_type()->Maybe(r.right_type())) { | |
| 388 // Type intersection is empty; === is always false unless both | |
| 389 // inputs could be strings (one internalized and one not). | |
| 390 if (r.OneInputCannotBe(Type::String())) { | |
| 391 return ReplaceEagerly(node, invert ? jsgraph()->TrueConstant() | |
| 392 : jsgraph()->FalseConstant()); | |
| 393 } | |
| 394 } | |
| 395 */ | |
| 396 if (r.OneInputIs(Type::Undefined())) { | 386 if (r.OneInputIs(Type::Undefined())) { |
| 397 return r.ChangeToPureOperator( | 387 return r.ChangeToPureOperator( |
| 398 simplified()->ReferenceEqual(Type::Undefined()), invert); | 388 simplified()->ReferenceEqual(Type::Undefined()), invert); |
| 399 } | 389 } |
| 400 if (r.OneInputIs(Type::Null())) { | 390 if (r.OneInputIs(Type::Null())) { |
| 401 return r.ChangeToPureOperator(simplified()->ReferenceEqual(Type::Null()), | 391 return r.ChangeToPureOperator(simplified()->ReferenceEqual(Type::Null()), |
| 402 invert); | 392 invert); |
| 403 } | 393 } |
| 404 if (r.OneInputIs(Type::Boolean())) { | 394 if (r.OneInputIs(Type::Boolean())) { |
| 405 return r.ChangeToPureOperator(simplified()->ReferenceEqual(Type::Boolean()), | 395 return r.ChangeToPureOperator(simplified()->ReferenceEqual(Type::Boolean()), |
| (...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 713 return JSBuiltinReducer(jsgraph()).Reduce(node); | 703 return JSBuiltinReducer(jsgraph()).Reduce(node); |
| 714 default: | 704 default: |
| 715 break; | 705 break; |
| 716 } | 706 } |
| 717 return NoChange(); | 707 return NoChange(); |
| 718 } | 708 } |
| 719 | 709 |
| 720 } // namespace compiler | 710 } // namespace compiler |
| 721 } // namespace internal | 711 } // namespace internal |
| 722 } // namespace v8 | 712 } // namespace v8 |
| OLD | NEW |