OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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/mips/codegen-mips.h" | 5 #include "src/mips/codegen-mips.h" |
6 | 6 |
7 #if V8_TARGET_ARCH_MIPS | 7 #if V8_TARGET_ARCH_MIPS |
8 | 8 |
9 #include "src/codegen.h" | 9 #include "src/codegen.h" |
10 #include "src/macro-assembler.h" | 10 #include "src/macro-assembler.h" |
(...skipping 749 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
760 kRAHasBeenSaved, | 760 kRAHasBeenSaved, |
761 kDontSaveFPRegs, | 761 kDontSaveFPRegs, |
762 EMIT_REMEMBERED_SET, | 762 EMIT_REMEMBERED_SET, |
763 OMIT_SMI_CHECK); | 763 OMIT_SMI_CHECK); |
764 | 764 |
765 | 765 |
766 // Prepare for conversion loop. | 766 // Prepare for conversion loop. |
767 __ Addu(scratch1, elements, | 767 __ Addu(scratch1, elements, |
768 Operand(FixedArray::kHeaderSize - kHeapObjectTag)); | 768 Operand(FixedArray::kHeaderSize - kHeapObjectTag)); |
769 __ Addu(scratch3, array, Operand(FixedDoubleArray::kHeaderSize)); | 769 __ Addu(scratch3, array, Operand(FixedDoubleArray::kHeaderSize)); |
770 __ sll(at, length, 2); | 770 __ Lsa(array_end, scratch3, length, 2); |
771 __ Addu(array_end, scratch3, at); | |
772 | 771 |
773 // Repurpose registers no longer in use. | 772 // Repurpose registers no longer in use. |
774 Register hole_lower = elements; | 773 Register hole_lower = elements; |
775 Register hole_upper = length; | 774 Register hole_upper = length; |
776 __ li(hole_lower, Operand(kHoleNanLower32)); | 775 __ li(hole_lower, Operand(kHoleNanLower32)); |
777 __ li(hole_upper, Operand(kHoleNanUpper32)); | 776 __ li(hole_upper, Operand(kHoleNanUpper32)); |
778 | 777 |
779 // scratch1: begin of source FixedArray element fields, not tagged | 778 // scratch1: begin of source FixedArray element fields, not tagged |
780 // hole_lower: kHoleNanLower32 | 779 // hole_lower: kHoleNanLower32 |
781 // hole_upper: kHoleNanUpper32 | 780 // hole_upper: kHoleNanUpper32 |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
892 | 891 |
893 // Prepare for conversion loop. | 892 // Prepare for conversion loop. |
894 Register src_elements = elements; | 893 Register src_elements = elements; |
895 Register dst_elements = target_map; | 894 Register dst_elements = target_map; |
896 Register dst_end = length; | 895 Register dst_end = length; |
897 Register heap_number_map = scratch; | 896 Register heap_number_map = scratch; |
898 __ Addu(src_elements, src_elements, Operand( | 897 __ Addu(src_elements, src_elements, Operand( |
899 FixedDoubleArray::kHeaderSize - kHeapObjectTag | 898 FixedDoubleArray::kHeaderSize - kHeapObjectTag |
900 + Register::kExponentOffset)); | 899 + Register::kExponentOffset)); |
901 __ Addu(dst_elements, array, Operand(FixedArray::kHeaderSize)); | 900 __ Addu(dst_elements, array, Operand(FixedArray::kHeaderSize)); |
902 __ sll(dst_end, dst_end, 1); | 901 __ Lsa(dst_end, dst_elements, dst_end, 1); |
903 __ Addu(dst_end, dst_elements, dst_end); | |
904 | 902 |
905 // Allocating heap numbers in the loop below can fail and cause a jump to | 903 // Allocating heap numbers in the loop below can fail and cause a jump to |
906 // gc_required. We can't leave a partly initialized FixedArray behind, | 904 // gc_required. We can't leave a partly initialized FixedArray behind, |
907 // so pessimistically fill it with holes now. | 905 // so pessimistically fill it with holes now. |
908 Label initialization_loop, initialization_loop_entry; | 906 Label initialization_loop, initialization_loop_entry; |
909 __ LoadRoot(scratch, Heap::kTheHoleValueRootIndex); | 907 __ LoadRoot(scratch, Heap::kTheHoleValueRootIndex); |
910 __ Branch(&initialization_loop_entry); | 908 __ Branch(&initialization_loop_entry); |
911 __ bind(&initialization_loop); | 909 __ bind(&initialization_loop); |
912 __ sw(scratch, MemOperand(dst_elements)); | 910 __ sw(scratch, MemOperand(dst_elements)); |
913 __ Addu(dst_elements, dst_elements, Operand(kPointerSize)); | 911 __ Addu(dst_elements, dst_elements, Operand(kPointerSize)); |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1075 __ And(at, result, Operand(kShortExternalStringMask)); | 1073 __ And(at, result, Operand(kShortExternalStringMask)); |
1076 __ Branch(call_runtime, ne, at, Operand(zero_reg)); | 1074 __ Branch(call_runtime, ne, at, Operand(zero_reg)); |
1077 __ lw(string, FieldMemOperand(string, ExternalString::kResourceDataOffset)); | 1075 __ lw(string, FieldMemOperand(string, ExternalString::kResourceDataOffset)); |
1078 | 1076 |
1079 Label one_byte, done; | 1077 Label one_byte, done; |
1080 __ bind(&check_encoding); | 1078 __ bind(&check_encoding); |
1081 STATIC_ASSERT(kTwoByteStringTag == 0); | 1079 STATIC_ASSERT(kTwoByteStringTag == 0); |
1082 __ And(at, result, Operand(kStringEncodingMask)); | 1080 __ And(at, result, Operand(kStringEncodingMask)); |
1083 __ Branch(&one_byte, ne, at, Operand(zero_reg)); | 1081 __ Branch(&one_byte, ne, at, Operand(zero_reg)); |
1084 // Two-byte string. | 1082 // Two-byte string. |
1085 __ sll(at, index, 1); | 1083 __ Lsa(at, string, index, 1); |
1086 __ Addu(at, string, at); | |
1087 __ lhu(result, MemOperand(at)); | 1084 __ lhu(result, MemOperand(at)); |
1088 __ jmp(&done); | 1085 __ jmp(&done); |
1089 __ bind(&one_byte); | 1086 __ bind(&one_byte); |
1090 // One_byte string. | 1087 // One_byte string. |
1091 __ Addu(at, string, index); | 1088 __ Addu(at, string, index); |
1092 __ lbu(result, MemOperand(at)); | 1089 __ lbu(result, MemOperand(at)); |
1093 __ bind(&done); | 1090 __ bind(&done); |
1094 } | 1091 } |
1095 | 1092 |
1096 | 1093 |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1149 DCHECK(*reinterpret_cast<double*> | 1146 DCHECK(*reinterpret_cast<double*> |
1150 (ExternalReference::math_exp_constants(8).address()) == 1); | 1147 (ExternalReference::math_exp_constants(8).address()) == 1); |
1151 __ Move(double_scratch2, 1.); | 1148 __ Move(double_scratch2, 1.); |
1152 __ add_d(result, result, double_scratch2); | 1149 __ add_d(result, result, double_scratch2); |
1153 __ srl(temp1, temp2, 11); | 1150 __ srl(temp1, temp2, 11); |
1154 __ Ext(temp2, temp2, 0, 11); | 1151 __ Ext(temp2, temp2, 0, 11); |
1155 __ Addu(temp1, temp1, Operand(0x3ff)); | 1152 __ Addu(temp1, temp1, Operand(0x3ff)); |
1156 | 1153 |
1157 // Must not call ExpConstant() after overwriting temp3! | 1154 // Must not call ExpConstant() after overwriting temp3! |
1158 __ li(temp3, Operand(ExternalReference::math_exp_log_table())); | 1155 __ li(temp3, Operand(ExternalReference::math_exp_log_table())); |
1159 __ sll(at, temp2, 3); | 1156 __ Lsa(temp3, temp3, temp2, 3); |
1160 __ Addu(temp3, temp3, Operand(at)); | |
1161 __ lw(temp2, MemOperand(temp3, Register::kMantissaOffset)); | 1157 __ lw(temp2, MemOperand(temp3, Register::kMantissaOffset)); |
1162 __ lw(temp3, MemOperand(temp3, Register::kExponentOffset)); | 1158 __ lw(temp3, MemOperand(temp3, Register::kExponentOffset)); |
1163 // The first word is loaded is the lower number register. | 1159 // The first word is loaded is the lower number register. |
1164 if (temp2.code() < temp3.code()) { | 1160 if (temp2.code() < temp3.code()) { |
1165 __ sll(at, temp1, 20); | 1161 __ sll(at, temp1, 20); |
1166 __ Or(temp1, temp3, at); | 1162 __ Or(temp1, temp3, at); |
1167 __ Move(double_scratch1, temp2, temp1); | 1163 __ Move(double_scratch1, temp2, temp1); |
1168 } else { | 1164 } else { |
1169 __ sll(at, temp1, 20); | 1165 __ sll(at, temp1, 20); |
1170 __ Or(temp1, temp2, at); | 1166 __ Or(temp1, temp2, at); |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1263 } | 1259 } |
1264 } | 1260 } |
1265 | 1261 |
1266 | 1262 |
1267 #undef __ | 1263 #undef __ |
1268 | 1264 |
1269 } // namespace internal | 1265 } // namespace internal |
1270 } // namespace v8 | 1266 } // namespace v8 |
1271 | 1267 |
1272 #endif // V8_TARGET_ARCH_MIPS | 1268 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |