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

Side by Side Diff: src/compiler/simplified-lowering.cc

Issue 2388303006: Reland of "[turbofan] Osr value typing + dynamic type checks on entry. (patchset #5 id:80001 of htt… (Closed)
Patch Set: Tweaks Created 4 years, 2 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/pipeline.cc ('k') | src/compiler/typer.cc » ('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/compiler/simplified-lowering.h" 5 #include "src/compiler/simplified-lowering.h"
6 6
7 #include <limits> 7 #include <limits>
8 8
9 #include "src/address-map.h" 9 #include "src/address-map.h"
10 #include "src/base/bits.h" 10 #include "src/base/bits.h"
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 return access.tag() != 0 ? UseInfo::AnyTagged() : UseInfo::PointerInt(); 154 return access.tag() != 0 ? UseInfo::AnyTagged() : UseInfo::PointerInt();
155 } 155 }
156 156
157 void ReplaceEffectControlUses(Node* node, Node* effect, Node* control) { 157 void ReplaceEffectControlUses(Node* node, Node* effect, Node* control) {
158 for (Edge edge : node->use_edges()) { 158 for (Edge edge : node->use_edges()) {
159 if (NodeProperties::IsControlEdge(edge)) { 159 if (NodeProperties::IsControlEdge(edge)) {
160 edge.UpdateTo(control); 160 edge.UpdateTo(control);
161 } else if (NodeProperties::IsEffectEdge(edge)) { 161 } else if (NodeProperties::IsEffectEdge(edge)) {
162 edge.UpdateTo(effect); 162 edge.UpdateTo(effect);
163 } else { 163 } else {
164 DCHECK(NodeProperties::IsValueEdge(edge)); 164 DCHECK(NodeProperties::IsValueEdge(edge) ||
165 NodeProperties::IsContextEdge(edge));
165 } 166 }
166 } 167 }
167 } 168 }
168 169
169 void ChangeToPureOp(Node* node, const Operator* new_op) { 170 void ChangeToPureOp(Node* node, const Operator* new_op) {
170 if (node->op()->EffectInputCount() > 0) { 171 if (node->op()->EffectInputCount() > 0) {
171 DCHECK_LT(0, node->op()->ControlInputCount()); 172 DCHECK_LT(0, node->op()->ControlInputCount());
172 // Disconnect the node from effect and control chains. 173 // Disconnect the node from effect and control chains.
173 Node* control = NodeProperties::GetControlInput(node); 174 Node* control = NodeProperties::GetControlInput(node);
174 Node* effect = NodeProperties::GetEffectInput(node); 175 Node* effect = NodeProperties::GetEffectInput(node);
(...skipping 1084 matching lines...) Expand 10 before | Expand all | Expand 10 after
1259 if (lower()) DeferReplacement(node, lowering->Int32Mod(node)); 1260 if (lower()) DeferReplacement(node, lowering->Int32Mod(node));
1260 return; 1261 return;
1261 } 1262 }
1262 // default case => Float64Mod 1263 // default case => Float64Mod
1263 VisitBinop(node, UseInfo::CheckedNumberOrOddballAsFloat64(), 1264 VisitBinop(node, UseInfo::CheckedNumberOrOddballAsFloat64(),
1264 MachineRepresentation::kFloat64, Type::Number()); 1265 MachineRepresentation::kFloat64, Type::Number());
1265 if (lower()) ChangeToPureOp(node, Float64Op(node)); 1266 if (lower()) ChangeToPureOp(node, Float64Op(node));
1266 return; 1267 return;
1267 } 1268 }
1268 1269
1270 void VisitOsrGuard(Node* node) {
1271 VisitInputs(node);
1272
1273 // Insert a dynamic check for the OSR value type if necessary.
1274 switch (OsrGuardTypeOf(node->op())) {
1275 case OsrGuardType::kUninitialized:
1276 // At this point, we should always have a type for the OsrValue.
1277 UNREACHABLE();
1278 break;
1279 case OsrGuardType::kSignedSmall:
1280 if (lower()) {
1281 NodeProperties::ChangeOp(node,
1282 simplified()->CheckedTaggedToTaggedSigned());
1283 }
1284 return SetOutput(node, MachineRepresentation::kTaggedSigned);
1285 case OsrGuardType::kAny: // Nothing to check.
1286 if (lower()) {
1287 DeferReplacement(node, node->InputAt(0));
1288 }
1289 return SetOutput(node, MachineRepresentation::kTagged);
1290 }
1291 UNREACHABLE();
1292 }
1293
1269 // Dispatching routine for visiting the node {node} with the usage {use}. 1294 // Dispatching routine for visiting the node {node} with the usage {use}.
1270 // Depending on the operator, propagate new usage info to the inputs. 1295 // Depending on the operator, propagate new usage info to the inputs.
1271 void VisitNode(Node* node, Truncation truncation, 1296 void VisitNode(Node* node, Truncation truncation,
1272 SimplifiedLowering* lowering) { 1297 SimplifiedLowering* lowering) {
1273 // Unconditionally eliminate unused pure nodes (only relevant if there's 1298 // Unconditionally eliminate unused pure nodes (only relevant if there's
1274 // a pure operation in between two effectful ones, where the last one 1299 // a pure operation in between two effectful ones, where the last one
1275 // is unused). 1300 // is unused).
1276 // Note: We must not do this for constants, as they are cached and we 1301 // Note: We must not do this for constants, as they are cached and we
1277 // would thus kill the cached {node} during lowering (i.e. replace all 1302 // would thus kill the cached {node} during lowering (i.e. replace all
1278 // uses with Dead), but at that point some node lowering might have 1303 // uses with Dead), but at that point some node lowering might have
(...skipping 1123 matching lines...) Expand 10 before | Expand all | Expand 10 after
2402 // We just get rid of the sigma here. In principle, it should be 2427 // We just get rid of the sigma here. In principle, it should be
2403 // possible to refine the truncation and representation based on 2428 // possible to refine the truncation and representation based on
2404 // the sigma's type. 2429 // the sigma's type.
2405 MachineRepresentation output = 2430 MachineRepresentation output =
2406 GetOutputInfoForPhi(node, TypeOf(node->InputAt(0)), truncation); 2431 GetOutputInfoForPhi(node, TypeOf(node->InputAt(0)), truncation);
2407 VisitUnop(node, UseInfo(output, truncation), output); 2432 VisitUnop(node, UseInfo(output, truncation), output);
2408 if (lower()) DeferReplacement(node, node->InputAt(0)); 2433 if (lower()) DeferReplacement(node, node->InputAt(0));
2409 return; 2434 return;
2410 } 2435 }
2411 2436
2437 case IrOpcode::kOsrGuard:
2438 return VisitOsrGuard(node);
2439
2412 // Operators with all inputs tagged and no or tagged output have uniform 2440 // Operators with all inputs tagged and no or tagged output have uniform
2413 // handling. 2441 // handling.
2414 case IrOpcode::kEnd: 2442 case IrOpcode::kEnd:
2415 case IrOpcode::kReturn: 2443 case IrOpcode::kReturn:
2416 case IrOpcode::kIfSuccess: 2444 case IrOpcode::kIfSuccess:
2417 case IrOpcode::kIfException: 2445 case IrOpcode::kIfException:
2418 case IrOpcode::kIfTrue: 2446 case IrOpcode::kIfTrue:
2419 case IrOpcode::kIfFalse: 2447 case IrOpcode::kIfFalse:
2420 case IrOpcode::kDeoptimize: 2448 case IrOpcode::kDeoptimize:
2421 case IrOpcode::kEffectPhi: 2449 case IrOpcode::kEffectPhi:
2422 case IrOpcode::kTerminate: 2450 case IrOpcode::kTerminate:
2423 case IrOpcode::kFrameState: 2451 case IrOpcode::kFrameState:
2424 case IrOpcode::kCheckpoint: 2452 case IrOpcode::kCheckpoint:
2425 case IrOpcode::kLoop: 2453 case IrOpcode::kLoop:
2426 case IrOpcode::kMerge: 2454 case IrOpcode::kMerge:
2427 case IrOpcode::kThrow: 2455 case IrOpcode::kThrow:
2428 case IrOpcode::kBeginRegion: 2456 case IrOpcode::kBeginRegion:
2429 case IrOpcode::kFinishRegion: 2457 case IrOpcode::kFinishRegion:
2430 case IrOpcode::kOsrValue:
2431 case IrOpcode::kProjection: 2458 case IrOpcode::kProjection:
2432 case IrOpcode::kObjectState: 2459 case IrOpcode::kObjectState:
2460 case IrOpcode::kOsrValue:
2433 // All JavaScript operators except JSToNumber have uniform handling. 2461 // All JavaScript operators except JSToNumber have uniform handling.
2434 #define OPCODE_CASE(name) case IrOpcode::k##name: 2462 #define OPCODE_CASE(name) case IrOpcode::k##name:
2435 JS_SIMPLE_BINOP_LIST(OPCODE_CASE) 2463 JS_SIMPLE_BINOP_LIST(OPCODE_CASE)
2436 JS_OTHER_UNOP_LIST(OPCODE_CASE) 2464 JS_OTHER_UNOP_LIST(OPCODE_CASE)
2437 JS_OBJECT_OP_LIST(OPCODE_CASE) 2465 JS_OBJECT_OP_LIST(OPCODE_CASE)
2438 JS_CONTEXT_OP_LIST(OPCODE_CASE) 2466 JS_CONTEXT_OP_LIST(OPCODE_CASE)
2439 JS_OTHER_OP_LIST(OPCODE_CASE) 2467 JS_OTHER_OP_LIST(OPCODE_CASE)
2440 #undef OPCODE_CASE 2468 #undef OPCODE_CASE
2441 case IrOpcode::kJSToInteger: 2469 case IrOpcode::kJSToInteger:
2442 case IrOpcode::kJSToLength: 2470 case IrOpcode::kJSToLength:
(...skipping 767 matching lines...) Expand 10 before | Expand all | Expand 10 after
3210 isolate(), graph()->zone(), callable.descriptor(), 0, flags, 3238 isolate(), graph()->zone(), callable.descriptor(), 0, flags,
3211 Operator::kNoProperties); 3239 Operator::kNoProperties);
3212 to_number_operator_.set(common()->Call(desc)); 3240 to_number_operator_.set(common()->Call(desc));
3213 } 3241 }
3214 return to_number_operator_.get(); 3242 return to_number_operator_.get();
3215 } 3243 }
3216 3244
3217 } // namespace compiler 3245 } // namespace compiler
3218 } // namespace internal 3246 } // namespace internal
3219 } // namespace v8 3247 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/pipeline.cc ('k') | src/compiler/typer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698