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

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

Issue 1108563002: Detect simple tail calls (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fixed index type 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
« no previous file with comments | « src/compiler/ppc/instruction-selector-ppc.cc ('k') | src/compiler/x64/code-generator-x64.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/scheduler.h" 5 #include "src/compiler/scheduler.h"
6 6
7 #include <iomanip> 7 #include <iomanip>
8 8
9 #include "src/base/adapters.h" 9 #include "src/base/adapters.h"
10 #include "src/bit-vector.h" 10 #include "src/bit-vector.h"
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after
311 break; 311 break;
312 case IrOpcode::kLoop: 312 case IrOpcode::kLoop:
313 case IrOpcode::kMerge: 313 case IrOpcode::kMerge:
314 BuildBlockForNode(node); 314 BuildBlockForNode(node);
315 break; 315 break;
316 case IrOpcode::kBranch: 316 case IrOpcode::kBranch:
317 case IrOpcode::kSwitch: 317 case IrOpcode::kSwitch:
318 BuildBlocksForSuccessors(node); 318 BuildBlocksForSuccessors(node);
319 break; 319 break;
320 case IrOpcode::kCall: 320 case IrOpcode::kCall:
321 if (IsExceptionalCall(node)) { 321 if (NodeProperties::IsExceptionalCall(node)) {
322 BuildBlocksForSuccessors(node); 322 BuildBlocksForSuccessors(node);
323 } 323 }
324 break; 324 break;
325 default: 325 default:
326 break; 326 break;
327 } 327 }
328 } 328 }
329 329
330 void ConnectBlocks(Node* node) { 330 void ConnectBlocks(Node* node) {
331 switch (node->opcode()) { 331 switch (node->opcode()) {
(...skipping 15 matching lines...) Expand all
347 break; 347 break;
348 case IrOpcode::kReturn: 348 case IrOpcode::kReturn:
349 scheduler_->UpdatePlacement(node, Scheduler::kFixed); 349 scheduler_->UpdatePlacement(node, Scheduler::kFixed);
350 ConnectReturn(node); 350 ConnectReturn(node);
351 break; 351 break;
352 case IrOpcode::kThrow: 352 case IrOpcode::kThrow:
353 scheduler_->UpdatePlacement(node, Scheduler::kFixed); 353 scheduler_->UpdatePlacement(node, Scheduler::kFixed);
354 ConnectThrow(node); 354 ConnectThrow(node);
355 break; 355 break;
356 case IrOpcode::kCall: 356 case IrOpcode::kCall:
357 if (IsExceptionalCall(node)) { 357 if (NodeProperties::IsExceptionalCall(node)) {
358 scheduler_->UpdatePlacement(node, Scheduler::kFixed); 358 scheduler_->UpdatePlacement(node, Scheduler::kFixed);
359 ConnectCall(node); 359 ConnectCall(node);
360 } 360 }
361 break; 361 break;
362 default: 362 default:
363 break; 363 break;
364 } 364 }
365 } 365 }
366 366
367 BasicBlock* BuildBlockForNode(Node* node) { 367 BasicBlock* BuildBlockForNode(Node* node) {
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
512 DCHECK_NOT_NULL(block); 512 DCHECK_NOT_NULL(block);
513 if (succ == NULL) { 513 if (succ == NULL) {
514 TRACE("Connect #%d:%s, id:%d -> end\n", node->id(), 514 TRACE("Connect #%d:%s, id:%d -> end\n", node->id(),
515 node->op()->mnemonic(), block->id().ToInt()); 515 node->op()->mnemonic(), block->id().ToInt());
516 } else { 516 } else {
517 TRACE("Connect #%d:%s, id:%d -> id:%d\n", node->id(), 517 TRACE("Connect #%d:%s, id:%d -> id:%d\n", node->id(),
518 node->op()->mnemonic(), block->id().ToInt(), succ->id().ToInt()); 518 node->op()->mnemonic(), block->id().ToInt(), succ->id().ToInt());
519 } 519 }
520 } 520 }
521 521
522 bool IsExceptionalCall(Node* node) {
523 for (Node* const use : node->uses()) {
524 if (use->opcode() == IrOpcode::kIfException) return true;
525 }
526 return false;
527 }
528
529 bool IsFinalMerge(Node* node) { 522 bool IsFinalMerge(Node* node) {
530 return (node->opcode() == IrOpcode::kMerge && 523 return (node->opcode() == IrOpcode::kMerge &&
531 node == scheduler_->graph_->end()->InputAt(0)); 524 node == scheduler_->graph_->end()->InputAt(0));
532 } 525 }
533 526
534 bool IsSingleEntrySingleExitRegion(Node* entry, Node* exit) const { 527 bool IsSingleEntrySingleExitRegion(Node* entry, Node* exit) const {
535 size_t entry_class = scheduler_->equivalence_->ClassOf(entry); 528 size_t entry_class = scheduler_->equivalence_->ClassOf(entry);
536 size_t exit_class = scheduler_->equivalence_->ClassOf(exit); 529 size_t exit_class = scheduler_->equivalence_->ClassOf(exit);
537 return entry != exit && entry_class == exit_class; 530 return entry != exit && entry_class == exit_class;
538 } 531 }
(...skipping 1152 matching lines...) Expand 10 before | Expand all | Expand 10 after
1691 for (Node* const node : *nodes) { 1684 for (Node* const node : *nodes) {
1692 schedule_->SetBlockForNode(to, node); 1685 schedule_->SetBlockForNode(to, node);
1693 scheduled_nodes_[to->id().ToSize()].push_back(node); 1686 scheduled_nodes_[to->id().ToSize()].push_back(node);
1694 } 1687 }
1695 nodes->clear(); 1688 nodes->clear();
1696 } 1689 }
1697 1690
1698 } // namespace compiler 1691 } // namespace compiler
1699 } // namespace internal 1692 } // namespace internal
1700 } // namespace v8 1693 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/ppc/instruction-selector-ppc.cc ('k') | src/compiler/x64/code-generator-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698