| 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 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 __ LoadObject(T7, Object::null_object()); | 143 __ LoadObject(T7, Object::null_object()); |
| 144 __ Ret(); | 144 __ Ret(); |
| 145 __ delay_slot()->mov(V0, T7); | 145 __ delay_slot()->mov(V0, T7); |
| 146 __ Bind(&fall_through); | 146 __ Bind(&fall_through); |
| 147 } | 147 } |
| 148 | 148 |
| 149 | 149 |
| 150 #define TYPED_ARRAY_ALLOCATION(type_name, cid, max_len, scale_shift) \ | 150 #define TYPED_ARRAY_ALLOCATION(type_name, cid, max_len, scale_shift) \ |
| 151 Label fall_through; \ | 151 Label fall_through; \ |
| 152 const intptr_t kArrayLengthStackOffset = 0 * kWordSize; \ | 152 const intptr_t kArrayLengthStackOffset = 0 * kWordSize; \ |
| 153 __ MaybeTraceAllocation(cid, T2, &fall_through, \ | 153 __ MaybeTraceAllocation(cid, T2, &fall_through); \ |
| 154 /* inline_isolate = */ false); \ | |
| 155 __ lw(T2, Address(SP, kArrayLengthStackOffset)); /* Array length. */ \ | 154 __ lw(T2, Address(SP, kArrayLengthStackOffset)); /* Array length. */ \ |
| 156 /* Check that length is a positive Smi. */ \ | 155 /* Check that length is a positive Smi. */ \ |
| 157 /* T2: requested array length argument. */ \ | 156 /* T2: requested array length argument. */ \ |
| 158 __ andi(CMPRES1, T2, Immediate(kSmiTagMask)); \ | 157 __ andi(CMPRES1, T2, Immediate(kSmiTagMask)); \ |
| 159 __ bne(CMPRES1, ZR, &fall_through); \ | 158 __ bne(CMPRES1, ZR, &fall_through); \ |
| 160 __ BranchSignedLess(T2, Immediate(0), &fall_through); \ | 159 __ BranchSignedLess(T2, Immediate(0), &fall_through); \ |
| 161 __ SmiUntag(T2); \ | 160 __ SmiUntag(T2); \ |
| 162 /* Check for maximum allowed length. */ \ | 161 /* Check for maximum allowed length. */ \ |
| 163 /* T2: untagged array length. */ \ | 162 /* T2: untagged array length. */ \ |
| 164 __ BranchSignedGreater(T2, Immediate(max_len), &fall_through); \ | 163 __ BranchSignedGreater(T2, Immediate(max_len), &fall_through); \ |
| (...skipping 16 matching lines...) Expand all Loading... |
| 181 /* T1: potential next object start. */ \ | 180 /* T1: potential next object start. */ \ |
| 182 /* T2: allocation size. */ \ | 181 /* T2: allocation size. */ \ |
| 183 /* T3: heap. */ \ | 182 /* T3: heap. */ \ |
| 184 __ lw(T4, Address(T3, Heap::EndOffset(space))); \ | 183 __ lw(T4, Address(T3, Heap::EndOffset(space))); \ |
| 185 __ BranchUnsignedGreaterEqual(T1, T4, &fall_through); \ | 184 __ BranchUnsignedGreaterEqual(T1, T4, &fall_through); \ |
| 186 \ | 185 \ |
| 187 /* Successfully allocated the object(s), now update top to point to */ \ | 186 /* Successfully allocated the object(s), now update top to point to */ \ |
| 188 /* next object start and initialize the object. */ \ | 187 /* next object start and initialize the object. */ \ |
| 189 __ sw(T1, Address(T3, Heap::TopOffset(space))); \ | 188 __ sw(T1, Address(T3, Heap::TopOffset(space))); \ |
| 190 __ AddImmediate(V0, kHeapObjectTag); \ | 189 __ AddImmediate(V0, kHeapObjectTag); \ |
| 191 __ UpdateAllocationStatsWithSize(cid, T2, T4, space, \ | 190 __ UpdateAllocationStatsWithSize(cid, T2, T4, space); \ |
| 192 /* inline_isolate = */ false); \ | |
| 193 /* Initialize the tags. */ \ | 191 /* Initialize the tags. */ \ |
| 194 /* V0: new object start as a tagged pointer. */ \ | 192 /* V0: new object start as a tagged pointer. */ \ |
| 195 /* T1: new object end address. */ \ | 193 /* T1: new object end address. */ \ |
| 196 /* T2: allocation size. */ \ | 194 /* T2: allocation size. */ \ |
| 197 { \ | 195 { \ |
| 198 Label size_tag_overflow, done; \ | 196 Label size_tag_overflow, done; \ |
| 199 __ BranchUnsignedGreater(T2, Immediate(RawObject::SizeTag::kMaxSizeTag), \ | 197 __ BranchUnsignedGreater(T2, Immediate(RawObject::SizeTag::kMaxSizeTag), \ |
| 200 &size_tag_overflow); \ | 198 &size_tag_overflow); \ |
| 201 __ b(&done); \ | 199 __ b(&done); \ |
| 202 __ delay_slot()->sll(T2, T2, \ | 200 __ delay_slot()->sll(T2, T2, \ |
| (...skipping 1757 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1960 | 1958 |
| 1961 | 1959 |
| 1962 // Allocates one-byte string of length 'end - start'. The content is not | 1960 // Allocates one-byte string of length 'end - start'. The content is not |
| 1963 // initialized. | 1961 // initialized. |
| 1964 // 'length-reg' (T2) contains tagged length. | 1962 // 'length-reg' (T2) contains tagged length. |
| 1965 // Returns new string as tagged pointer in V0. | 1963 // Returns new string as tagged pointer in V0. |
| 1966 static void TryAllocateOnebyteString(Assembler* assembler, | 1964 static void TryAllocateOnebyteString(Assembler* assembler, |
| 1967 Label* ok, | 1965 Label* ok, |
| 1968 Label* failure) { | 1966 Label* failure) { |
| 1969 const Register length_reg = T2; | 1967 const Register length_reg = T2; |
| 1970 __ MaybeTraceAllocation(kOneByteStringCid, V0, failure, | 1968 __ MaybeTraceAllocation(kOneByteStringCid, V0, failure); |
| 1971 /* inline_isolate = */ false); | |
| 1972 __ mov(T6, length_reg); // Save the length register. | 1969 __ mov(T6, length_reg); // Save the length register. |
| 1973 // TODO(koda): Protect against negative length and overflow here. | 1970 // TODO(koda): Protect against negative length and overflow here. |
| 1974 __ SmiUntag(length_reg); | 1971 __ SmiUntag(length_reg); |
| 1975 const intptr_t fixed_size = sizeof(RawString) + kObjectAlignment - 1; | 1972 const intptr_t fixed_size = sizeof(RawString) + kObjectAlignment - 1; |
| 1976 __ AddImmediate(length_reg, fixed_size); | 1973 __ AddImmediate(length_reg, fixed_size); |
| 1977 __ LoadImmediate(TMP, ~(kObjectAlignment - 1)); | 1974 __ LoadImmediate(TMP, ~(kObjectAlignment - 1)); |
| 1978 __ and_(length_reg, length_reg, TMP); | 1975 __ and_(length_reg, length_reg, TMP); |
| 1979 | 1976 |
| 1980 const intptr_t cid = kOneByteStringCid; | 1977 const intptr_t cid = kOneByteStringCid; |
| 1981 Heap::Space space = Heap::SpaceForAllocation(cid); | 1978 Heap::Space space = Heap::SpaceForAllocation(cid); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 1992 // T2: allocation size. | 1989 // T2: allocation size. |
| 1993 // T3: heap. | 1990 // T3: heap. |
| 1994 __ lw(T4, Address(T3, Heap::EndOffset(space))); | 1991 __ lw(T4, Address(T3, Heap::EndOffset(space))); |
| 1995 __ BranchUnsignedGreaterEqual(T1, T4, failure); | 1992 __ BranchUnsignedGreaterEqual(T1, T4, failure); |
| 1996 | 1993 |
| 1997 // Successfully allocated the object(s), now update top to point to | 1994 // Successfully allocated the object(s), now update top to point to |
| 1998 // next object start and initialize the object. | 1995 // next object start and initialize the object. |
| 1999 __ sw(T1, Address(T3, Heap::TopOffset(space))); | 1996 __ sw(T1, Address(T3, Heap::TopOffset(space))); |
| 2000 __ AddImmediate(V0, kHeapObjectTag); | 1997 __ AddImmediate(V0, kHeapObjectTag); |
| 2001 | 1998 |
| 2002 __ UpdateAllocationStatsWithSize(cid, T2, T3, space, | 1999 __ UpdateAllocationStatsWithSize(cid, T2, T3, space); |
| 2003 /* inline_isolate = */ false); | |
| 2004 | 2000 |
| 2005 // Initialize the tags. | 2001 // Initialize the tags. |
| 2006 // V0: new object start as a tagged pointer. | 2002 // V0: new object start as a tagged pointer. |
| 2007 // T1: new object end address. | 2003 // T1: new object end address. |
| 2008 // T2: allocation size. | 2004 // T2: allocation size. |
| 2009 { | 2005 { |
| 2010 Label overflow, done; | 2006 Label overflow, done; |
| 2011 const intptr_t shift = RawObject::kSizeTagPos - kObjectAlignmentLog2; | 2007 const intptr_t shift = RawObject::kSizeTagPos - kObjectAlignmentLog2; |
| 2012 | 2008 |
| 2013 __ BranchUnsignedGreater( | 2009 __ BranchUnsignedGreater( |
| (...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2243 | 2239 |
| 2244 void Intrinsifier::Profiler_getCurrentTag(Assembler* assembler) { | 2240 void Intrinsifier::Profiler_getCurrentTag(Assembler* assembler) { |
| 2245 __ LoadIsolate(V0); | 2241 __ LoadIsolate(V0); |
| 2246 __ Ret(); | 2242 __ Ret(); |
| 2247 __ delay_slot()->lw(V0, Address(V0, Isolate::current_tag_offset())); | 2243 __ delay_slot()->lw(V0, Address(V0, Isolate::current_tag_offset())); |
| 2248 } | 2244 } |
| 2249 | 2245 |
| 2250 } // namespace dart | 2246 } // namespace dart |
| 2251 | 2247 |
| 2252 #endif // defined TARGET_ARCH_MIPS | 2248 #endif // defined TARGET_ARCH_MIPS |
| OLD | NEW |