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

Side by Side Diff: src/compiler/common-operator-reducer.cc

Issue 2155123002: [turbofan] Eliminate checkpoints before return in common op reducer. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 5 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/checkpoint-elimination.cc ('k') | test/mjsunit/compiler/regress-628773.js » ('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/common-operator-reducer.h" 5 #include "src/compiler/common-operator-reducer.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "src/compiler/common-operator.h" 9 #include "src/compiler/common-operator.h"
10 #include "src/compiler/graph.h" 10 #include "src/compiler/graph.h"
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 } 296 }
297 // We might now be able to further reduce the {merge} node. 297 // We might now be able to further reduce the {merge} node.
298 Revisit(merge); 298 Revisit(merge);
299 return Replace(value); 299 return Replace(value);
300 } 300 }
301 301
302 302
303 Reduction CommonOperatorReducer::ReduceReturn(Node* node) { 303 Reduction CommonOperatorReducer::ReduceReturn(Node* node) {
304 DCHECK_EQ(IrOpcode::kReturn, node->opcode()); 304 DCHECK_EQ(IrOpcode::kReturn, node->opcode());
305 Node* const value = node->InputAt(0); 305 Node* const value = node->InputAt(0);
306 Node* const effect = node->InputAt(1); 306 Node* effect = NodeProperties::GetEffectInput(node);
307 Node* const control = node->InputAt(2); 307 Node* const control = NodeProperties::GetControlInput(node);
308 if (effect->opcode() == IrOpcode::kCheckpoint) {
309 // Any {Return} node can never be used to insert a deoptimization point,
310 // hence checkpoints can be cut out of the effect chain flowing into it.
311 effect = NodeProperties::GetEffectInput(effect);
312 NodeProperties::ReplaceEffectInput(node, effect);
Benedikt Meurer 2016/07/18 11:29:54 You need to say Changed(node) as you changed some
Jarin 2016/07/18 11:48:53 Good catch! Done.
313 }
308 if (value->opcode() == IrOpcode::kPhi && 314 if (value->opcode() == IrOpcode::kPhi &&
309 NodeProperties::GetControlInput(value) == control && 315 NodeProperties::GetControlInput(value) == control &&
310 effect->opcode() == IrOpcode::kEffectPhi && 316 effect->opcode() == IrOpcode::kEffectPhi &&
311 NodeProperties::GetControlInput(effect) == control && 317 NodeProperties::GetControlInput(effect) == control &&
312 control->opcode() == IrOpcode::kMerge) { 318 control->opcode() == IrOpcode::kMerge) {
313 int const control_input_count = control->InputCount(); 319 int const control_input_count = control->InputCount();
314 DCHECK_NE(0, control_input_count); 320 DCHECK_NE(0, control_input_count);
315 DCHECK_EQ(control_input_count, value->InputCount() - 1); 321 DCHECK_EQ(control_input_count, value->InputCount() - 1);
316 DCHECK_EQ(control_input_count, effect->InputCount() - 1); 322 DCHECK_EQ(control_input_count, effect->InputCount() - 1);
317 DCHECK_EQ(IrOpcode::kEnd, graph()->end()->opcode()); 323 DCHECK_EQ(IrOpcode::kEnd, graph()->end()->opcode());
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
405 node->ReplaceInput(0, a); 411 node->ReplaceInput(0, a);
406 node->ReplaceInput(1, b); 412 node->ReplaceInput(1, b);
407 node->TrimInputCount(2); 413 node->TrimInputCount(2);
408 NodeProperties::ChangeOp(node, op); 414 NodeProperties::ChangeOp(node, op);
409 return Changed(node); 415 return Changed(node);
410 } 416 }
411 417
412 } // namespace compiler 418 } // namespace compiler
413 } // namespace internal 419 } // namespace internal
414 } // namespace v8 420 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/checkpoint-elimination.cc ('k') | test/mjsunit/compiler/regress-628773.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698