| 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/intermediate_language.h" | 8 #include "vm/intermediate_language.h" |
| 9 | 9 |
| 10 #include "vm/dart_entry.h" | 10 #include "vm/dart_entry.h" |
| (...skipping 2025 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2036 // Store the type argument field. | 2036 // Store the type argument field. |
| 2037 __ StoreIntoObjectNoBarrier(V0, | 2037 __ StoreIntoObjectNoBarrier(V0, |
| 2038 FieldAddress(V0, Array::type_arguments_offset()), | 2038 FieldAddress(V0, Array::type_arguments_offset()), |
| 2039 kElemTypeReg); | 2039 kElemTypeReg); |
| 2040 | 2040 |
| 2041 // Set the length field. | 2041 // Set the length field. |
| 2042 __ StoreIntoObjectNoBarrier(V0, | 2042 __ StoreIntoObjectNoBarrier(V0, |
| 2043 FieldAddress(V0, Array::length_offset()), | 2043 FieldAddress(V0, Array::length_offset()), |
| 2044 kLengthReg); | 2044 kLengthReg); |
| 2045 | 2045 |
| 2046 __ LoadImmediate(T7, reinterpret_cast<int32_t>(Object::null())); | |
| 2047 // Initialize all array elements to raw_null. | 2046 // Initialize all array elements to raw_null. |
| 2048 // V0: new object start as a tagged pointer. | 2047 // V0: new object start as a tagged pointer. |
| 2049 // T1: new object end address. | 2048 // T1: new object end address. |
| 2050 // T2: iterator which initially points to the start of the variable | 2049 // T2: iterator which initially points to the start of the variable |
| 2051 // data area to be initialized. | 2050 // data area to be initialized. |
| 2052 // T7: null. | 2051 // T7: null. |
| 2053 __ AddImmediate(T2, V0, sizeof(RawArray) - kHeapObjectTag); | 2052 if (num_elements > 0) { |
| 2053 __ LoadImmediate(T7, reinterpret_cast<int32_t>(Object::null())); |
| 2054 __ AddImmediate(T2, V0, sizeof(RawArray) - kHeapObjectTag); |
| 2054 | 2055 |
| 2055 Label init_loop; | 2056 Label init_loop; |
| 2056 __ Bind(&init_loop); | 2057 __ Bind(&init_loop); |
| 2057 __ BranchUnsignedGreaterEqual(T2, T1, done); | 2058 __ sw(T7, Address(T2, 0)); |
| 2058 __ sw(T7, Address(T2, 0)); | 2059 __ addiu(T2, T2, Immediate(kWordSize)); |
| 2059 __ b(&init_loop); | 2060 __ BranchUnsignedLess(T2, T1, &init_loop); |
| 2060 __ delay_slot()->addiu(T2, T2, Immediate(kWordSize)); | 2061 } |
| 2062 __ b(done); |
| 2061 } | 2063 } |
| 2062 | 2064 |
| 2063 | 2065 |
| 2064 void CreateArrayInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 2066 void CreateArrayInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 2065 __ TraceSimMsg("CreateArrayInstr"); | 2067 __ TraceSimMsg("CreateArrayInstr"); |
| 2066 const Register kLengthReg = A1; | 2068 const Register kLengthReg = A1; |
| 2067 const Register kElemTypeReg = A0; | 2069 const Register kElemTypeReg = A0; |
| 2068 const Register kResultReg = V0; | 2070 const Register kResultReg = V0; |
| 2069 ASSERT(locs()->in(0).reg() == kElemTypeReg); | 2071 ASSERT(locs()->in(0).reg() == kElemTypeReg); |
| 2070 ASSERT(locs()->in(1).reg() == kLengthReg); | 2072 ASSERT(locs()->in(1).reg() == kLengthReg); |
| (...skipping 2705 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4776 compiler->GenerateCall(token_pos(), &label, stub_kind_, locs()); | 4778 compiler->GenerateCall(token_pos(), &label, stub_kind_, locs()); |
| 4777 #if defined(DEBUG) | 4779 #if defined(DEBUG) |
| 4778 __ LoadImmediate(S4, kInvalidObjectPointer); | 4780 __ LoadImmediate(S4, kInvalidObjectPointer); |
| 4779 __ LoadImmediate(S5, kInvalidObjectPointer); | 4781 __ LoadImmediate(S5, kInvalidObjectPointer); |
| 4780 #endif | 4782 #endif |
| 4781 } | 4783 } |
| 4782 | 4784 |
| 4783 } // namespace dart | 4785 } // namespace dart |
| 4784 | 4786 |
| 4785 #endif // defined TARGET_ARCH_MIPS | 4787 #endif // defined TARGET_ARCH_MIPS |
| OLD | NEW |