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" | 5 #include "vm/globals.h" |
6 #if defined(TARGET_ARCH_IA32) | 6 #if defined(TARGET_ARCH_IA32) |
7 | 7 |
8 #include "vm/assembler.h" | 8 #include "vm/assembler.h" |
9 #include "vm/compiler.h" | 9 #include "vm/compiler.h" |
10 #include "vm/dart_entry.h" | 10 #include "vm/dart_entry.h" |
(...skipping 1177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1188 const Immediate& raw_null = | 1188 const Immediate& raw_null = |
1189 Immediate(reinterpret_cast<intptr_t>(Object::null())); | 1189 Immediate(reinterpret_cast<intptr_t>(Object::null())); |
1190 | 1190 |
1191 // EAX: new object start. | 1191 // EAX: new object start. |
1192 // EBX: next object start. | 1192 // EBX: next object start. |
1193 // EDI: new object type arguments (if is_cls_parameterized). | 1193 // EDI: new object type arguments (if is_cls_parameterized). |
1194 // First try inlining the initialization without a loop. | 1194 // First try inlining the initialization without a loop. |
1195 if (instance_size < (kInlineInstanceSize * kWordSize)) { | 1195 if (instance_size < (kInlineInstanceSize * kWordSize)) { |
1196 // Check if the object contains any non-header fields. | 1196 // Check if the object contains any non-header fields. |
1197 // Small objects are initialized using a consecutive set of writes. | 1197 // Small objects are initialized using a consecutive set of writes. |
1198 for (intptr_t current_offset = sizeof(RawObject); | 1198 for (intptr_t current_offset = Instance::NextFieldOffset(); |
1199 current_offset < instance_size; | 1199 current_offset < instance_size; |
1200 current_offset += kWordSize) { | 1200 current_offset += kWordSize) { |
1201 __ movl(Address(EAX, current_offset), raw_null); | 1201 __ movl(Address(EAX, current_offset), raw_null); |
1202 } | 1202 } |
1203 } else { | 1203 } else { |
1204 __ leal(ECX, Address(EAX, sizeof(RawObject))); | 1204 __ leal(ECX, Address(EAX, Instance::NextFieldOffset())); |
1205 // Loop until the whole object is initialized. | 1205 // Loop until the whole object is initialized. |
1206 // EAX: new object. | 1206 // EAX: new object. |
1207 // EBX: next object start. | 1207 // EBX: next object start. |
1208 // ECX: next word to be initialized. | 1208 // ECX: next word to be initialized. |
1209 // EDI: new object type arguments (if is_cls_parameterized). | 1209 // EDI: new object type arguments (if is_cls_parameterized). |
1210 Label init_loop; | 1210 Label init_loop; |
1211 Label done; | 1211 Label done; |
1212 __ Bind(&init_loop); | 1212 __ Bind(&init_loop); |
1213 __ cmpl(ECX, EBX); | 1213 __ cmpl(ECX, EBX); |
1214 __ j(ABOVE_EQUAL, &done, Assembler::kNearJump); | 1214 __ j(ABOVE_EQUAL, &done, Assembler::kNearJump); |
(...skipping 993 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2208 GenerateIdenticalWithNumberCheckStub(assembler, left, right, temp); | 2208 GenerateIdenticalWithNumberCheckStub(assembler, left, right, temp); |
2209 __ popl(temp); | 2209 __ popl(temp); |
2210 __ popl(right); | 2210 __ popl(right); |
2211 __ popl(left); | 2211 __ popl(left); |
2212 __ ret(); | 2212 __ ret(); |
2213 } | 2213 } |
2214 | 2214 |
2215 } // namespace dart | 2215 } // namespace dart |
2216 | 2216 |
2217 #endif // defined TARGET_ARCH_IA32 | 2217 #endif // defined TARGET_ARCH_IA32 |
OLD | NEW |