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

Side by Side Diff: src/x64/lithium-codegen-x64.cc

Issue 20706002: Fix Smi-based MathMinMax on x64, and reenable smi mode. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed comment Created 7 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « src/hydrogen-instructions.h ('k') | src/x64/lithium-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 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 1681 matching lines...) Expand 10 before | Expand all | Expand 10 after
1692 } 1692 }
1693 } 1693 }
1694 } 1694 }
1695 1695
1696 1696
1697 void LCodeGen::DoMathMinMax(LMathMinMax* instr) { 1697 void LCodeGen::DoMathMinMax(LMathMinMax* instr) {
1698 LOperand* left = instr->left(); 1698 LOperand* left = instr->left();
1699 LOperand* right = instr->right(); 1699 LOperand* right = instr->right();
1700 ASSERT(left->Equals(instr->result())); 1700 ASSERT(left->Equals(instr->result()));
1701 HMathMinMax::Operation operation = instr->hydrogen()->operation(); 1701 HMathMinMax::Operation operation = instr->hydrogen()->operation();
1702 if (instr->hydrogen()->representation().IsInteger32()) { 1702 if (instr->hydrogen()->representation().IsSmiOrInteger32()) {
1703 Label return_left; 1703 Label return_left;
1704 Condition condition = (operation == HMathMinMax::kMathMin) 1704 Condition condition = (operation == HMathMinMax::kMathMin)
1705 ? less_equal 1705 ? less_equal
1706 : greater_equal; 1706 : greater_equal;
1707 Register left_reg = ToRegister(left); 1707 Register left_reg = ToRegister(left);
1708 if (right->IsConstantOperand()) { 1708 if (right->IsConstantOperand()) {
1709 Immediate right_imm = 1709 Immediate right_imm =
1710 Immediate(ToInteger32(LConstantOperand::cast(right))); 1710 Immediate(ToInteger32(LConstantOperand::cast(right)));
1711 ASSERT(!instr->hydrogen_value()->representation().IsSmi());
1711 __ cmpl(left_reg, right_imm); 1712 __ cmpl(left_reg, right_imm);
1712 __ j(condition, &return_left, Label::kNear); 1713 __ j(condition, &return_left, Label::kNear);
1713 __ movq(left_reg, right_imm); 1714 __ movq(left_reg, right_imm);
1714 } else if (right->IsRegister()) { 1715 } else if (right->IsRegister()) {
1715 Register right_reg = ToRegister(right); 1716 Register right_reg = ToRegister(right);
1716 __ cmpl(left_reg, right_reg); 1717 if (instr->hydrogen_value()->representation().IsSmi()) {
1718 __ cmpq(left_reg, right_reg);
1719 } else {
1720 __ cmpl(left_reg, right_reg);
1721 }
1717 __ j(condition, &return_left, Label::kNear); 1722 __ j(condition, &return_left, Label::kNear);
1718 __ movq(left_reg, right_reg); 1723 __ movq(left_reg, right_reg);
1719 } else { 1724 } else {
1720 Operand right_op = ToOperand(right); 1725 Operand right_op = ToOperand(right);
1721 __ cmpl(left_reg, right_op); 1726 if (instr->hydrogen_value()->representation().IsSmi()) {
1727 __ cmpq(left_reg, right_op);
1728 } else {
1729 __ cmpl(left_reg, right_op);
1730 }
1722 __ j(condition, &return_left, Label::kNear); 1731 __ j(condition, &return_left, Label::kNear);
1723 __ movq(left_reg, right_op); 1732 __ movq(left_reg, right_op);
1724 } 1733 }
1725 __ bind(&return_left); 1734 __ bind(&return_left);
1726 } else { 1735 } else {
1727 ASSERT(instr->hydrogen()->representation().IsDouble()); 1736 ASSERT(instr->hydrogen()->representation().IsDouble());
1728 Label check_nan_left, check_zero, return_left, return_right; 1737 Label check_nan_left, check_zero, return_left, return_right;
1729 Condition condition = (operation == HMathMinMax::kMathMin) ? below : above; 1738 Condition condition = (operation == HMathMinMax::kMathMin) ? below : above;
1730 XMMRegister left_reg = ToDoubleRegister(left); 1739 XMMRegister left_reg = ToDoubleRegister(left);
1731 XMMRegister right_reg = ToDoubleRegister(right); 1740 XMMRegister right_reg = ToDoubleRegister(right);
(...skipping 3814 matching lines...) Expand 10 before | Expand all | Expand 10 after
5546 FixedArray::kHeaderSize - kPointerSize)); 5555 FixedArray::kHeaderSize - kPointerSize));
5547 __ bind(&done); 5556 __ bind(&done);
5548 } 5557 }
5549 5558
5550 5559
5551 #undef __ 5560 #undef __
5552 5561
5553 } } // namespace v8::internal 5562 } } // namespace v8::internal
5554 5563
5555 #endif // V8_TARGET_ARCH_X64 5564 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/hydrogen-instructions.h ('k') | src/x64/lithium-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698