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

Side by Side Diff: src/compiler/x87/code-generator-x87.cc

Issue 1762483003: X87: [turbofan] Introduce DeoptimizeIf And DeoptimizeUnless common operators. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: 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 | « no previous file | src/compiler/x87/instruction-selector-x87.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/code-generator.h" 5 #include "src/compiler/code-generator.h"
6 6
7 #include "src/ast/scopes.h" 7 #include "src/ast/scopes.h"
8 #include "src/compiler/code-generator-impl.h" 8 #include "src/compiler/code-generator-impl.h"
9 #include "src/compiler/gap-resolver.h" 9 #include "src/compiler/gap-resolver.h"
10 #include "src/compiler/node-matchers.h" 10 #include "src/compiler/node-matchers.h"
(...skipping 1592 matching lines...) Expand 10 before | Expand all | Expand 10 after
1603 break; 1603 break;
1604 } 1604 }
1605 } // NOLINT(readability/fn_size) 1605 } // NOLINT(readability/fn_size)
1606 1606
1607 1607
1608 // Assembles a branch after an instruction. 1608 // Assembles a branch after an instruction.
1609 void CodeGenerator::AssembleArchBranch(Instruction* instr, BranchInfo* branch) { 1609 void CodeGenerator::AssembleArchBranch(Instruction* instr, BranchInfo* branch) {
1610 X87OperandConverter i(this, instr); 1610 X87OperandConverter i(this, instr);
1611 Label::Distance flabel_distance = 1611 Label::Distance flabel_distance =
1612 branch->fallthru ? Label::kNear : Label::kFar; 1612 branch->fallthru ? Label::kNear : Label::kFar;
1613 Label* tlabel = branch->true_label; 1613
1614 Label* flabel = branch->false_label; 1614 Label done;
1615 Label tlabel_tmp;
1616 Label flabel_tmp;
1617 Label* tlabel = &tlabel_tmp;
1618 Label* flabel = &flabel_tmp;
1619
1620 Label* tlabel_dst = branch->true_label;
1621 Label* flabel_dst = branch->false_label;
1622
1615 switch (branch->condition) { 1623 switch (branch->condition) {
1616 case kUnorderedEqual: 1624 case kUnorderedEqual:
1617 __ j(parity_even, flabel, flabel_distance); 1625 __ j(parity_even, flabel, flabel_distance);
1618 // Fall through. 1626 // Fall through.
1619 case kEqual: 1627 case kEqual:
1620 __ j(equal, tlabel); 1628 __ j(equal, tlabel);
1621 break; 1629 break;
1622 case kUnorderedNotEqual: 1630 case kUnorderedNotEqual:
1623 __ j(parity_even, tlabel); 1631 __ j(parity_even, tlabel);
1624 // Fall through. 1632 // Fall through.
(...skipping 29 matching lines...) Expand all
1654 break; 1662 break;
1655 case kNotOverflow: 1663 case kNotOverflow:
1656 __ j(no_overflow, tlabel); 1664 __ j(no_overflow, tlabel);
1657 break; 1665 break;
1658 default: 1666 default:
1659 UNREACHABLE(); 1667 UNREACHABLE();
1660 break; 1668 break;
1661 } 1669 }
1662 // Add a jump if not falling through to the next block. 1670 // Add a jump if not falling through to the next block.
1663 if (!branch->fallthru) __ jmp(flabel); 1671 if (!branch->fallthru) __ jmp(flabel);
1672
1673 __ jmp(&done);
1674 __ bind(&tlabel_tmp);
1675 FlagsMode mode = FlagsModeField::decode(instr->opcode());
1676 if (mode == kFlags_deoptimize) {
1677 int double_register_param_count = 0;
1678 int x87_layout = 0;
1679 for (size_t i = 0; i < instr->InputCount(); i++) {
1680 if (instr->InputAt(i)->IsDoubleRegister()) {
1681 double_register_param_count++;
1682 }
1683 }
1684 // Currently we use only one X87 register. If double_register_param_count
1685 // is bigger than 1, it means duplicated double register is added to input
1686 // of this instruction.
1687 if (double_register_param_count > 0) {
1688 x87_layout = (0 << 3) | 1;
1689 }
1690 // The layout of x87 register stack is loaded on the top of FPU register
1691 // stack for deoptimization.
1692 __ push(Immediate(x87_layout));
1693 __ fild_s(MemOperand(esp, 0));
1694 __ lea(esp, Operand(esp, kPointerSize));
1695 }
1696 __ jmp(tlabel_dst);
1697 __ bind(&flabel_tmp);
1698 __ jmp(flabel_dst);
1699 __ bind(&done);
1664 } 1700 }
1665 1701
1666 1702
1667 void CodeGenerator::AssembleArchJump(RpoNumber target) { 1703 void CodeGenerator::AssembleArchJump(RpoNumber target) {
1668 if (!IsNextInAssemblyOrder(target)) __ jmp(GetLabel(target)); 1704 if (!IsNextInAssemblyOrder(target)) __ jmp(GetLabel(target));
1669 } 1705 }
1670 1706
1671 1707
1672 // Assembles boolean materializations after an instruction. 1708 // Assembles boolean materializations after an instruction.
1673 void CodeGenerator::AssembleArchBoolean(Instruction* instr, 1709 void CodeGenerator::AssembleArchBoolean(Instruction* instr,
(...skipping 576 matching lines...) Expand 10 before | Expand all | Expand 10 after
2250 int padding_size = last_lazy_deopt_pc_ + space_needed - current_pc; 2286 int padding_size = last_lazy_deopt_pc_ + space_needed - current_pc;
2251 __ Nop(padding_size); 2287 __ Nop(padding_size);
2252 } 2288 }
2253 } 2289 }
2254 2290
2255 #undef __ 2291 #undef __
2256 2292
2257 } // namespace compiler 2293 } // namespace compiler
2258 } // namespace internal 2294 } // namespace internal
2259 } // namespace v8 2295 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | src/compiler/x87/instruction-selector-x87.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698