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/schedule.cc

Issue 928213003: Model exceptional edges from call nodes in TurboFan. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebased. 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/schedule.h ('k') | src/compiler/scheduler.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 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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/schedule.h" 5 #include "src/compiler/schedule.h"
6 6
7 #include "src/compiler/node.h" 7 #include "src/compiler/node.h"
8 #include "src/compiler/node-properties.h" 8 #include "src/compiler/node-properties.h"
9 #include "src/ostreams.h" 9 #include "src/ostreams.h"
10 10
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 return b1; 93 return b1;
94 } 94 }
95 95
96 96
97 std::ostream& operator<<(std::ostream& os, const BasicBlock::Control& c) { 97 std::ostream& operator<<(std::ostream& os, const BasicBlock::Control& c) {
98 switch (c) { 98 switch (c) {
99 case BasicBlock::kNone: 99 case BasicBlock::kNone:
100 return os << "none"; 100 return os << "none";
101 case BasicBlock::kGoto: 101 case BasicBlock::kGoto:
102 return os << "goto"; 102 return os << "goto";
103 case BasicBlock::kCall:
104 return os << "call";
103 case BasicBlock::kBranch: 105 case BasicBlock::kBranch:
104 return os << "branch"; 106 return os << "branch";
105 case BasicBlock::kSwitch: 107 case BasicBlock::kSwitch:
106 return os << "switch"; 108 return os << "switch";
107 case BasicBlock::kReturn: 109 case BasicBlock::kReturn:
108 return os << "return"; 110 return os << "return";
109 case BasicBlock::kThrow: 111 case BasicBlock::kThrow:
110 return os << "throw"; 112 return os << "throw";
111 } 113 }
112 UNREACHABLE(); 114 UNREACHABLE();
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 os << "Adding #" << node->id() << ":" << node->op()->mnemonic() << " to B" 189 os << "Adding #" << node->id() << ":" << node->op()->mnemonic() << " to B"
188 << block->id() << "\n"; 190 << block->id() << "\n";
189 } 191 }
190 DCHECK(this->block(node) == NULL || this->block(node) == block); 192 DCHECK(this->block(node) == NULL || this->block(node) == block);
191 block->AddNode(node); 193 block->AddNode(node);
192 SetBlockForNode(block, node); 194 SetBlockForNode(block, node);
193 } 195 }
194 196
195 197
196 void Schedule::AddGoto(BasicBlock* block, BasicBlock* succ) { 198 void Schedule::AddGoto(BasicBlock* block, BasicBlock* succ) {
197 DCHECK(block->control() == BasicBlock::kNone); 199 DCHECK_EQ(BasicBlock::kNone, block->control());
198 block->set_control(BasicBlock::kGoto); 200 block->set_control(BasicBlock::kGoto);
199 AddSuccessor(block, succ); 201 AddSuccessor(block, succ);
200 } 202 }
201 203
202 204
205 void Schedule::AddCall(BasicBlock* block, Node* call, BasicBlock* success_block,
206 BasicBlock* exception_block) {
207 DCHECK_EQ(BasicBlock::kNone, block->control());
208 DCHECK_EQ(IrOpcode::kCall, call->opcode());
209 block->set_control(BasicBlock::kCall);
210 AddSuccessor(block, success_block);
211 AddSuccessor(block, exception_block);
212 SetControlInput(block, call);
213 }
214
215
203 void Schedule::AddBranch(BasicBlock* block, Node* branch, BasicBlock* tblock, 216 void Schedule::AddBranch(BasicBlock* block, Node* branch, BasicBlock* tblock,
204 BasicBlock* fblock) { 217 BasicBlock* fblock) {
205 DCHECK(block->control() == BasicBlock::kNone); 218 DCHECK_EQ(BasicBlock::kNone, block->control());
206 DCHECK(branch->opcode() == IrOpcode::kBranch); 219 DCHECK_EQ(IrOpcode::kBranch, branch->opcode());
207 block->set_control(BasicBlock::kBranch); 220 block->set_control(BasicBlock::kBranch);
208 AddSuccessor(block, tblock); 221 AddSuccessor(block, tblock);
209 AddSuccessor(block, fblock); 222 AddSuccessor(block, fblock);
210 SetControlInput(block, branch); 223 SetControlInput(block, branch);
211 } 224 }
212 225
213 226
214 void Schedule::AddSwitch(BasicBlock* block, Node* sw, BasicBlock** succ_blocks, 227 void Schedule::AddSwitch(BasicBlock* block, Node* sw, BasicBlock** succ_blocks,
215 size_t succ_count) { 228 size_t succ_count) {
216 DCHECK_EQ(BasicBlock::kNone, block->control()); 229 DCHECK_EQ(BasicBlock::kNone, block->control());
217 DCHECK_EQ(IrOpcode::kSwitch, sw->opcode()); 230 DCHECK_EQ(IrOpcode::kSwitch, sw->opcode());
218 block->set_control(BasicBlock::kSwitch); 231 block->set_control(BasicBlock::kSwitch);
219 for (size_t index = 0; index < succ_count; ++index) { 232 for (size_t index = 0; index < succ_count; ++index) {
220 AddSuccessor(block, succ_blocks[index]); 233 AddSuccessor(block, succ_blocks[index]);
221 } 234 }
222 SetControlInput(block, sw); 235 SetControlInput(block, sw);
223 } 236 }
224 237
225 238
226 void Schedule::AddReturn(BasicBlock* block, Node* input) { 239 void Schedule::AddReturn(BasicBlock* block, Node* input) {
227 DCHECK(block->control() == BasicBlock::kNone); 240 DCHECK_EQ(BasicBlock::kNone, block->control());
228 block->set_control(BasicBlock::kReturn); 241 block->set_control(BasicBlock::kReturn);
229 SetControlInput(block, input); 242 SetControlInput(block, input);
230 if (block != end()) AddSuccessor(block, end()); 243 if (block != end()) AddSuccessor(block, end());
231 } 244 }
232 245
233 246
234 void Schedule::AddThrow(BasicBlock* block, Node* input) { 247 void Schedule::AddThrow(BasicBlock* block, Node* input) {
235 DCHECK(block->control() == BasicBlock::kNone); 248 DCHECK_EQ(BasicBlock::kNone, block->control());
236 block->set_control(BasicBlock::kThrow); 249 block->set_control(BasicBlock::kThrow);
237 SetControlInput(block, input); 250 SetControlInput(block, input);
238 if (block != end()) AddSuccessor(block, end()); 251 if (block != end()) AddSuccessor(block, end());
239 } 252 }
240 253
241 254
242 void Schedule::InsertBranch(BasicBlock* block, BasicBlock* end, Node* branch, 255 void Schedule::InsertBranch(BasicBlock* block, BasicBlock* end, Node* branch,
243 BasicBlock* tblock, BasicBlock* fblock) { 256 BasicBlock* tblock, BasicBlock* fblock) {
244 DCHECK(block->control() != BasicBlock::kNone); 257 DCHECK_NE(BasicBlock::kNone, block->control());
245 DCHECK(end->control() == BasicBlock::kNone); 258 DCHECK_EQ(BasicBlock::kNone, end->control());
246 end->set_control(block->control()); 259 end->set_control(block->control());
247 block->set_control(BasicBlock::kBranch); 260 block->set_control(BasicBlock::kBranch);
248 MoveSuccessors(block, end); 261 MoveSuccessors(block, end);
249 AddSuccessor(block, tblock); 262 AddSuccessor(block, tblock);
250 AddSuccessor(block, fblock); 263 AddSuccessor(block, fblock);
251 if (block->control_input() != nullptr) { 264 if (block->control_input() != nullptr) {
252 SetControlInput(end, block->control_input()); 265 SetControlInput(end, block->control_input());
253 } 266 }
254 SetControlInput(block, branch); 267 SetControlInput(block, branch);
255 } 268 }
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
346 } 359 }
347 os << "\n"; 360 os << "\n";
348 } 361 }
349 } 362 }
350 return os; 363 return os;
351 } 364 }
352 365
353 } // namespace compiler 366 } // namespace compiler
354 } // namespace internal 367 } // namespace internal
355 } // namespace v8 368 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/schedule.h ('k') | src/compiler/scheduler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698