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_plus_alignment_padding = \ | 170 const intptr_t fixed_size = sizeof(Raw##type_name) + kObjectAlignment - 1; \ |
171 sizeof(Raw##type_name) + kObjectAlignment - 1; \ | 171 __ AddImmediate(T2, fixed_size); \ |
172 __ AddImmediate(T2, fixed_size_plus_alignment_padding); \ | |
173 __ LoadImmediate(TMP, -kObjectAlignment); \ | 172 __ LoadImmediate(TMP, -kObjectAlignment); \ |
174 __ and_(T2, T2, TMP); \ | 173 __ and_(T2, T2, TMP); \ |
175 Heap::Space space = Heap::kNew; \ | 174 Heap::Space space = Heap::kNew; \ |
176 __ lw(T3, Address(THR, Thread::heap_offset())); \ | 175 __ lw(T3, Address(THR, Thread::heap_offset())); \ |
177 __ lw(V0, Address(T3, Heap::TopOffset(space))); \ | 176 __ lw(V0, Address(T3, Heap::TopOffset(space))); \ |
178 \ | 177 \ |
179 /* T2: allocation size. */ \ | 178 /* T2: allocation size. */ \ |
180 __ addu(T1, V0, T2); \ | 179 __ addu(T1, V0, T2); \ |
181 /* Branch on unsigned overflow. */ \ | 180 /* Branch on unsigned overflow. */ \ |
182 __ BranchUnsignedLess(T1, V0, &fall_through); \ | 181 __ BranchUnsignedLess(T1, V0, &fall_through); \ |
(...skipping 1942 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2125 // 'length-reg' (T2) contains tagged length. | 2124 // 'length-reg' (T2) contains tagged length. |
2126 // Returns new string as tagged pointer in V0. | 2125 // Returns new string as tagged pointer in V0. |
2127 static void TryAllocateOnebyteString(Assembler* assembler, | 2126 static void TryAllocateOnebyteString(Assembler* assembler, |
2128 Label* ok, | 2127 Label* ok, |
2129 Label* failure) { | 2128 Label* failure) { |
2130 const Register length_reg = T2; | 2129 const Register length_reg = T2; |
2131 NOT_IN_PRODUCT(__ MaybeTraceAllocation(kOneByteStringCid, V0, failure)); | 2130 NOT_IN_PRODUCT(__ MaybeTraceAllocation(kOneByteStringCid, V0, failure)); |
2132 __ mov(T6, length_reg); // Save the length register. | 2131 __ mov(T6, length_reg); // Save the length register. |
2133 // TODO(koda): Protect against negative length and overflow here. | 2132 // TODO(koda): Protect against negative length and overflow here. |
2134 __ SmiUntag(length_reg); | 2133 __ SmiUntag(length_reg); |
2135 const intptr_t fixed_size_plus_alignment_padding = | 2134 const intptr_t fixed_size = sizeof(RawString) + kObjectAlignment - 1; |
2136 sizeof(RawString) + kObjectAlignment - 1; | 2135 __ AddImmediate(length_reg, fixed_size); |
2137 __ AddImmediate(length_reg, fixed_size_plus_alignment_padding); | |
2138 __ LoadImmediate(TMP, ~(kObjectAlignment - 1)); | 2136 __ LoadImmediate(TMP, ~(kObjectAlignment - 1)); |
2139 __ and_(length_reg, length_reg, TMP); | 2137 __ and_(length_reg, length_reg, TMP); |
2140 | 2138 |
2141 const intptr_t cid = kOneByteStringCid; | 2139 const intptr_t cid = kOneByteStringCid; |
2142 Heap::Space space = Heap::kNew; | 2140 Heap::Space space = Heap::kNew; |
2143 __ lw(T3, Address(THR, Thread::heap_offset())); | 2141 __ lw(T3, Address(THR, Thread::heap_offset())); |
2144 __ lw(V0, Address(T3, Heap::TopOffset(space))); | 2142 __ lw(V0, Address(T3, Heap::TopOffset(space))); |
2145 | 2143 |
2146 // length_reg: allocation size. | 2144 // length_reg: allocation size. |
2147 __ addu(T1, V0, length_reg); | 2145 __ addu(T1, V0, length_reg); |
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2435 | 2433 |
2436 void Intrinsifier::SetAsyncThreadStackTrace(Assembler* assembler) { | 2434 void Intrinsifier::SetAsyncThreadStackTrace(Assembler* assembler) { |
2437 __ lw(V0, Address(THR, Thread::async_stack_trace_offset())); | 2435 __ lw(V0, Address(THR, Thread::async_stack_trace_offset())); |
2438 __ LoadObject(V0, Object::null_object()); | 2436 __ LoadObject(V0, Object::null_object()); |
2439 __ Ret(); | 2437 __ Ret(); |
2440 } | 2438 } |
2441 | 2439 |
2442 } // namespace dart | 2440 } // namespace dart |
2443 | 2441 |
2444 #endif // defined TARGET_ARCH_MIPS | 2442 #endif // defined TARGET_ARCH_MIPS |
OLD | NEW |