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

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

Issue 2278903002: [turbofan] Narrow type of Phis during JSTypedLowering. (Closed)
Patch Set: Created 4 years, 3 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-typed-lowering.h ('k') | no next file » | 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/compiler/js-typed-lowering.h" 5 #include "src/compiler/js-typed-lowering.h"
6 6
7 #include "src/builtins/builtins-utils.h" 7 #include "src/builtins/builtins-utils.h"
8 #include "src/code-factory.h" 8 #include "src/code-factory.h"
9 #include "src/compilation-dependencies.h" 9 #include "src/compilation-dependencies.h"
10 #include "src/compiler/access-builder.h" 10 #include "src/compiler/access-builder.h"
(...skipping 1908 matching lines...) Expand 10 before | Expand all | Expand 10 after
1919 Node* element = effect = graph()->NewNode( 1919 Node* element = effect = graph()->NewNode(
1920 simplified()->LoadField(element_field), array, effect, control); 1920 simplified()->LoadField(element_field), array, effect, control);
1921 Node* stale = jsgraph()->StaleRegisterConstant(); 1921 Node* stale = jsgraph()->StaleRegisterConstant();
1922 effect = graph()->NewNode(simplified()->StoreField(element_field), array, 1922 effect = graph()->NewNode(simplified()->StoreField(element_field), array,
1923 stale, effect, control); 1923 stale, effect, control);
1924 1924
1925 ReplaceWithValue(node, element, effect, control); 1925 ReplaceWithValue(node, element, effect, control);
1926 return Changed(element); 1926 return Changed(element);
1927 } 1927 }
1928 1928
1929 Reduction JSTypedLowering::ReducePhi(Node* node) {
1930 // Try to narrow the type of the Phi {node}, which might be more precise now
1931 // after lowering based on types, i.e. a SpeculativeNumberAdd has a more
1932 // precise type than the JSAdd that was in the graph when the Typer was run.
1933 DCHECK_EQ(IrOpcode::kPhi, node->opcode());
1934 int arity = node->op()->ValueInputCount();
1935 Type* type = NodeProperties::GetType(node->InputAt(0));
1936 for (int i = 1; i < arity; ++i) {
1937 type = Type::Union(type, NodeProperties::GetType(node->InputAt(i)),
1938 graph()->zone());
1939 }
1940 Type* const node_type = NodeProperties::GetType(node);
1941 if (!node_type->Is(type)) {
1942 type = Type::Intersect(node_type, type, graph()->zone());
1943 NodeProperties::SetType(node, type);
1944 return Changed(node);
1945 }
1946 return NoChange();
1947 }
1948
1929 Reduction JSTypedLowering::ReduceSelect(Node* node) { 1949 Reduction JSTypedLowering::ReduceSelect(Node* node) {
1930 DCHECK_EQ(IrOpcode::kSelect, node->opcode()); 1950 DCHECK_EQ(IrOpcode::kSelect, node->opcode());
1931 Node* const condition = NodeProperties::GetValueInput(node, 0); 1951 Node* const condition = NodeProperties::GetValueInput(node, 0);
1932 Type* const condition_type = NodeProperties::GetType(condition); 1952 Type* const condition_type = NodeProperties::GetType(condition);
1933 Node* const vtrue = NodeProperties::GetValueInput(node, 1); 1953 Node* const vtrue = NodeProperties::GetValueInput(node, 1);
1934 Type* const vtrue_type = NodeProperties::GetType(vtrue); 1954 Type* const vtrue_type = NodeProperties::GetType(vtrue);
1935 Node* const vfalse = NodeProperties::GetValueInput(node, 2); 1955 Node* const vfalse = NodeProperties::GetValueInput(node, 2);
1936 Type* const vfalse_type = NodeProperties::GetType(vfalse); 1956 Type* const vfalse_type = NodeProperties::GetType(vfalse);
1937 if (condition_type->Is(true_type_)) { 1957 if (condition_type->Is(true_type_)) {
1938 // Select(condition:true, vtrue, vfalse) => vtrue 1958 // Select(condition:true, vtrue, vfalse) => vtrue
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
2159 case IrOpcode::kJSForInNext: 2179 case IrOpcode::kJSForInNext:
2160 return ReduceJSForInNext(node); 2180 return ReduceJSForInNext(node);
2161 case IrOpcode::kJSForInStep: 2181 case IrOpcode::kJSForInStep:
2162 return ReduceJSForInStep(node); 2182 return ReduceJSForInStep(node);
2163 case IrOpcode::kJSGeneratorStore: 2183 case IrOpcode::kJSGeneratorStore:
2164 return ReduceJSGeneratorStore(node); 2184 return ReduceJSGeneratorStore(node);
2165 case IrOpcode::kJSGeneratorRestoreContinuation: 2185 case IrOpcode::kJSGeneratorRestoreContinuation:
2166 return ReduceJSGeneratorRestoreContinuation(node); 2186 return ReduceJSGeneratorRestoreContinuation(node);
2167 case IrOpcode::kJSGeneratorRestoreRegister: 2187 case IrOpcode::kJSGeneratorRestoreRegister:
2168 return ReduceJSGeneratorRestoreRegister(node); 2188 return ReduceJSGeneratorRestoreRegister(node);
2189 case IrOpcode::kPhi:
2190 return ReducePhi(node);
2169 case IrOpcode::kSelect: 2191 case IrOpcode::kSelect:
2170 return ReduceSelect(node); 2192 return ReduceSelect(node);
2171 case IrOpcode::kCheckMaps: 2193 case IrOpcode::kCheckMaps:
2172 return ReduceCheckMaps(node); 2194 return ReduceCheckMaps(node);
2173 case IrOpcode::kCheckString: 2195 case IrOpcode::kCheckString:
2174 return ReduceCheckString(node); 2196 return ReduceCheckString(node);
2175 case IrOpcode::kNumberCeil: 2197 case IrOpcode::kNumberCeil:
2176 case IrOpcode::kNumberFloor: 2198 case IrOpcode::kNumberFloor:
2177 case IrOpcode::kNumberRound: 2199 case IrOpcode::kNumberRound:
2178 case IrOpcode::kNumberTrunc: 2200 case IrOpcode::kNumberTrunc:
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
2213 } 2235 }
2214 2236
2215 2237
2216 CompilationDependencies* JSTypedLowering::dependencies() const { 2238 CompilationDependencies* JSTypedLowering::dependencies() const {
2217 return dependencies_; 2239 return dependencies_;
2218 } 2240 }
2219 2241
2220 } // namespace compiler 2242 } // namespace compiler
2221 } // namespace internal 2243 } // namespace internal
2222 } // namespace v8 2244 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/js-typed-lowering.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698