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

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

Issue 1206533002: [turbofan] Run DeadCodeElimination together with the advanced reducers. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix test262 test failure Created 5 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/graph-reducer.cc ('k') | src/compiler/pipeline.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 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 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-intrinsic-lowering.h" 5 #include "src/compiler/js-intrinsic-lowering.h"
6 6
7 #include <stack> 7 #include <stack>
8 8
9 #include "src/compiler/access-builder.h" 9 #include "src/compiler/access-builder.h"
10 #include "src/compiler/js-graph.h" 10 #include "src/compiler/js-graph.h"
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 static_cast<JSDate::FieldIndex>(static_cast<int>(mindex.Value())))), 125 static_cast<JSDate::FieldIndex>(static_cast<int>(mindex.Value())))),
126 value, effect, control); 126 value, effect, control);
127 } 127 }
128 // TODO(turbofan): Optimize more patterns. 128 // TODO(turbofan): Optimize more patterns.
129 return NoChange(); 129 return NoChange();
130 } 130 }
131 131
132 132
133 Reduction JSIntrinsicLowering::ReduceDeoptimizeNow(Node* node) { 133 Reduction JSIntrinsicLowering::ReduceDeoptimizeNow(Node* node) {
134 if (mode() != kDeoptimizationEnabled) return NoChange(); 134 if (mode() != kDeoptimizationEnabled) return NoChange();
135 Node* frame_state = NodeProperties::GetFrameStateInput(node, 0); 135 Node* const frame_state = NodeProperties::GetFrameStateInput(node, 0);
136 DCHECK_EQ(frame_state->opcode(), IrOpcode::kFrameState); 136 Node* const effect = NodeProperties::GetEffectInput(node);
137 Node* const control = NodeProperties::GetControlInput(node);
137 138
138 Node* effect = NodeProperties::GetEffectInput(node); 139 // TODO(bmeurer): Move MergeControlToEnd() to the AdvancedReducer.
139 Node* control = NodeProperties::GetControlInput(node); 140 Node* deoptimize =
141 graph()->NewNode(common()->Deoptimize(), frame_state, effect, control);
142 NodeProperties::MergeControlToEnd(graph(), common(), deoptimize);
140 143
141 // We are making the continuation after the call dead. To 144 node->set_op(common()->Dead());
142 // model this, we generate if (true) statement with deopt 145 node->TrimInputCount(0);
143 // in the true branch and continuation in the false branch. 146 return Changed(node);
144 Node* branch =
145 graph()->NewNode(common()->Branch(), jsgraph()->TrueConstant(), control);
146
147 // False branch - the original continuation.
148 Node* if_false = graph()->NewNode(common()->IfFalse(), branch);
149 ReplaceWithValue(node, jsgraph()->UndefinedConstant(), effect, if_false);
150
151 // True branch: deopt.
152 Node* if_true = graph()->NewNode(common()->IfTrue(), branch);
153 Node* deopt =
154 graph()->NewNode(common()->Deoptimize(), frame_state, effect, if_true);
155
156 // Connect the deopt to the merge exiting the graph.
157 NodeProperties::MergeControlToEnd(graph(), common(), deopt);
158
159 return Changed(deopt);
160 } 147 }
161 148
162 149
163 Reduction JSIntrinsicLowering::ReduceDoubleHi(Node* node) { 150 Reduction JSIntrinsicLowering::ReduceDoubleHi(Node* node) {
164 return Change(node, machine()->Float64ExtractHighWord32()); 151 return Change(node, machine()->Float64ExtractHighWord32());
165 } 152 }
166 153
167 154
168 Reduction JSIntrinsicLowering::ReduceDoubleLo(Node* node) { 155 Reduction JSIntrinsicLowering::ReduceDoubleLo(Node* node) {
169 return Change(node, machine()->Float64ExtractLowWord32()); 156 return Change(node, machine()->Float64ExtractLowWord32());
(...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after
544 } 531 }
545 532
546 533
547 MachineOperatorBuilder* JSIntrinsicLowering::machine() const { 534 MachineOperatorBuilder* JSIntrinsicLowering::machine() const {
548 return jsgraph()->machine(); 535 return jsgraph()->machine();
549 } 536 }
550 537
551 } // namespace compiler 538 } // namespace compiler
552 } // namespace internal 539 } // namespace internal
553 } // namespace v8 540 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/graph-reducer.cc ('k') | src/compiler/pipeline.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698