| 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 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 __ LoadObject(T7, Object::null_object()); | 154 __ LoadObject(T7, Object::null_object()); |
| 155 __ Ret(); | 155 __ Ret(); |
| 156 __ delay_slot()->mov(V0, T7); | 156 __ delay_slot()->mov(V0, T7); |
| 157 __ Bind(&fall_through); | 157 __ Bind(&fall_through); |
| 158 } | 158 } |
| 159 | 159 |
| 160 | 160 |
| 161 #define TYPED_ARRAY_ALLOCATION(type_name, cid, max_len, scale_shift) \ | 161 #define TYPED_ARRAY_ALLOCATION(type_name, cid, max_len, scale_shift) \ |
| 162 Label fall_through; \ | 162 Label fall_through; \ |
| 163 const intptr_t kArrayLengthStackOffset = 0 * kWordSize; \ | 163 const intptr_t kArrayLengthStackOffset = 0 * kWordSize; \ |
| 164 __ MaybeTraceAllocation(cid, T2, &fall_through); \ | 164 NOT_IN_PRODUCT(__ MaybeTraceAllocation(cid, T2, &fall_through)); \ |
| 165 __ lw(T2, Address(SP, kArrayLengthStackOffset)); /* Array length. */ \ | 165 __ lw(T2, Address(SP, kArrayLengthStackOffset)); /* Array length. */ \ |
| 166 /* Check that length is a positive Smi. */ \ | 166 /* Check that length is a positive Smi. */ \ |
| 167 /* T2: requested array length argument. */ \ | 167 /* T2: requested array length argument. */ \ |
| 168 __ andi(CMPRES1, T2, Immediate(kSmiTagMask)); \ | 168 __ andi(CMPRES1, T2, Immediate(kSmiTagMask)); \ |
| 169 __ bne(CMPRES1, ZR, &fall_through); \ | 169 __ bne(CMPRES1, ZR, &fall_through); \ |
| 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); \ |
| (...skipping 16 matching lines...) Expand all Loading... |
| 191 /* T1: potential next object start. */ \ | 191 /* T1: potential next object start. */ \ |
| 192 /* T2: allocation size. */ \ | 192 /* T2: allocation size. */ \ |
| 193 /* T3: heap. */ \ | 193 /* T3: heap. */ \ |
| 194 __ lw(T4, Address(T3, Heap::EndOffset(space))); \ | 194 __ lw(T4, Address(T3, Heap::EndOffset(space))); \ |
| 195 __ BranchUnsignedGreaterEqual(T1, T4, &fall_through); \ | 195 __ BranchUnsignedGreaterEqual(T1, T4, &fall_through); \ |
| 196 \ | 196 \ |
| 197 /* Successfully allocated the object(s), now update top to point to */ \ | 197 /* Successfully allocated the object(s), now update top to point to */ \ |
| 198 /* next object start and initialize the object. */ \ | 198 /* next object start and initialize the object. */ \ |
| 199 __ sw(T1, Address(T3, Heap::TopOffset(space))); \ | 199 __ sw(T1, Address(T3, Heap::TopOffset(space))); \ |
| 200 __ AddImmediate(V0, kHeapObjectTag); \ | 200 __ AddImmediate(V0, kHeapObjectTag); \ |
| 201 __ UpdateAllocationStatsWithSize(cid, T2, T4, space); \ | 201 NOT_IN_PRODUCT(__ UpdateAllocationStatsWithSize(cid, T2, T4, space)); \ |
| 202 /* Initialize the tags. */ \ | 202 /* Initialize the tags. */ \ |
| 203 /* V0: new object start as a tagged pointer. */ \ | 203 /* V0: new object start as a tagged pointer. */ \ |
| 204 /* T1: new object end address. */ \ | 204 /* T1: new object end address. */ \ |
| 205 /* T2: allocation size. */ \ | 205 /* T2: allocation size. */ \ |
| 206 { \ | 206 { \ |
| 207 Label size_tag_overflow, done; \ | 207 Label size_tag_overflow, done; \ |
| 208 __ BranchUnsignedGreater(T2, Immediate(RawObject::SizeTag::kMaxSizeTag), \ | 208 __ BranchUnsignedGreater(T2, Immediate(RawObject::SizeTag::kMaxSizeTag), \ |
| 209 &size_tag_overflow); \ | 209 &size_tag_overflow); \ |
| 210 __ b(&done); \ | 210 __ b(&done); \ |
| 211 __ delay_slot()->sll(T2, T2, \ | 211 __ delay_slot()->sll(T2, T2, \ |
| (...skipping 1722 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1934 | 1934 |
| 1935 | 1935 |
| 1936 // Allocates one-byte string of length 'end - start'. The content is not | 1936 // Allocates one-byte string of length 'end - start'. The content is not |
| 1937 // initialized. | 1937 // initialized. |
| 1938 // 'length-reg' (T2) contains tagged length. | 1938 // 'length-reg' (T2) contains tagged length. |
| 1939 // Returns new string as tagged pointer in V0. | 1939 // Returns new string as tagged pointer in V0. |
| 1940 static void TryAllocateOnebyteString(Assembler* assembler, | 1940 static void TryAllocateOnebyteString(Assembler* assembler, |
| 1941 Label* ok, | 1941 Label* ok, |
| 1942 Label* failure) { | 1942 Label* failure) { |
| 1943 const Register length_reg = T2; | 1943 const Register length_reg = T2; |
| 1944 __ MaybeTraceAllocation(kOneByteStringCid, V0, failure); | 1944 NOT_IN_PRODUCT(__ 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::SpaceForAllocation(cid); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 1965 // T2: allocation size. | 1965 // T2: allocation size. |
| 1966 // T3: heap. | 1966 // T3: heap. |
| 1967 __ lw(T4, Address(T3, Heap::EndOffset(space))); | 1967 __ lw(T4, Address(T3, Heap::EndOffset(space))); |
| 1968 __ BranchUnsignedGreaterEqual(T1, T4, failure); | 1968 __ BranchUnsignedGreaterEqual(T1, T4, failure); |
| 1969 | 1969 |
| 1970 // Successfully allocated the object(s), now update top to point to | 1970 // Successfully allocated the object(s), now update top to point to |
| 1971 // next object start and initialize the object. | 1971 // next object start and initialize the object. |
| 1972 __ sw(T1, Address(T3, Heap::TopOffset(space))); | 1972 __ sw(T1, Address(T3, Heap::TopOffset(space))); |
| 1973 __ AddImmediate(V0, kHeapObjectTag); | 1973 __ AddImmediate(V0, kHeapObjectTag); |
| 1974 | 1974 |
| 1975 __ UpdateAllocationStatsWithSize(cid, T2, T3, space); | 1975 NOT_IN_PRODUCT(__ UpdateAllocationStatsWithSize(cid, T2, T3, space)); |
| 1976 | 1976 |
| 1977 // Initialize the tags. | 1977 // Initialize the tags. |
| 1978 // V0: new object start as a tagged pointer. | 1978 // V0: new object start as a tagged pointer. |
| 1979 // T1: new object end address. | 1979 // T1: new object end address. |
| 1980 // T2: allocation size. | 1980 // T2: allocation size. |
| 1981 { | 1981 { |
| 1982 Label overflow, done; | 1982 Label overflow, done; |
| 1983 const intptr_t shift = RawObject::kSizeTagPos - kObjectAlignmentLog2; | 1983 const intptr_t shift = RawObject::kSizeTagPos - kObjectAlignmentLog2; |
| 1984 | 1984 |
| 1985 __ BranchUnsignedGreater( | 1985 __ BranchUnsignedGreater( |
| (...skipping 246 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 |