| 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 30 matching lines...) Expand all Loading... |
| 41 ASSERT(field_offset != Class::kNoTypeArguments); | 41 ASSERT(field_offset != Class::kNoTypeArguments); |
| 42 return field_offset; | 42 return field_offset; |
| 43 } | 43 } |
| 44 | 44 |
| 45 | 45 |
| 46 // Intrinsify only for Smi value and index. Non-smi values need a store buffer | 46 // Intrinsify only for Smi value and index. Non-smi values need a store buffer |
| 47 // update. Array length is always a Smi. | 47 // update. Array length is always a Smi. |
| 48 void Intrinsifier::ObjectArraySetIndexed(Assembler* assembler) { | 48 void Intrinsifier::ObjectArraySetIndexed(Assembler* assembler) { |
| 49 Label fall_through; | 49 Label fall_through; |
| 50 | 50 |
| 51 if (Isolate::Current()->TypeChecksEnabled()) { | 51 if (Isolate::Current()->flags().type_checks()) { |
| 52 const intptr_t type_args_field_offset = | 52 const intptr_t type_args_field_offset = |
| 53 ComputeObjectArrayTypeArgumentsOffset(); | 53 ComputeObjectArrayTypeArgumentsOffset(); |
| 54 // Inline simple tests (Smi, null), fallthrough if not positive. | 54 // Inline simple tests (Smi, null), fallthrough if not positive. |
| 55 Label checked_ok; | 55 Label checked_ok; |
| 56 __ lw(T2, Address(SP, 0 * kWordSize)); // Value. | 56 __ lw(T2, Address(SP, 0 * kWordSize)); // Value. |
| 57 | 57 |
| 58 // Null value is valid for any type. | 58 // Null value is valid for any type. |
| 59 __ LoadImmediate(T7, reinterpret_cast<int32_t>(Object::null())); | 59 __ LoadImmediate(T7, reinterpret_cast<int32_t>(Object::null())); |
| 60 __ beq(T2, T7, &checked_ok); | 60 __ beq(T2, T7, &checked_ok); |
| 61 | 61 |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 | 138 |
| 139 __ Bind(&fall_through); | 139 __ Bind(&fall_through); |
| 140 } | 140 } |
| 141 | 141 |
| 142 | 142 |
| 143 // Add an element to growable array if it doesn't need to grow, otherwise | 143 // Add an element to growable array if it doesn't need to grow, otherwise |
| 144 // call into regular code. | 144 // call into regular code. |
| 145 // On stack: growable array (+1), value (+0). | 145 // On stack: growable array (+1), value (+0). |
| 146 void Intrinsifier::GrowableArray_add(Assembler* assembler) { | 146 void Intrinsifier::GrowableArray_add(Assembler* assembler) { |
| 147 // In checked mode we need to type-check the incoming argument. | 147 // In checked mode we need to type-check the incoming argument. |
| 148 if (Isolate::Current()->TypeChecksEnabled()) return; | 148 if (Isolate::Current()->flags().type_checks()) return; |
| 149 Label fall_through; | 149 Label fall_through; |
| 150 __ lw(T0, Address(SP, 1 * kWordSize)); // Array. | 150 __ lw(T0, Address(SP, 1 * kWordSize)); // Array. |
| 151 __ lw(T1, FieldAddress(T0, GrowableObjectArray::length_offset())); | 151 __ lw(T1, FieldAddress(T0, GrowableObjectArray::length_offset())); |
| 152 // T1: length. | 152 // T1: length. |
| 153 __ lw(T2, FieldAddress(T0, GrowableObjectArray::data_offset())); | 153 __ lw(T2, FieldAddress(T0, GrowableObjectArray::data_offset())); |
| 154 // T2: data. | 154 // T2: data. |
| 155 __ lw(T3, FieldAddress(T2, Array::length_offset())); | 155 __ lw(T3, FieldAddress(T2, Array::length_offset())); |
| 156 // Compare length with capacity. | 156 // Compare length with capacity. |
| 157 // T3: capacity. | 157 // T3: capacity. |
| 158 __ beq(T1, T3, &fall_through); // Must grow data. | 158 __ beq(T1, T3, &fall_through); // Must grow data. |
| (...skipping 1983 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2142 Isolate* isolate = Isolate::Current(); | 2142 Isolate* isolate = Isolate::Current(); |
| 2143 __ LoadImmediate(V0, reinterpret_cast<uword>(isolate)); | 2143 __ LoadImmediate(V0, reinterpret_cast<uword>(isolate)); |
| 2144 // Set return value. | 2144 // Set return value. |
| 2145 __ Ret(); | 2145 __ Ret(); |
| 2146 __ delay_slot()->lw(V0, Address(V0, Isolate::current_tag_offset())); | 2146 __ delay_slot()->lw(V0, Address(V0, Isolate::current_tag_offset())); |
| 2147 } | 2147 } |
| 2148 | 2148 |
| 2149 } // namespace dart | 2149 } // namespace dart |
| 2150 | 2150 |
| 2151 #endif // defined TARGET_ARCH_MIPS | 2151 #endif // defined TARGET_ARCH_MIPS |
| OLD | NEW |