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/code-factory.h" | 5 #include "src/code-factory.h" |
6 #include "src/compilation-dependencies.h" | 6 #include "src/compilation-dependencies.h" |
7 #include "src/compiler/access-builder.h" | 7 #include "src/compiler/access-builder.h" |
8 #include "src/compiler/js-graph.h" | 8 #include "src/compiler/js-graph.h" |
9 #include "src/compiler/js-typed-lowering.h" | 9 #include "src/compiler/js-typed-lowering.h" |
10 #include "src/compiler/linkage.h" | 10 #include "src/compiler/linkage.h" |
(...skipping 699 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
710 NodeProperties::SetType(input, input_type); | 710 NodeProperties::SetType(input, input_type); |
711 } | 711 } |
712 } | 712 } |
713 ReplaceWithValue(node, input); | 713 ReplaceWithValue(node, input); |
714 return Replace(input); | 714 return Replace(input); |
715 } | 715 } |
716 return NoChange(); | 716 return NoChange(); |
717 } | 717 } |
718 | 718 |
719 Reduction JSTypedLowering::ReduceJSToNumberInput(Node* input) { | 719 Reduction JSTypedLowering::ReduceJSToNumberInput(Node* input) { |
720 if (input->opcode() == IrOpcode::kJSToNumber) { | |
721 // Recursively try to reduce the input first. | |
722 Reduction result = ReduceJSToNumber(input); | |
723 if (result.Changed()) return result; | |
724 return Changed(input); // JSToNumber(JSToNumber(x)) => JSToNumber(x) | |
725 } | |
726 // Check for ToNumber truncation of signaling NaN to undefined mapping. | 720 // Check for ToNumber truncation of signaling NaN to undefined mapping. |
727 if (input->opcode() == IrOpcode::kSelect) { | 721 if (input->opcode() == IrOpcode::kSelect) { |
728 Node* check = NodeProperties::GetValueInput(input, 0); | 722 Node* check = NodeProperties::GetValueInput(input, 0); |
729 Node* vtrue = NodeProperties::GetValueInput(input, 1); | 723 Node* vtrue = NodeProperties::GetValueInput(input, 1); |
730 Type* vtrue_type = NodeProperties::GetType(vtrue); | 724 Type* vtrue_type = NodeProperties::GetType(vtrue); |
731 Node* vfalse = NodeProperties::GetValueInput(input, 2); | 725 Node* vfalse = NodeProperties::GetValueInput(input, 2); |
732 Type* vfalse_type = NodeProperties::GetType(vfalse); | 726 Type* vfalse_type = NodeProperties::GetType(vfalse); |
733 if (vtrue_type->Is(Type::Undefined()) && vfalse_type->Is(Type::Number())) { | 727 if (vtrue_type->Is(Type::Undefined()) && vfalse_type->Is(Type::Number())) { |
734 if (check->opcode() == IrOpcode::kNumberIsHoleNaN && | 728 if (check->opcode() == IrOpcode::kNumberIsHoleNaN && |
735 check->InputAt(0) == vfalse) { | 729 check->InputAt(0) == vfalse) { |
(...skipping 1097 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1833 } | 1827 } |
1834 | 1828 |
1835 | 1829 |
1836 CompilationDependencies* JSTypedLowering::dependencies() const { | 1830 CompilationDependencies* JSTypedLowering::dependencies() const { |
1837 return dependencies_; | 1831 return dependencies_; |
1838 } | 1832 } |
1839 | 1833 |
1840 } // namespace compiler | 1834 } // namespace compiler |
1841 } // namespace internal | 1835 } // namespace internal |
1842 } // namespace v8 | 1836 } // namespace v8 |
OLD | NEW |