| 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_IA32. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_IA32. |
| 6 #if defined(TARGET_ARCH_IA32) | 6 #if defined(TARGET_ARCH_IA32) |
| 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 2075 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2086 // Set the length field. | 2086 // Set the length field. |
| 2087 __ StoreIntoObjectNoBarrier(EAX, | 2087 __ StoreIntoObjectNoBarrier(EAX, |
| 2088 FieldAddress(EAX, Array::length_offset()), | 2088 FieldAddress(EAX, Array::length_offset()), |
| 2089 kLengthReg); | 2089 kLengthReg); |
| 2090 | 2090 |
| 2091 // Initialize all array elements to raw_null. | 2091 // Initialize all array elements to raw_null. |
| 2092 // EAX: new object start as a tagged pointer. | 2092 // EAX: new object start as a tagged pointer. |
| 2093 // EBX: new object end address. | 2093 // EBX: new object end address. |
| 2094 // EDI: iterator which initially points to the start of the variable | 2094 // EDI: iterator which initially points to the start of the variable |
| 2095 // data area to be initialized. | 2095 // data area to be initialized. |
| 2096 const Immediate& raw_null = | 2096 if (num_elements > 0) { |
| 2097 Immediate(reinterpret_cast<intptr_t>(Object::null())); | 2097 const Immediate& raw_null = |
| 2098 __ leal(EDI, FieldAddress(EAX, sizeof(RawArray))); | 2098 Immediate(reinterpret_cast<intptr_t>(Object::null())); |
| 2099 Label init_loop; | 2099 __ leal(EDI, FieldAddress(EAX, sizeof(RawArray))); |
| 2100 __ Bind(&init_loop); | 2100 Label init_loop; |
| 2101 __ cmpl(EDI, EBX); | 2101 __ Bind(&init_loop); |
| 2102 __ j(ABOVE_EQUAL, done, Assembler::kNearJump); | 2102 __ movl(Address(EDI, 0), raw_null); |
| 2103 __ movl(Address(EDI, 0), raw_null); | 2103 __ addl(EDI, Immediate(kWordSize)); |
| 2104 __ addl(EDI, Immediate(kWordSize)); | 2104 __ cmpl(EDI, EBX); |
| 2105 __ jmp(&init_loop, Assembler::kNearJump); | 2105 __ j(BELOW, &init_loop, Assembler::kNearJump); |
| 2106 } |
| 2107 __ jmp(done, Assembler::kNearJump); |
| 2106 } | 2108 } |
| 2107 | 2109 |
| 2108 | 2110 |
| 2109 void CreateArrayInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 2111 void CreateArrayInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 2110 // Allocate the array. EDX = length, ECX = element type. | 2112 // Allocate the array. EDX = length, ECX = element type. |
| 2111 const Register kLengthReg = EDX; | 2113 const Register kLengthReg = EDX; |
| 2112 const Register kElemTypeReg = ECX; | 2114 const Register kElemTypeReg = ECX; |
| 2113 const Register kResultReg = EAX; | 2115 const Register kResultReg = EAX; |
| 2114 ASSERT(locs()->in(0).reg() == kElemTypeReg); | 2116 ASSERT(locs()->in(0).reg() == kElemTypeReg); |
| 2115 ASSERT(locs()->in(1).reg() == kLengthReg); | 2117 ASSERT(locs()->in(1).reg() == kLengthReg); |
| (...skipping 4441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6557 __ movl(EDX, Immediate(kInvalidObjectPointer)); | 6559 __ movl(EDX, Immediate(kInvalidObjectPointer)); |
| 6558 __ movl(EDX, Immediate(kInvalidObjectPointer)); | 6560 __ movl(EDX, Immediate(kInvalidObjectPointer)); |
| 6559 #endif | 6561 #endif |
| 6560 } | 6562 } |
| 6561 | 6563 |
| 6562 } // namespace dart | 6564 } // namespace dart |
| 6563 | 6565 |
| 6564 #undef __ | 6566 #undef __ |
| 6565 | 6567 |
| 6566 #endif // defined TARGET_ARCH_IA32 | 6568 #endif // defined TARGET_ARCH_IA32 |
| OLD | NEW |