Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(262)

Side by Side Diff: src/compiler/js-typed-lowering.cc

Issue 2065953002: [turbofan] Introduce dedicated NumberConvertHoleNaN simplified operator. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/compiler/js-native-context-specialization.cc ('k') | src/compiler/opcodes.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 787 matching lines...) Expand 10 before | Expand all | Expand 10 after
798 NodeProperties::SetType(input, input_type); 798 NodeProperties::SetType(input, input_type);
799 } 799 }
800 } 800 }
801 ReplaceWithValue(node, input); 801 ReplaceWithValue(node, input);
802 return Replace(input); 802 return Replace(input);
803 } 803 }
804 return NoChange(); 804 return NoChange();
805 } 805 }
806 806
807 Reduction JSTypedLowering::ReduceJSToNumberInput(Node* input) { 807 Reduction JSTypedLowering::ReduceJSToNumberInput(Node* input) {
808 // Check for ToNumber truncation of signaling NaN to undefined mapping.
809 if (input->opcode() == IrOpcode::kSelect) {
810 Node* check = NodeProperties::GetValueInput(input, 0);
811 Node* vtrue = NodeProperties::GetValueInput(input, 1);
812 Type* vtrue_type = NodeProperties::GetType(vtrue);
813 Node* vfalse = NodeProperties::GetValueInput(input, 2);
814 Type* vfalse_type = NodeProperties::GetType(vfalse);
815 if (vtrue_type->Is(Type::Undefined()) && vfalse_type->Is(Type::Number())) {
816 if (check->opcode() == IrOpcode::kNumberIsHoleNaN &&
817 check->InputAt(0) == vfalse) {
818 // JSToNumber(Select(NumberIsHoleNaN(x), y:undefined, x:number)) => x
819 return Replace(vfalse);
820 }
821 }
822 }
823 // Try constant-folding of JSToNumber with constant inputs. 808 // Try constant-folding of JSToNumber with constant inputs.
824 Type* input_type = NodeProperties::GetType(input); 809 Type* input_type = NodeProperties::GetType(input);
825 if (input_type->IsConstant()) { 810 if (input_type->IsConstant()) {
826 Handle<Object> input_value = input_type->AsConstant()->Value(); 811 Handle<Object> input_value = input_type->AsConstant()->Value();
827 if (input_value->IsString()) { 812 if (input_value->IsString()) {
828 return Replace(jsgraph()->Constant( 813 return Replace(jsgraph()->Constant(
829 String::ToNumber(Handle<String>::cast(input_value)))); 814 String::ToNumber(Handle<String>::cast(input_value))));
830 } else if (input_value->IsOddball()) { 815 } else if (input_value->IsOddball()) {
831 return Replace(jsgraph()->Constant( 816 return Replace(jsgraph()->Constant(
832 Oddball::ToNumber(Handle<Oddball>::cast(input_value)))); 817 Oddball::ToNumber(Handle<Oddball>::cast(input_value))));
(...skipping 1129 matching lines...) Expand 10 before | Expand all | Expand 10 after
1962 } 1947 }
1963 1948
1964 1949
1965 CompilationDependencies* JSTypedLowering::dependencies() const { 1950 CompilationDependencies* JSTypedLowering::dependencies() const {
1966 return dependencies_; 1951 return dependencies_;
1967 } 1952 }
1968 1953
1969 } // namespace compiler 1954 } // namespace compiler
1970 } // namespace internal 1955 } // namespace internal
1971 } // namespace v8 1956 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/js-native-context-specialization.cc ('k') | src/compiler/opcodes.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698