OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_MIPS. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_MIPS. |
6 #if defined(TARGET_ARCH_MIPS) | 6 #if defined(TARGET_ARCH_MIPS) |
7 | 7 |
8 #include "vm/intrinsifier.h" | 8 #include "vm/intrinsifier.h" |
9 | 9 |
10 #include "vm/assembler.h" | 10 #include "vm/assembler.h" |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 /* Check that length is a positive Smi. */ \ | 160 /* Check that length is a positive Smi. */ \ |
161 /* T2: requested array length argument. */ \ | 161 /* T2: requested array length argument. */ \ |
162 __ andi(CMPRES1, T2, Immediate(kSmiTagMask)); \ | 162 __ andi(CMPRES1, T2, Immediate(kSmiTagMask)); \ |
163 __ bne(CMPRES1, ZR, &fall_through); \ | 163 __ bne(CMPRES1, ZR, &fall_through); \ |
164 __ BranchSignedLess(T2, Immediate(0), &fall_through); \ | 164 __ BranchSignedLess(T2, Immediate(0), &fall_through); \ |
165 __ SmiUntag(T2); \ | 165 __ SmiUntag(T2); \ |
166 /* Check for maximum allowed length. */ \ | 166 /* Check for maximum allowed length. */ \ |
167 /* T2: untagged array length. */ \ | 167 /* T2: untagged array length. */ \ |
168 __ BranchSignedGreater(T2, Immediate(max_len), &fall_through); \ | 168 __ BranchSignedGreater(T2, Immediate(max_len), &fall_through); \ |
169 __ sll(T2, T2, scale_shift); \ | 169 __ sll(T2, T2, scale_shift); \ |
170 const intptr_t fixed_size = sizeof(Raw##type_name) + kObjectAlignment - 1; \ | 170 const intptr_t fixed_size_plus_alignment_padding = \ |
171 __ AddImmediate(T2, fixed_size); \ | 171 sizeof(Raw##type_name) + kObjectAlignment - 1; \ |
| 172 __ AddImmediate(T2, fixed_size_plus_alignment_padding); \ |
172 __ LoadImmediate(TMP, -kObjectAlignment); \ | 173 __ LoadImmediate(TMP, -kObjectAlignment); \ |
173 __ and_(T2, T2, TMP); \ | 174 __ and_(T2, T2, TMP); \ |
174 Heap::Space space = Heap::kNew; \ | 175 Heap::Space space = Heap::kNew; \ |
175 __ lw(T3, Address(THR, Thread::heap_offset())); \ | 176 __ lw(T3, Address(THR, Thread::heap_offset())); \ |
176 __ lw(V0, Address(T3, Heap::TopOffset(space))); \ | 177 __ lw(V0, Address(T3, Heap::TopOffset(space))); \ |
177 \ | 178 \ |
178 /* T2: allocation size. */ \ | 179 /* T2: allocation size. */ \ |
179 __ addu(T1, V0, T2); \ | 180 __ addu(T1, V0, T2); \ |
180 /* Branch on unsigned overflow. */ \ | 181 /* Branch on unsigned overflow. */ \ |
181 __ BranchUnsignedLess(T1, V0, &fall_through); \ | 182 __ BranchUnsignedLess(T1, V0, &fall_through); \ |
(...skipping 1942 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2124 // 'length-reg' (T2) contains tagged length. | 2125 // 'length-reg' (T2) contains tagged length. |
2125 // Returns new string as tagged pointer in V0. | 2126 // Returns new string as tagged pointer in V0. |
2126 static void TryAllocateOnebyteString(Assembler* assembler, | 2127 static void TryAllocateOnebyteString(Assembler* assembler, |
2127 Label* ok, | 2128 Label* ok, |
2128 Label* failure) { | 2129 Label* failure) { |
2129 const Register length_reg = T2; | 2130 const Register length_reg = T2; |
2130 NOT_IN_PRODUCT(__ MaybeTraceAllocation(kOneByteStringCid, V0, failure)); | 2131 NOT_IN_PRODUCT(__ MaybeTraceAllocation(kOneByteStringCid, V0, failure)); |
2131 __ mov(T6, length_reg); // Save the length register. | 2132 __ mov(T6, length_reg); // Save the length register. |
2132 // TODO(koda): Protect against negative length and overflow here. | 2133 // TODO(koda): Protect against negative length and overflow here. |
2133 __ SmiUntag(length_reg); | 2134 __ SmiUntag(length_reg); |
2134 const intptr_t fixed_size = sizeof(RawString) + kObjectAlignment - 1; | 2135 const intptr_t fixed_size_plus_alignment_padding = |
2135 __ AddImmediate(length_reg, fixed_size); | 2136 sizeof(RawString) + kObjectAlignment - 1; |
| 2137 __ AddImmediate(length_reg, fixed_size_plus_alignment_padding); |
2136 __ LoadImmediate(TMP, ~(kObjectAlignment - 1)); | 2138 __ LoadImmediate(TMP, ~(kObjectAlignment - 1)); |
2137 __ and_(length_reg, length_reg, TMP); | 2139 __ and_(length_reg, length_reg, TMP); |
2138 | 2140 |
2139 const intptr_t cid = kOneByteStringCid; | 2141 const intptr_t cid = kOneByteStringCid; |
2140 Heap::Space space = Heap::kNew; | 2142 Heap::Space space = Heap::kNew; |
2141 __ lw(T3, Address(THR, Thread::heap_offset())); | 2143 __ lw(T3, Address(THR, Thread::heap_offset())); |
2142 __ lw(V0, Address(T3, Heap::TopOffset(space))); | 2144 __ lw(V0, Address(T3, Heap::TopOffset(space))); |
2143 | 2145 |
2144 // length_reg: allocation size. | 2146 // length_reg: allocation size. |
2145 __ addu(T1, V0, length_reg); | 2147 __ addu(T1, V0, length_reg); |
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2433 | 2435 |
2434 void Intrinsifier::SetAsyncThreadStackTrace(Assembler* assembler) { | 2436 void Intrinsifier::SetAsyncThreadStackTrace(Assembler* assembler) { |
2435 __ lw(V0, Address(THR, Thread::async_stack_trace_offset())); | 2437 __ lw(V0, Address(THR, Thread::async_stack_trace_offset())); |
2436 __ LoadObject(V0, Object::null_object()); | 2438 __ LoadObject(V0, Object::null_object()); |
2437 __ Ret(); | 2439 __ Ret(); |
2438 } | 2440 } |
2439 | 2441 |
2440 } // namespace dart | 2442 } // namespace dart |
2441 | 2443 |
2442 #endif // defined TARGET_ARCH_MIPS | 2444 #endif // defined TARGET_ARCH_MIPS |
OLD | NEW |