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 */ |
386 if (r.OneInputIs(Type::Undefined())) { | 396 if (r.OneInputIs(Type::Undefined())) { |
387 return r.ChangeToPureOperator( | 397 return r.ChangeToPureOperator( |
388 simplified()->ReferenceEqual(Type::Undefined()), invert); | 398 simplified()->ReferenceEqual(Type::Undefined()), invert); |
389 } | 399 } |
390 if (r.OneInputIs(Type::Null())) { | 400 if (r.OneInputIs(Type::Null())) { |
391 return r.ChangeToPureOperator(simplified()->ReferenceEqual(Type::Null()), | 401 return r.ChangeToPureOperator(simplified()->ReferenceEqual(Type::Null()), |
392 invert); | 402 invert); |
393 } | 403 } |
394 if (r.OneInputIs(Type::Boolean())) { | 404 if (r.OneInputIs(Type::Boolean())) { |
395 return r.ChangeToPureOperator(simplified()->ReferenceEqual(Type::Boolean()), | 405 return r.ChangeToPureOperator(simplified()->ReferenceEqual(Type::Boolean()), |
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
681 return JSBuiltinReducer(jsgraph()).Reduce(node); | 691 return JSBuiltinReducer(jsgraph()).Reduce(node); |
682 default: | 692 default: |
683 break; | 693 break; |
684 } | 694 } |
685 return NoChange(); | 695 return NoChange(); |
686 } | 696 } |
687 | 697 |
688 } // namespace compiler | 698 } // namespace compiler |
689 } // namespace internal | 699 } // namespace internal |
690 } // namespace v8 | 700 } // namespace v8 |
OLD | NEW |