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

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

Issue 132373011: A64: Synchronize with r17635. (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/mips/lithium-codegen-mips.h ('k') | src/mips/lithium-mips.h » ('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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 720 matching lines...) Expand 10 before | Expand all | Expand 10 after
731 ASSERT(environment->HasBeenRegistered()); 731 ASSERT(environment->HasBeenRegistered());
732 int id = environment->deoptimization_index(); 732 int id = environment->deoptimization_index();
733 ASSERT(info()->IsOptimizing() || info()->IsStub()); 733 ASSERT(info()->IsOptimizing() || info()->IsStub());
734 Address entry = 734 Address entry =
735 Deoptimizer::GetDeoptimizationEntry(isolate(), id, bailout_type); 735 Deoptimizer::GetDeoptimizationEntry(isolate(), id, bailout_type);
736 if (entry == NULL) { 736 if (entry == NULL) {
737 Abort(kBailoutWasNotPrepared); 737 Abort(kBailoutWasNotPrepared);
738 return; 738 return;
739 } 739 }
740 740
741 ASSERT(FLAG_deopt_every_n_times < 2); // Other values not supported on MIPS. 741 if (FLAG_deopt_every_n_times != 0 && !info()->IsStub()) {
742 if (FLAG_deopt_every_n_times == 1 && 742 Register scratch = scratch0();
743 !info()->IsStub() && 743 ExternalReference count = ExternalReference::stress_deopt_count(isolate());
744 info()->opt_count() == id) { 744 Label no_deopt;
745 ASSERT(frame_is_built_); 745 __ Push(a1, scratch);
746 __ li(scratch, Operand(count));
747 __ lw(a1, MemOperand(scratch));
748 __ Subu(a1, a1, Operand(1));
749 __ Branch(&no_deopt, ne, a1, Operand(zero_reg));
750 __ li(a1, Operand(FLAG_deopt_every_n_times));
751 __ sw(a1, MemOperand(scratch));
752 __ Pop(a1, scratch);
753
746 __ Call(entry, RelocInfo::RUNTIME_ENTRY); 754 __ Call(entry, RelocInfo::RUNTIME_ENTRY);
747 return; 755 __ bind(&no_deopt);
756 __ sw(a1, MemOperand(scratch));
757 __ Pop(a1, scratch);
748 } 758 }
749 759
750 if (info()->ShouldTrapOnDeopt()) { 760 if (info()->ShouldTrapOnDeopt()) {
751 Label skip; 761 Label skip;
752 if (condition != al) { 762 if (condition != al) {
753 __ Branch(&skip, NegateCondition(condition), src1, src2); 763 __ Branch(&skip, NegateCondition(condition), src1, src2);
754 } 764 }
755 __ stop("trap_on_deopt"); 765 __ stop("trap_on_deopt");
756 __ bind(&skip); 766 __ bind(&skip);
757 } 767 }
(...skipping 966 matching lines...) Expand 10 before | Expand all | Expand 10 after
1724 } 1734 }
1725 __ bind(&runtime); 1735 __ bind(&runtime);
1726 __ PrepareCallCFunction(2, scratch); 1736 __ PrepareCallCFunction(2, scratch);
1727 __ li(a1, Operand(index)); 1737 __ li(a1, Operand(index));
1728 __ CallCFunction(ExternalReference::get_date_field_function(isolate()), 2); 1738 __ CallCFunction(ExternalReference::get_date_field_function(isolate()), 2);
1729 __ bind(&done); 1739 __ bind(&done);
1730 } 1740 }
1731 } 1741 }
1732 1742
1733 1743
1744 MemOperand LCodeGen::BuildSeqStringOperand(Register string,
1745 LOperand* index,
1746 String::Encoding encoding) {
1747 if (index->IsConstantOperand()) {
1748 int offset = ToInteger32(LConstantOperand::cast(index));
1749 if (encoding == String::TWO_BYTE_ENCODING) {
1750 offset *= kUC16Size;
1751 }
1752 STATIC_ASSERT(kCharSize == 1);
1753 return FieldMemOperand(string, SeqString::kHeaderSize + offset);
1754 }
1755 Register scratch = scratch0();
1756 ASSERT(!scratch.is(string));
1757 ASSERT(!scratch.is(ToRegister(index)));
1758 if (encoding == String::ONE_BYTE_ENCODING) {
1759 __ Addu(scratch, string, ToRegister(index));
1760 } else {
1761 STATIC_ASSERT(kUC16Size == 2);
1762 __ sll(scratch, ToRegister(index), 1);
1763 __ Addu(scratch, string, scratch);
1764 }
1765 return FieldMemOperand(scratch, SeqString::kHeaderSize);
1766 }
1767
1768
1769 void LCodeGen::DoSeqStringGetChar(LSeqStringGetChar* instr) {
1770 String::Encoding encoding = instr->hydrogen()->encoding();
1771 Register string = ToRegister(instr->string());
1772 Register result = ToRegister(instr->result());
1773
1774 if (FLAG_debug_code) {
1775 Register scratch = scratch0();
1776 __ lw(scratch, FieldMemOperand(string, HeapObject::kMapOffset));
1777 __ lbu(scratch, FieldMemOperand(scratch, Map::kInstanceTypeOffset));
1778
1779 __ And(scratch, scratch,
1780 Operand(kStringRepresentationMask | kStringEncodingMask));
1781 static const uint32_t one_byte_seq_type = kSeqStringTag | kOneByteStringTag;
1782 static const uint32_t two_byte_seq_type = kSeqStringTag | kTwoByteStringTag;
1783 __ Subu(at, scratch, Operand(encoding == String::ONE_BYTE_ENCODING
1784 ? one_byte_seq_type : two_byte_seq_type));
1785 __ Check(eq, kUnexpectedStringType, at, Operand(zero_reg));
1786 }
1787
1788 MemOperand operand = BuildSeqStringOperand(string, instr->index(), encoding);
1789 if (encoding == String::ONE_BYTE_ENCODING) {
1790 __ lbu(result, operand);
1791 } else {
1792 __ lhu(result, operand);
1793 }
1794 }
1795
1796
1734 void LCodeGen::DoSeqStringSetChar(LSeqStringSetChar* instr) { 1797 void LCodeGen::DoSeqStringSetChar(LSeqStringSetChar* instr) {
1798 String::Encoding encoding = instr->hydrogen()->encoding();
1735 Register string = ToRegister(instr->string()); 1799 Register string = ToRegister(instr->string());
1736 LOperand* index_op = instr->index();
1737 Register value = ToRegister(instr->value()); 1800 Register value = ToRegister(instr->value());
1738 Register scratch = scratch0();
1739 String::Encoding encoding = instr->encoding();
1740 1801
1741 if (FLAG_debug_code) { 1802 if (FLAG_debug_code) {
1803 Register scratch = scratch0();
1742 __ lw(scratch, FieldMemOperand(string, HeapObject::kMapOffset)); 1804 __ lw(scratch, FieldMemOperand(string, HeapObject::kMapOffset));
1743 __ lbu(scratch, FieldMemOperand(scratch, Map::kInstanceTypeOffset)); 1805 __ lbu(scratch, FieldMemOperand(scratch, Map::kInstanceTypeOffset));
1744 1806
1745 __ And(scratch, scratch, 1807 __ And(scratch, scratch,
1746 Operand(kStringRepresentationMask | kStringEncodingMask)); 1808 Operand(kStringRepresentationMask | kStringEncodingMask));
1747 static const uint32_t one_byte_seq_type = kSeqStringTag | kOneByteStringTag; 1809 static const uint32_t one_byte_seq_type = kSeqStringTag | kOneByteStringTag;
1748 static const uint32_t two_byte_seq_type = kSeqStringTag | kTwoByteStringTag; 1810 static const uint32_t two_byte_seq_type = kSeqStringTag | kTwoByteStringTag;
1749 __ Subu(at, scratch, Operand(encoding == String::ONE_BYTE_ENCODING 1811 __ Subu(at, scratch, Operand(encoding == String::ONE_BYTE_ENCODING
1750 ? one_byte_seq_type : two_byte_seq_type)); 1812 ? one_byte_seq_type : two_byte_seq_type));
1751 __ Check(eq, kUnexpectedStringType, at, Operand(zero_reg)); 1813 __ Check(eq, kUnexpectedStringType, at, Operand(zero_reg));
1752 } 1814 }
1753 1815
1754 if (index_op->IsConstantOperand()) { 1816 MemOperand operand = BuildSeqStringOperand(string, instr->index(), encoding);
1755 int constant_index = ToInteger32(LConstantOperand::cast(index_op)); 1817 if (encoding == String::ONE_BYTE_ENCODING) {
1756 if (encoding == String::ONE_BYTE_ENCODING) { 1818 __ sb(value, operand);
1757 __ sb(value,
1758 FieldMemOperand(string, SeqString::kHeaderSize + constant_index));
1759 } else {
1760 __ sh(value,
1761 FieldMemOperand(string, SeqString::kHeaderSize + constant_index * 2));
1762 }
1763 } else { 1819 } else {
1764 Register index = ToRegister(index_op); 1820 __ sh(value, operand);
1765 if (encoding == String::ONE_BYTE_ENCODING) {
1766 __ Addu(scratch, string, Operand(index));
1767 __ sb(value, FieldMemOperand(scratch, SeqString::kHeaderSize));
1768 } else {
1769 __ sll(scratch, index, 1);
1770 __ Addu(scratch, string, scratch);
1771 __ sh(value, FieldMemOperand(scratch, SeqString::kHeaderSize));
1772 }
1773 } 1821 }
1774 } 1822 }
1775 1823
1776 1824
1777 void LCodeGen::DoThrow(LThrow* instr) { 1825 void LCodeGen::DoThrow(LThrow* instr) {
1778 Register input_reg = EmitLoadRegister(instr->value(), at); 1826 Register input_reg = EmitLoadRegister(instr->value(), at);
1779 __ push(input_reg); 1827 __ push(input_reg);
1780 ASSERT(ToRegister(instr->context()).is(cp)); 1828 ASSERT(ToRegister(instr->context()).is(cp));
1781 CallRuntime(Runtime::kThrow, 1, instr); 1829 CallRuntime(Runtime::kThrow, 1, instr);
1782 1830
(...skipping 1083 matching lines...) Expand 10 before | Expand all | Expand 10 after
2866 2914
2867 2915
2868 void LCodeGen::DoLoadNamedField(LLoadNamedField* instr) { 2916 void LCodeGen::DoLoadNamedField(LLoadNamedField* instr) {
2869 HObjectAccess access = instr->hydrogen()->access(); 2917 HObjectAccess access = instr->hydrogen()->access();
2870 int offset = access.offset(); 2918 int offset = access.offset();
2871 Register object = ToRegister(instr->object()); 2919 Register object = ToRegister(instr->object());
2872 2920
2873 if (access.IsExternalMemory()) { 2921 if (access.IsExternalMemory()) {
2874 Register result = ToRegister(instr->result()); 2922 Register result = ToRegister(instr->result());
2875 MemOperand operand = MemOperand(object, offset); 2923 MemOperand operand = MemOperand(object, offset);
2876 if (access.representation().IsByte()) { 2924 __ Load(result, operand, access.representation());
2877 __ lb(result, operand);
2878 } else {
2879 __ lw(result, operand);
2880 }
2881 return; 2925 return;
2882 } 2926 }
2883 2927
2884 if (instr->hydrogen()->representation().IsDouble()) { 2928 if (instr->hydrogen()->representation().IsDouble()) {
2885 DoubleRegister result = ToDoubleRegister(instr->result()); 2929 DoubleRegister result = ToDoubleRegister(instr->result());
2886 __ ldc1(result, FieldMemOperand(object, offset)); 2930 __ ldc1(result, FieldMemOperand(object, offset));
2887 return; 2931 return;
2888 } 2932 }
2889 2933
2890 Register result = ToRegister(instr->result()); 2934 Register result = ToRegister(instr->result());
2891 if (!access.IsInobject()) { 2935 if (!access.IsInobject()) {
2892 __ lw(result, FieldMemOperand(object, JSObject::kPropertiesOffset)); 2936 __ lw(result, FieldMemOperand(object, JSObject::kPropertiesOffset));
2893 object = result; 2937 object = result;
2894 } 2938 }
2895 MemOperand operand = FieldMemOperand(object, offset); 2939 MemOperand operand = FieldMemOperand(object, offset);
2896 if (access.representation().IsByte()) { 2940 __ Load(result, operand, access.representation());
2897 __ lb(result, operand);
2898 } else {
2899 __ lw(result, operand);
2900 }
2901 } 2941 }
2902 2942
2903 2943
2904 void LCodeGen::DoLoadNamedGeneric(LLoadNamedGeneric* instr) { 2944 void LCodeGen::DoLoadNamedGeneric(LLoadNamedGeneric* instr) {
2905 ASSERT(ToRegister(instr->context()).is(cp)); 2945 ASSERT(ToRegister(instr->context()).is(cp));
2906 ASSERT(ToRegister(instr->object()).is(a0)); 2946 ASSERT(ToRegister(instr->object()).is(a0));
2907 ASSERT(ToRegister(instr->result()).is(v0)); 2947 ASSERT(ToRegister(instr->result()).is(v0));
2908 2948
2909 // Name is always in a2. 2949 // Name is always in a2.
2910 __ li(a2, Operand(instr->name())); 2950 __ li(a2, Operand(instr->name()));
(...skipping 1140 matching lines...) Expand 10 before | Expand all | Expand 10 after
4051 Representation representation = instr->representation(); 4091 Representation representation = instr->representation();
4052 4092
4053 Register object = ToRegister(instr->object()); 4093 Register object = ToRegister(instr->object());
4054 Register scratch = scratch0(); 4094 Register scratch = scratch0();
4055 HObjectAccess access = instr->hydrogen()->access(); 4095 HObjectAccess access = instr->hydrogen()->access();
4056 int offset = access.offset(); 4096 int offset = access.offset();
4057 4097
4058 if (access.IsExternalMemory()) { 4098 if (access.IsExternalMemory()) {
4059 Register value = ToRegister(instr->value()); 4099 Register value = ToRegister(instr->value());
4060 MemOperand operand = MemOperand(object, offset); 4100 MemOperand operand = MemOperand(object, offset);
4061 if (representation.IsByte()) { 4101 __ Store(value, operand, representation);
4062 __ sb(value, operand);
4063 } else {
4064 __ sw(value, operand);
4065 }
4066 return; 4102 return;
4067 } 4103 }
4068 4104
4069 Handle<Map> transition = instr->transition(); 4105 Handle<Map> transition = instr->transition();
4070 4106
4071 if (FLAG_track_heap_object_fields && representation.IsHeapObject()) { 4107 if (FLAG_track_heap_object_fields && representation.IsHeapObject()) {
4072 Register value = ToRegister(instr->value()); 4108 Register value = ToRegister(instr->value());
4073 if (!instr->hydrogen()->value()->type().IsHeapObject()) { 4109 if (!instr->hydrogen()->value()->type().IsHeapObject()) {
4074 __ And(scratch, value, Operand(kSmiTagMask)); 4110 __ And(scratch, value, Operand(kSmiTagMask));
4075 DeoptimizeIf(eq, instr->environment(), scratch, Operand(zero_reg)); 4111 DeoptimizeIf(eq, instr->environment(), scratch, Operand(zero_reg));
(...skipping 25 matching lines...) Expand all
4101 } 4137 }
4102 4138
4103 // Do the store. 4139 // Do the store.
4104 Register value = ToRegister(instr->value()); 4140 Register value = ToRegister(instr->value());
4105 ASSERT(!object.is(value)); 4141 ASSERT(!object.is(value));
4106 SmiCheck check_needed = 4142 SmiCheck check_needed =
4107 instr->hydrogen()->value()->IsHeapObject() 4143 instr->hydrogen()->value()->IsHeapObject()
4108 ? OMIT_SMI_CHECK : INLINE_SMI_CHECK; 4144 ? OMIT_SMI_CHECK : INLINE_SMI_CHECK;
4109 if (access.IsInobject()) { 4145 if (access.IsInobject()) {
4110 MemOperand operand = FieldMemOperand(object, offset); 4146 MemOperand operand = FieldMemOperand(object, offset);
4111 if (representation.IsByte()) { 4147 __ Store(value, operand, representation);
4112 __ sb(value, operand);
4113 } else {
4114 __ sw(value, operand);
4115 }
4116 if (instr->hydrogen()->NeedsWriteBarrier()) { 4148 if (instr->hydrogen()->NeedsWriteBarrier()) {
4117 // Update the write barrier for the object for in-object properties. 4149 // Update the write barrier for the object for in-object properties.
4118 __ RecordWriteField(object, 4150 __ RecordWriteField(object,
4119 offset, 4151 offset,
4120 value, 4152 value,
4121 scratch, 4153 scratch,
4122 GetRAState(), 4154 GetRAState(),
4123 kSaveFPRegs, 4155 kSaveFPRegs,
4124 EMIT_REMEMBERED_SET, 4156 EMIT_REMEMBERED_SET,
4125 check_needed); 4157 check_needed);
4126 } 4158 }
4127 } else { 4159 } else {
4128 __ lw(scratch, FieldMemOperand(object, JSObject::kPropertiesOffset)); 4160 __ lw(scratch, FieldMemOperand(object, JSObject::kPropertiesOffset));
4129 MemOperand operand = FieldMemOperand(scratch, offset); 4161 MemOperand operand = FieldMemOperand(scratch, offset);
4130 if (representation.IsByte()) { 4162 __ Store(value, operand, representation);
4131 __ sb(value, operand);
4132 } else {
4133 __ sw(value, operand);
4134 }
4135 if (instr->hydrogen()->NeedsWriteBarrier()) { 4163 if (instr->hydrogen()->NeedsWriteBarrier()) {
4136 // Update the write barrier for the properties array. 4164 // Update the write barrier for the properties array.
4137 // object is used as a scratch register. 4165 // object is used as a scratch register.
4138 __ RecordWriteField(scratch, 4166 __ RecordWriteField(scratch,
4139 offset, 4167 offset,
4140 value, 4168 value,
4141 object, 4169 object,
4142 GetRAState(), 4170 GetRAState(),
4143 kSaveFPRegs, 4171 kSaveFPRegs,
4144 EMIT_REMEMBERED_SET, 4172 EMIT_REMEMBERED_SET,
(...skipping 1490 matching lines...) Expand 10 before | Expand all | Expand 10 after
5635 // the special case below. 5663 // the special case below.
5636 if (info()->IsStub() && type == Deoptimizer::EAGER) { 5664 if (info()->IsStub() && type == Deoptimizer::EAGER) {
5637 type = Deoptimizer::LAZY; 5665 type = Deoptimizer::LAZY;
5638 } 5666 }
5639 5667
5640 Comment(";;; deoptimize: %s", instr->hydrogen()->reason()); 5668 Comment(";;; deoptimize: %s", instr->hydrogen()->reason());
5641 DeoptimizeIf(al, instr->environment(), type, zero_reg, Operand(zero_reg)); 5669 DeoptimizeIf(al, instr->environment(), type, zero_reg, Operand(zero_reg));
5642 } 5670 }
5643 5671
5644 5672
5673 void LCodeGen::DoDummy(LDummy* instr) {
5674 // Nothing to see here, move on!
5675 }
5676
5677
5645 void LCodeGen::DoDummyUse(LDummyUse* instr) { 5678 void LCodeGen::DoDummyUse(LDummyUse* instr) {
5646 // Nothing to see here, move on! 5679 // Nothing to see here, move on!
5647 } 5680 }
5648 5681
5649 5682
5650 void LCodeGen::DoDeferredStackCheck(LStackCheck* instr) { 5683 void LCodeGen::DoDeferredStackCheck(LStackCheck* instr) {
5651 PushSafepointRegistersScope scope(this, Safepoint::kWithRegisters); 5684 PushSafepointRegistersScope scope(this, Safepoint::kWithRegisters);
5652 LoadContextFromDeferred(instr->context()); 5685 LoadContextFromDeferred(instr->context());
5653 __ CallRuntimeSaveDoubles(Runtime::kStackGuard); 5686 __ CallRuntimeSaveDoubles(Runtime::kStackGuard);
5654 RecordSafepointWithLazyDeopt( 5687 RecordSafepointWithLazyDeopt(
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
5813 __ Subu(scratch, result, scratch); 5846 __ Subu(scratch, result, scratch);
5814 __ lw(result, FieldMemOperand(scratch, 5847 __ lw(result, FieldMemOperand(scratch,
5815 FixedArray::kHeaderSize - kPointerSize)); 5848 FixedArray::kHeaderSize - kPointerSize));
5816 __ bind(&done); 5849 __ bind(&done);
5817 } 5850 }
5818 5851
5819 5852
5820 #undef __ 5853 #undef __
5821 5854
5822 } } // namespace v8::internal 5855 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/mips/lithium-codegen-mips.h ('k') | src/mips/lithium-mips.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698