| 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 24 matching lines...) Expand all Loading... |
| 35 ASSERT(field_offset != Class::kNoTypeArguments); | 35 ASSERT(field_offset != Class::kNoTypeArguments); |
| 36 return field_offset; | 36 return field_offset; |
| 37 } | 37 } |
| 38 | 38 |
| 39 | 39 |
| 40 // Intrinsify only for Smi value and index. Non-smi values need a store buffer | 40 // Intrinsify only for Smi value and index. Non-smi values need a store buffer |
| 41 // update. Array length is always a Smi. | 41 // update. Array length is always a Smi. |
| 42 void Intrinsifier::ObjectArraySetIndexed(Assembler* assembler) { | 42 void Intrinsifier::ObjectArraySetIndexed(Assembler* assembler) { |
| 43 Label fall_through; | 43 Label fall_through; |
| 44 | 44 |
| 45 if (FLAG_enable_type_checks) { | 45 if (Isolate::Current()->TypeChecksEnabled()) { |
| 46 const intptr_t type_args_field_offset = | 46 const intptr_t type_args_field_offset = |
| 47 ComputeObjectArrayTypeArgumentsOffset(); | 47 ComputeObjectArrayTypeArgumentsOffset(); |
| 48 // Inline simple tests (Smi, null), fallthrough if not positive. | 48 // Inline simple tests (Smi, null), fallthrough if not positive. |
| 49 Label checked_ok; | 49 Label checked_ok; |
| 50 __ lw(T2, Address(SP, 0 * kWordSize)); // Value. | 50 __ lw(T2, Address(SP, 0 * kWordSize)); // Value. |
| 51 | 51 |
| 52 // Null value is valid for any type. | 52 // Null value is valid for any type. |
| 53 __ LoadImmediate(T7, reinterpret_cast<int32_t>(Object::null())); | 53 __ LoadImmediate(T7, reinterpret_cast<int32_t>(Object::null())); |
| 54 __ beq(T2, T7, &checked_ok); | 54 __ beq(T2, T7, &checked_ok); |
| 55 | 55 |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 | 132 |
| 133 __ Bind(&fall_through); | 133 __ Bind(&fall_through); |
| 134 } | 134 } |
| 135 | 135 |
| 136 | 136 |
| 137 // Add an element to growable array if it doesn't need to grow, otherwise | 137 // Add an element to growable array if it doesn't need to grow, otherwise |
| 138 // call into regular code. | 138 // call into regular code. |
| 139 // On stack: growable array (+1), value (+0). | 139 // On stack: growable array (+1), value (+0). |
| 140 void Intrinsifier::GrowableArray_add(Assembler* assembler) { | 140 void Intrinsifier::GrowableArray_add(Assembler* assembler) { |
| 141 // In checked mode we need to type-check the incoming argument. | 141 // In checked mode we need to type-check the incoming argument. |
| 142 if (FLAG_enable_type_checks) return; | 142 if (Isolate::Current()->TypeChecksEnabled()) return; |
| 143 Label fall_through; | 143 Label fall_through; |
| 144 __ lw(T0, Address(SP, 1 * kWordSize)); // Array. | 144 __ lw(T0, Address(SP, 1 * kWordSize)); // Array. |
| 145 __ lw(T1, FieldAddress(T0, GrowableObjectArray::length_offset())); | 145 __ lw(T1, FieldAddress(T0, GrowableObjectArray::length_offset())); |
| 146 // T1: length. | 146 // T1: length. |
| 147 __ lw(T2, FieldAddress(T0, GrowableObjectArray::data_offset())); | 147 __ lw(T2, FieldAddress(T0, GrowableObjectArray::data_offset())); |
| 148 // T2: data. | 148 // T2: data. |
| 149 __ lw(T3, FieldAddress(T2, Array::length_offset())); | 149 __ lw(T3, FieldAddress(T2, Array::length_offset())); |
| 150 // Compare length with capacity. | 150 // Compare length with capacity. |
| 151 // T3: capacity. | 151 // T3: capacity. |
| 152 __ beq(T1, T3, &fall_through); // Must grow data. | 152 __ beq(T1, T3, &fall_through); // Must grow data. |
| (...skipping 1898 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2051 Isolate* isolate = Isolate::Current(); | 2051 Isolate* isolate = Isolate::Current(); |
| 2052 __ LoadImmediate(V0, reinterpret_cast<uword>(isolate)); | 2052 __ LoadImmediate(V0, reinterpret_cast<uword>(isolate)); |
| 2053 // Set return value. | 2053 // Set return value. |
| 2054 __ Ret(); | 2054 __ Ret(); |
| 2055 __ delay_slot()->lw(V0, Address(V0, Isolate::current_tag_offset())); | 2055 __ delay_slot()->lw(V0, Address(V0, Isolate::current_tag_offset())); |
| 2056 } | 2056 } |
| 2057 | 2057 |
| 2058 } // namespace dart | 2058 } // namespace dart |
| 2059 | 2059 |
| 2060 #endif // defined TARGET_ARCH_MIPS | 2060 #endif // defined TARGET_ARCH_MIPS |
| OLD | NEW |