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

Side by Side Diff: src/compiler/osr.cc

Issue 1157023002: [turbofan] Change End to take a variable number of inputs. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 7 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
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.h" 5 #include "src/compiler.h"
6 #include "src/compiler/all-nodes.h" 6 #include "src/compiler/all-nodes.h"
7 #include "src/compiler/common-operator.h" 7 #include "src/compiler/common-operator.h"
8 #include "src/compiler/control-reducer.h" 8 #include "src/compiler/control-reducer.h"
9 #include "src/compiler/frame.h" 9 #include "src/compiler/frame.h"
10 #include "src/compiler/graph.h" 10 #include "src/compiler/graph.h"
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 // Kill the outer loops in the original graph. 221 // Kill the outer loops in the original graph.
222 TRACE("Killing outer loop headers...\n"); 222 TRACE("Killing outer loop headers...\n");
223 for (LoopTree::Loop* outer = osr_loop->parent(); outer; 223 for (LoopTree::Loop* outer = osr_loop->parent(); outer;
224 outer = outer->parent()) { 224 outer = outer->parent()) {
225 Node* loop_header = loop_tree->HeaderNode(outer); 225 Node* loop_header = loop_tree->HeaderNode(outer);
226 loop_header->ReplaceUses(dead); 226 loop_header->ReplaceUses(dead);
227 TRACE(" ---- #%d:%s\n", loop_header->id(), loop_header->op()->mnemonic()); 227 TRACE(" ---- #%d:%s\n", loop_header->id(), loop_header->op()->mnemonic());
228 } 228 }
229 229
230 // Merge the ends of the graph copies. 230 // Merge the ends of the graph copies.
231 Node* end = graph->end(); 231 Node* const end = graph->end();
232 tmp_inputs.clear(); 232 int const input_count = end->InputCount();
233 for (int i = -1; i < static_cast<int>(copies.size()); i++) { 233 for (int i = 0; i < input_count; ++i) {
234 Node* input = end->InputAt(0); 234 NodeId const id = end->InputAt(i)->id();
235 if (i >= 0) input = copies[i]->at(input->id()); 235 for (NodeVector* const copy : copies) {
236 if (input->opcode() == IrOpcode::kMerge) { 236 end->AppendInput(graph->zone(), copy->at(id));
237 for (Node* node : input->inputs()) tmp_inputs.push_back(node); 237 end->set_op(common->End(end->InputCount()));
238 } else {
239 tmp_inputs.push_back(input);
240 } 238 }
241 } 239 }
242 int count = static_cast<int>(tmp_inputs.size());
243 Node* merge = graph->NewNode(common->Merge(count), count, &tmp_inputs[0]);
244 end->ReplaceInput(0, merge);
245 240
246 if (FLAG_trace_turbo_graph) { // Simple textual RPO. 241 if (FLAG_trace_turbo_graph) { // Simple textual RPO.
247 OFStream os(stdout); 242 OFStream os(stdout);
248 os << "-- Graph after OSR duplication -- " << std::endl; 243 os << "-- Graph after OSR duplication -- " << std::endl;
249 os << AsRPO(*graph); 244 os << AsRPO(*graph);
250 } 245 }
251 } 246 }
252 247
253 248
254 static void TransferOsrValueTypesFromLoopPhis(Zone* zone, Node* osr_loop_entry, 249 static void TransferOsrValueTypesFromLoopPhis(Zone* zone, Node* osr_loop_entry,
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
353 // the first spill slots. 348 // the first spill slots.
354 frame->ReserveSpillSlots(UnoptimizedFrameSlots()); 349 frame->ReserveSpillSlots(UnoptimizedFrameSlots());
355 // The frame needs to be adjusted by the number of unoptimized frame slots. 350 // The frame needs to be adjusted by the number of unoptimized frame slots.
356 frame->SetOsrStackSlotCount(static_cast<int>(UnoptimizedFrameSlots())); 351 frame->SetOsrStackSlotCount(static_cast<int>(UnoptimizedFrameSlots()));
357 } 352 }
358 353
359 354
360 } // namespace compiler 355 } // namespace compiler
361 } // namespace internal 356 } // namespace internal
362 } // namespace v8 357 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698