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

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

Issue 153923005: A64: Synchronize with r17525. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/a64
Patch Set: Created 6 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 | Annotate | Revision Log
« no previous file with comments | « src/x64/lithium-codegen-x64.h ('k') | src/x64/lithium-gap-resolver-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 1614 matching lines...) Expand 10 before | Expand all | Expand 10 after
1625 __ PrepareCallCFunction(2); 1625 __ PrepareCallCFunction(2);
1626 __ movq(arg_reg_1, object); 1626 __ movq(arg_reg_1, object);
1627 __ movq(arg_reg_2, index, RelocInfo::NONE64); 1627 __ movq(arg_reg_2, index, RelocInfo::NONE64);
1628 __ CallCFunction(ExternalReference::get_date_field_function(isolate()), 2); 1628 __ CallCFunction(ExternalReference::get_date_field_function(isolate()), 2);
1629 __ movq(rsi, Operand(rbp, StandardFrameConstants::kContextOffset)); 1629 __ movq(rsi, Operand(rbp, StandardFrameConstants::kContextOffset));
1630 __ bind(&done); 1630 __ bind(&done);
1631 } 1631 }
1632 } 1632 }
1633 1633
1634 1634
1635 Operand LCodeGen::BuildSeqStringOperand(Register string,
1636 LOperand* index,
1637 String::Encoding encoding) {
1638 if (index->IsConstantOperand()) {
1639 int offset = ToInteger32(LConstantOperand::cast(index));
1640 if (encoding == String::TWO_BYTE_ENCODING) {
1641 offset *= kUC16Size;
1642 }
1643 STATIC_ASSERT(kCharSize == 1);
1644 return FieldOperand(string, SeqString::kHeaderSize + offset);
1645 }
1646 return FieldOperand(
1647 string, ToRegister(index),
1648 encoding == String::ONE_BYTE_ENCODING ? times_1 : times_2,
1649 SeqString::kHeaderSize);
1650 }
1651
1652
1635 void LCodeGen::DoSeqStringSetChar(LSeqStringSetChar* instr) { 1653 void LCodeGen::DoSeqStringSetChar(LSeqStringSetChar* instr) {
1654 String::Encoding encoding = instr->hydrogen()->encoding();
1636 Register string = ToRegister(instr->string()); 1655 Register string = ToRegister(instr->string());
1637 Register index = ToRegister(instr->index());
1638 Register value = ToRegister(instr->value());
1639 String::Encoding encoding = instr->encoding();
1640 1656
1641 if (FLAG_debug_code) { 1657 if (FLAG_debug_code) {
1642 __ push(value); 1658 __ push(string);
1643 __ movq(value, FieldOperand(string, HeapObject::kMapOffset)); 1659 __ movq(string, FieldOperand(string, HeapObject::kMapOffset));
1644 __ movzxbq(value, FieldOperand(value, Map::kInstanceTypeOffset)); 1660 __ movzxbq(string, FieldOperand(string, Map::kInstanceTypeOffset));
1645 1661
1646 __ andb(value, Immediate(kStringRepresentationMask | kStringEncodingMask)); 1662 __ andb(string, Immediate(kStringRepresentationMask | kStringEncodingMask));
1647 static const uint32_t one_byte_seq_type = kSeqStringTag | kOneByteStringTag; 1663 static const uint32_t one_byte_seq_type = kSeqStringTag | kOneByteStringTag;
1648 static const uint32_t two_byte_seq_type = kSeqStringTag | kTwoByteStringTag; 1664 static const uint32_t two_byte_seq_type = kSeqStringTag | kTwoByteStringTag;
1649 __ cmpq(value, Immediate(encoding == String::ONE_BYTE_ENCODING 1665 __ cmpq(string, Immediate(encoding == String::ONE_BYTE_ENCODING
1650 ? one_byte_seq_type : two_byte_seq_type)); 1666 ? one_byte_seq_type : two_byte_seq_type));
1651 __ Check(equal, kUnexpectedStringType); 1667 __ Check(equal, kUnexpectedStringType);
1652 __ pop(value); 1668 __ pop(string);
1653 } 1669 }
1654 1670
1655 if (encoding == String::ONE_BYTE_ENCODING) { 1671 Operand operand = BuildSeqStringOperand(string, instr->index(), encoding);
1656 __ movb(FieldOperand(string, index, times_1, SeqString::kHeaderSize), 1672 if (instr->value()->IsConstantOperand()) {
1657 value); 1673 int value = ToInteger32(LConstantOperand::cast(instr->value()));
1674 ASSERT_LE(0, value);
1675 if (encoding == String::ONE_BYTE_ENCODING) {
1676 ASSERT_LE(value, String::kMaxOneByteCharCode);
1677 __ movb(operand, Immediate(value));
1678 } else {
1679 ASSERT_LE(value, String::kMaxUtf16CodeUnit);
1680 __ movw(operand, Immediate(value));
1681 }
1658 } else { 1682 } else {
1659 __ movw(FieldOperand(string, index, times_2, SeqString::kHeaderSize), 1683 Register value = ToRegister(instr->value());
1660 value); 1684 if (encoding == String::ONE_BYTE_ENCODING) {
1685 __ movb(operand, value);
1686 } else {
1687 __ movw(operand, value);
1688 }
1661 } 1689 }
1662 } 1690 }
1663 1691
1664 1692
1665 void LCodeGen::DoThrow(LThrow* instr) { 1693 void LCodeGen::DoThrow(LThrow* instr) {
1666 __ push(ToRegister(instr->value())); 1694 __ push(ToRegister(instr->value()));
1667 CallRuntime(Runtime::kThrow, 1, instr); 1695 CallRuntime(Runtime::kThrow, 1, instr);
1668 1696
1669 if (FLAG_debug_code) { 1697 if (FLAG_debug_code) {
1670 Comment("Unreachable code."); 1698 Comment("Unreachable code.");
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
1764 __ j(condition, &return_left, Label::kNear); 1792 __ j(condition, &return_left, Label::kNear);
1765 __ jmp(&return_right, Label::kNear); 1793 __ jmp(&return_right, Label::kNear);
1766 1794
1767 __ bind(&check_zero); 1795 __ bind(&check_zero);
1768 XMMRegister xmm_scratch = double_scratch0(); 1796 XMMRegister xmm_scratch = double_scratch0();
1769 __ xorps(xmm_scratch, xmm_scratch); 1797 __ xorps(xmm_scratch, xmm_scratch);
1770 __ ucomisd(left_reg, xmm_scratch); 1798 __ ucomisd(left_reg, xmm_scratch);
1771 __ j(not_equal, &return_left, Label::kNear); // left == right != 0. 1799 __ j(not_equal, &return_left, Label::kNear); // left == right != 0.
1772 // At this point, both left and right are either 0 or -0. 1800 // At this point, both left and right are either 0 or -0.
1773 if (operation == HMathMinMax::kMathMin) { 1801 if (operation == HMathMinMax::kMathMin) {
1774 __ orpd(left_reg, right_reg); 1802 __ orps(left_reg, right_reg);
1775 } else { 1803 } else {
1776 // Since we operate on +0 and/or -0, addsd and andsd have the same effect. 1804 // Since we operate on +0 and/or -0, addsd and andsd have the same effect.
1777 __ addsd(left_reg, right_reg); 1805 __ addsd(left_reg, right_reg);
1778 } 1806 }
1779 __ jmp(&return_left, Label::kNear); 1807 __ jmp(&return_left, Label::kNear);
1780 1808
1781 __ bind(&check_nan_left); 1809 __ bind(&check_nan_left);
1782 __ ucomisd(left_reg, left_reg); // NaN check. 1810 __ ucomisd(left_reg, left_reg); // NaN check.
1783 __ j(parity_even, &return_left, Label::kNear); 1811 __ j(parity_even, &return_left, Label::kNear);
1784 __ bind(&return_right); 1812 __ bind(&return_right);
1785 __ movsd(left_reg, right_reg); 1813 __ movaps(left_reg, right_reg);
1786 1814
1787 __ bind(&return_left); 1815 __ bind(&return_left);
1788 } 1816 }
1789 } 1817 }
1790 1818
1791 1819
1792 void LCodeGen::DoArithmeticD(LArithmeticD* instr) { 1820 void LCodeGen::DoArithmeticD(LArithmeticD* instr) {
1793 XMMRegister left = ToDoubleRegister(instr->left()); 1821 XMMRegister left = ToDoubleRegister(instr->left());
1794 XMMRegister right = ToDoubleRegister(instr->right()); 1822 XMMRegister right = ToDoubleRegister(instr->right());
1795 XMMRegister result = ToDoubleRegister(instr->result()); 1823 XMMRegister result = ToDoubleRegister(instr->result());
(...skipping 3675 matching lines...) Expand 10 before | Expand all | Expand 10 after
5471 FixedArray::kHeaderSize - kPointerSize)); 5499 FixedArray::kHeaderSize - kPointerSize));
5472 __ bind(&done); 5500 __ bind(&done);
5473 } 5501 }
5474 5502
5475 5503
5476 #undef __ 5504 #undef __
5477 5505
5478 } } // namespace v8::internal 5506 } } // namespace v8::internal
5479 5507
5480 #endif // V8_TARGET_ARCH_X64 5508 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/x64/lithium-codegen-x64.h ('k') | src/x64/lithium-gap-resolver-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698