| 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 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 __ BranchSignedLess(T2, Immediate(0), &fall_through); \ | 170 __ BranchSignedLess(T2, Immediate(0), &fall_through); \ |
| 171 __ SmiUntag(T2); \ | 171 __ SmiUntag(T2); \ |
| 172 /* Check for maximum allowed length. */ \ | 172 /* Check for maximum allowed length. */ \ |
| 173 /* T2: untagged array length. */ \ | 173 /* T2: untagged array length. */ \ |
| 174 __ BranchSignedGreater(T2, Immediate(max_len), &fall_through); \ | 174 __ BranchSignedGreater(T2, Immediate(max_len), &fall_through); \ |
| 175 __ sll(T2, T2, scale_shift); \ | 175 __ sll(T2, T2, scale_shift); \ |
| 176 const intptr_t fixed_size = sizeof(Raw##type_name) + kObjectAlignment - 1; \ | 176 const intptr_t fixed_size = sizeof(Raw##type_name) + kObjectAlignment - 1; \ |
| 177 __ AddImmediate(T2, fixed_size); \ | 177 __ AddImmediate(T2, fixed_size); \ |
| 178 __ LoadImmediate(TMP, -kObjectAlignment); \ | 178 __ LoadImmediate(TMP, -kObjectAlignment); \ |
| 179 __ and_(T2, T2, TMP); \ | 179 __ and_(T2, T2, TMP); \ |
| 180 Heap::Space space = Heap::SpaceForAllocation(cid); \ | 180 Heap::Space space = Heap::kNew; \ |
| 181 __ lw(T3, Address(THR, Thread::heap_offset())); \ | 181 __ lw(T3, Address(THR, Thread::heap_offset())); \ |
| 182 __ lw(V0, Address(T3, Heap::TopOffset(space))); \ | 182 __ lw(V0, Address(T3, Heap::TopOffset(space))); \ |
| 183 \ | 183 \ |
| 184 /* T2: allocation size. */ \ | 184 /* T2: allocation size. */ \ |
| 185 __ addu(T1, V0, T2); \ | 185 __ addu(T1, V0, T2); \ |
| 186 /* Branch on unsigned overflow. */ \ | 186 /* Branch on unsigned overflow. */ \ |
| 187 __ BranchUnsignedLess(T1, V0, &fall_through); \ | 187 __ BranchUnsignedLess(T1, V0, &fall_through); \ |
| 188 \ | 188 \ |
| 189 /* Check if the allocation fits into the remaining space. */ \ | 189 /* Check if the allocation fits into the remaining space. */ \ |
| 190 /* V0: potential new object start. */ \ | 190 /* V0: potential new object start. */ \ |
| (...skipping 1753 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1944 __ MaybeTraceAllocation(kOneByteStringCid, V0, failure); | 1944 __ MaybeTraceAllocation(kOneByteStringCid, V0, failure); |
| 1945 __ mov(T6, length_reg); // Save the length register. | 1945 __ mov(T6, length_reg); // Save the length register. |
| 1946 // TODO(koda): Protect against negative length and overflow here. | 1946 // TODO(koda): Protect against negative length and overflow here. |
| 1947 __ SmiUntag(length_reg); | 1947 __ SmiUntag(length_reg); |
| 1948 const intptr_t fixed_size = sizeof(RawString) + kObjectAlignment - 1; | 1948 const intptr_t fixed_size = sizeof(RawString) + kObjectAlignment - 1; |
| 1949 __ AddImmediate(length_reg, fixed_size); | 1949 __ AddImmediate(length_reg, fixed_size); |
| 1950 __ LoadImmediate(TMP, ~(kObjectAlignment - 1)); | 1950 __ LoadImmediate(TMP, ~(kObjectAlignment - 1)); |
| 1951 __ and_(length_reg, length_reg, TMP); | 1951 __ and_(length_reg, length_reg, TMP); |
| 1952 | 1952 |
| 1953 const intptr_t cid = kOneByteStringCid; | 1953 const intptr_t cid = kOneByteStringCid; |
| 1954 Heap::Space space = Heap::SpaceForAllocation(cid); | 1954 Heap::Space space = Heap::kNew; |
| 1955 __ lw(T3, Address(THR, Thread::heap_offset())); | 1955 __ lw(T3, Address(THR, Thread::heap_offset())); |
| 1956 __ lw(V0, Address(T3, Heap::TopOffset(space))); | 1956 __ lw(V0, Address(T3, Heap::TopOffset(space))); |
| 1957 | 1957 |
| 1958 // length_reg: allocation size. | 1958 // length_reg: allocation size. |
| 1959 __ addu(T1, V0, length_reg); | 1959 __ addu(T1, V0, length_reg); |
| 1960 __ BranchUnsignedLess(T1, V0, failure); // Fail on unsigned overflow. | 1960 __ BranchUnsignedLess(T1, V0, failure); // Fail on unsigned overflow. |
| 1961 | 1961 |
| 1962 // Check if the allocation fits into the remaining space. | 1962 // Check if the allocation fits into the remaining space. |
| 1963 // V0: potential new object start. | 1963 // V0: potential new object start. |
| 1964 // T1: potential next object start. | 1964 // T1: potential next object start. |
| (...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2232 __ lw(T0, Address(V0, TimelineStream::enabled_offset())); | 2232 __ lw(T0, Address(V0, TimelineStream::enabled_offset())); |
| 2233 __ LoadObject(V0, Bool::True()); | 2233 __ LoadObject(V0, Bool::True()); |
| 2234 __ LoadObject(V1, Bool::False()); | 2234 __ LoadObject(V1, Bool::False()); |
| 2235 __ Ret(); | 2235 __ Ret(); |
| 2236 __ delay_slot()->movz(V0, V1, T0); // V0 = (T0 == 0) ? V1 : V0. | 2236 __ delay_slot()->movz(V0, V1, T0); // V0 = (T0 == 0) ? V1 : V0. |
| 2237 } | 2237 } |
| 2238 | 2238 |
| 2239 } // namespace dart | 2239 } // namespace dart |
| 2240 | 2240 |
| 2241 #endif // defined TARGET_ARCH_MIPS | 2241 #endif // defined TARGET_ARCH_MIPS |
| OLD | NEW |