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

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

Issue 921083004: [turbofan] Rename context stack as part of the environment for OSR. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 10 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/ast-graph-builder.cc ('k') | test/mjsunit/compiler/osr-block-scope.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.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 30 matching lines...) Expand all
41 ZoneVector<NodeVector*> copies(tmp_zone); 41 ZoneVector<NodeVector*> copies(tmp_zone);
42 for (LoopTree::Loop* loop = osr_loop->parent(); loop; loop = loop->parent()) { 42 for (LoopTree::Loop* loop = osr_loop->parent(); loop; loop = loop->parent()) {
43 void* stuff = tmp_zone->New(sizeof(NodeVector)); 43 void* stuff = tmp_zone->New(sizeof(NodeVector));
44 NodeVector* mapping = 44 NodeVector* mapping =
45 new (stuff) NodeVector(original_count, sentinel, tmp_zone); 45 new (stuff) NodeVector(original_count, sentinel, tmp_zone);
46 copies.push_back(mapping); 46 copies.push_back(mapping);
47 47
48 // Prepare the mapping for OSR values and the OSR loop entry. 48 // Prepare the mapping for OSR values and the OSR loop entry.
49 mapping->at(osr_normal_entry->id()) = dead; 49 mapping->at(osr_normal_entry->id()) = dead;
50 mapping->at(osr_loop_entry->id()) = dead; 50 mapping->at(osr_loop_entry->id()) = dead;
51 // Don't duplicate the OSR values.
52 for (Node* use : osr_loop_entry->uses()) {
53 if (use->opcode() == IrOpcode::kOsrValue) mapping->at(use->id()) = use;
54 }
55 51
56 // The outer loops are dead in this copy. 52 // The outer loops are dead in this copy.
57 for (LoopTree::Loop* outer = loop->parent(); outer; 53 for (LoopTree::Loop* outer = loop->parent(); outer;
58 outer = outer->parent()) { 54 outer = outer->parent()) {
59 for (Node* node : loop_tree->HeaderNodes(outer)) { 55 for (Node* node : loop_tree->HeaderNodes(outer)) {
60 mapping->at(node->id()) = dead; 56 mapping->at(node->id()) = dead;
61 } 57 }
62 } 58 }
63 59
64 // Copy all nodes. 60 // Copy all nodes.
65 for (size_t i = 0; i < all.live.size(); i++) { 61 for (size_t i = 0; i < all.live.size(); i++) {
66 Node* orig = all.live[i]; 62 Node* orig = all.live[i];
67 Node* copy = mapping->at(orig->id()); 63 Node* copy = mapping->at(orig->id());
68 if (copy != sentinel) { 64 if (copy != sentinel) {
69 // Mapping already exists. 65 // Mapping already exists.
70 continue; 66 continue;
71 } 67 }
72 if (orig->InputCount() == 0) { 68 if (orig->InputCount() == 0 || orig->opcode() == IrOpcode::kParameter ||
73 // No need to copy leaf nodes. 69 orig->opcode() == IrOpcode::kOsrValue) {
70 // No need to copy leaf nodes or parameters.
74 mapping->at(orig->id()) = orig; 71 mapping->at(orig->id()) = orig;
75 continue; 72 continue;
76 } 73 }
77 74
78 // Copy the node. 75 // Copy the node.
79 tmp_inputs.clear(); 76 tmp_inputs.clear();
80 for (Node* input : orig->inputs()) { 77 for (Node* input : orig->inputs()) {
81 tmp_inputs.push_back(mapping->at(input->id())); 78 tmp_inputs.push_back(mapping->at(input->id()));
82 } 79 }
83 copy = graph->NewNode(orig->op(), orig->InputCount(), &tmp_inputs[0]); 80 copy = graph->NewNode(orig->op(), orig->InputCount(), &tmp_inputs[0]);
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 // the first spill slots. 226 // the first spill slots.
230 frame->ReserveSpillSlots(UnoptimizedFrameSlots()); 227 frame->ReserveSpillSlots(UnoptimizedFrameSlots());
231 // The frame needs to be adjusted by the number of unoptimized frame slots. 228 // The frame needs to be adjusted by the number of unoptimized frame slots.
232 frame->SetOsrStackSlotCount(static_cast<int>(UnoptimizedFrameSlots())); 229 frame->SetOsrStackSlotCount(static_cast<int>(UnoptimizedFrameSlots()));
233 } 230 }
234 231
235 232
236 } // namespace compiler 233 } // namespace compiler
237 } // namespace internal 234 } // namespace internal
238 } // namespace v8 235 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/ast-graph-builder.cc ('k') | test/mjsunit/compiler/osr-block-scope.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698