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

Side by Side Diff: src/compiler/instruction-selector.cc

Issue 1702423002: [turbofan] Further fixing ES6 tail call elimination in Turbofan. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@tco-turbo
Patch Set: Addressing comments Created 4 years, 9 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/instruction-selector.h ('k') | src/compiler/mips/code-generator-mips.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 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/instruction-selector.h" 5 #include "src/compiler/instruction-selector.h"
6 6
7 #include <limits> 7 #include <limits>
8 8
9 #include "src/base/adapters.h" 9 #include "src/base/adapters.h"
10 #include "src/compiler/instruction-selector-impl.h" 10 #include "src/compiler/instruction-selector-impl.h"
(...skipping 1540 matching lines...) Expand 10 before | Expand all | Expand 10 after
1551 1551
1552 // Compute InstructionOperands for inputs and outputs. 1552 // Compute InstructionOperands for inputs and outputs.
1553 CallBufferFlags flags(kCallCodeImmediate | kCallTail); 1553 CallBufferFlags flags(kCallCodeImmediate | kCallTail);
1554 if (IsTailCallAddressImmediate()) { 1554 if (IsTailCallAddressImmediate()) {
1555 flags |= kCallAddressImmediate; 1555 flags |= kCallAddressImmediate;
1556 } 1556 }
1557 InitializeCallBuffer(node, &buffer, flags, stack_param_delta); 1557 InitializeCallBuffer(node, &buffer, flags, stack_param_delta);
1558 1558
1559 // Select the appropriate opcode based on the call type. 1559 // Select the appropriate opcode based on the call type.
1560 InstructionCode opcode; 1560 InstructionCode opcode;
1561 switch (descriptor->kind()) { 1561 InstructionOperandVector temps(zone());
1562 case CallDescriptor::kCallCodeObject: 1562 if (linkage()->GetIncomingDescriptor()->IsJSFunctionCall()) {
1563 opcode = kArchTailCallCodeObject; 1563 switch (descriptor->kind()) {
1564 break; 1564 case CallDescriptor::kCallCodeObject:
1565 case CallDescriptor::kCallJSFunction: 1565 opcode = kArchTailCallCodeObjectFromJSFunction;
1566 opcode = kArchTailCallJSFunction; 1566 break;
1567 break; 1567 case CallDescriptor::kCallJSFunction:
1568 default: 1568 opcode = kArchTailCallJSFunctionFromJSFunction;
1569 UNREACHABLE(); 1569 break;
1570 return; 1570 default:
1571 UNREACHABLE();
1572 return;
1573 }
1574 int temps_count = GetTempsCountForTailCallFromJSFunction();
1575 for (int i = 0; i < temps_count; i++) {
1576 temps.push_back(g.TempRegister());
1577 }
1578 } else {
1579 switch (descriptor->kind()) {
1580 case CallDescriptor::kCallCodeObject:
1581 opcode = kArchTailCallCodeObject;
1582 break;
1583 case CallDescriptor::kCallJSFunction:
1584 opcode = kArchTailCallJSFunction;
1585 break;
1586 default:
1587 UNREACHABLE();
1588 return;
1589 }
1571 } 1590 }
1572 opcode |= MiscField::encode(descriptor->flags()); 1591 opcode |= MiscField::encode(descriptor->flags());
1573 1592
1574 buffer.instruction_args.push_back(g.TempImmediate(stack_param_delta)); 1593 buffer.instruction_args.push_back(g.TempImmediate(stack_param_delta));
1575 1594
1576 Emit(kArchPrepareTailCall, g.NoOutput(), 1595 Emit(kArchPrepareTailCall, g.NoOutput(),
1577 g.TempImmediate(stack_param_delta)); 1596 g.TempImmediate(stack_param_delta));
1578 1597
1579 // Emit the tailcall instruction. 1598 // Emit the tailcall instruction.
1580 Emit(opcode, 0, nullptr, buffer.instruction_args.size(), 1599 Emit(opcode, 0, nullptr, buffer.instruction_args.size(),
1581 &buffer.instruction_args.front()); 1600 &buffer.instruction_args.front(), temps.size(),
1601 temps.empty() ? nullptr : &temps.front());
1582 } else { 1602 } else {
1583 FrameStateDescriptor* frame_state_descriptor = 1603 FrameStateDescriptor* frame_state_descriptor =
1584 descriptor->NeedsFrameState() 1604 descriptor->NeedsFrameState()
1585 ? GetFrameStateDescriptor( 1605 ? GetFrameStateDescriptor(
1586 node->InputAt(static_cast<int>(descriptor->InputCount()))) 1606 node->InputAt(static_cast<int>(descriptor->InputCount())))
1587 : nullptr; 1607 : nullptr;
1588 1608
1589 CallBuffer buffer(zone(), descriptor, frame_state_descriptor); 1609 CallBuffer buffer(zone(), descriptor, frame_state_descriptor);
1590 1610
1591 // Compute InstructionOperands for inputs and outputs. 1611 // Compute InstructionOperands for inputs and outputs.
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
1725 return new (instruction_zone()) FrameStateDescriptor( 1745 return new (instruction_zone()) FrameStateDescriptor(
1726 instruction_zone(), state_info.type(), state_info.bailout_id(), 1746 instruction_zone(), state_info.type(), state_info.bailout_id(),
1727 state_info.state_combine(), parameters, locals, stack, 1747 state_info.state_combine(), parameters, locals, stack,
1728 state_info.shared_info(), outer_state); 1748 state_info.shared_info(), outer_state);
1729 } 1749 }
1730 1750
1731 1751
1732 } // namespace compiler 1752 } // namespace compiler
1733 } // namespace internal 1753 } // namespace internal
1734 } // namespace v8 1754 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/instruction-selector.h ('k') | src/compiler/mips/code-generator-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698