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 580 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
591 __ j(ABOVE_EQUAL, &slow_case); | 591 __ j(ABOVE_EQUAL, &slow_case); |
592 | 592 |
593 // Successfully allocated the object(s), now update top to point to | 593 // Successfully allocated the object(s), now update top to point to |
594 // next object start and initialize the object. | 594 // next object start and initialize the object. |
595 // EAX: potential new object start. | 595 // EAX: potential new object start. |
596 // EBX: potential next object start. | 596 // EBX: potential next object start. |
597 // EDX: Array length as Smi. | 597 // EDX: Array length as Smi. |
598 // EDI: Points to new space object. | 598 // EDI: Points to new space object. |
599 __ movl(Address(EDI, Scavenger::top_offset()), EBX); | 599 __ movl(Address(EDI, Scavenger::top_offset()), EBX); |
600 __ addl(EAX, Immediate(kHeapObjectTag)); | 600 __ addl(EAX, Immediate(kHeapObjectTag)); |
| 601 // EDI: Size of allocation in bytes. |
| 602 __ movl(EDI, EBX); |
| 603 __ subl(EDI, EAX); |
| 604 __ UpdateAllocationStatsWithSize(kArrayCid, EDI, kNoRegister); |
601 | 605 |
602 // EAX: new object start as a tagged pointer. | 606 // EAX: new object start as a tagged pointer. |
603 // EBX: new object end address. | 607 // EBX: new object end address. |
604 // ECX: array element type. | 608 // ECX: array element type. |
605 // EDX: Array length as Smi. | 609 // EDX: Array length as Smi. |
606 | 610 |
607 // Store the type argument field. | 611 // Store the type argument field. |
608 __ StoreIntoObjectNoBarrier( | 612 __ StoreIntoObjectNoBarrier( |
609 EAX, | 613 EAX, |
610 FieldAddress(EAX, Array::type_arguments_offset()), | 614 FieldAddress(EAX, Array::type_arguments_offset()), |
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
933 __ j(ABOVE_EQUAL, &slow_case, Assembler::kNearJump); | 937 __ j(ABOVE_EQUAL, &slow_case, Assembler::kNearJump); |
934 } | 938 } |
935 | 939 |
936 // Successfully allocated the object, now update top to point to | 940 // Successfully allocated the object, now update top to point to |
937 // next object start and initialize the object. | 941 // next object start and initialize the object. |
938 // EAX: new object. | 942 // EAX: new object. |
939 // EBX: next object start. | 943 // EBX: next object start. |
940 // EDX: number of context variables. | 944 // EDX: number of context variables. |
941 __ movl(Address::Absolute(heap->TopAddress()), EBX); | 945 __ movl(Address::Absolute(heap->TopAddress()), EBX); |
942 __ addl(EAX, Immediate(kHeapObjectTag)); | 946 __ addl(EAX, Immediate(kHeapObjectTag)); |
| 947 // EBX: Size of allocation in bytes. |
| 948 __ subl(EBX, EAX); |
| 949 __ UpdateAllocationStatsWithSize(context_class.id(), EBX, kNoRegister); |
943 | 950 |
944 // Calculate the size tag. | 951 // Calculate the size tag. |
945 // EAX: new object. | 952 // EAX: new object. |
946 // EDX: number of context variables. | 953 // EDX: number of context variables. |
947 { | 954 { |
948 Label size_tag_overflow, done; | 955 Label size_tag_overflow, done; |
949 __ leal(EBX, Address(EDX, TIMES_4, fixed_size)); | 956 __ leal(EBX, Address(EDX, TIMES_4, fixed_size)); |
950 __ andl(EBX, Immediate(-kObjectAlignment)); | 957 __ andl(EBX, Immediate(-kObjectAlignment)); |
951 __ cmpl(EBX, Immediate(RawObject::SizeTag::kMaxSizeTag)); | 958 __ cmpl(EBX, Immediate(RawObject::SizeTag::kMaxSizeTag)); |
952 __ j(ABOVE, &size_tag_overflow, Assembler::kNearJump); | 959 __ j(ABOVE, &size_tag_overflow, Assembler::kNearJump); |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1134 // ECX: potential new object end and, if ECX != EBX, potential new | 1141 // ECX: potential new object end and, if ECX != EBX, potential new |
1135 // InstantiatedTypeArguments object start. | 1142 // InstantiatedTypeArguments object start. |
1136 } | 1143 } |
1137 // Check if the allocation fits into the remaining space. | 1144 // Check if the allocation fits into the remaining space. |
1138 // EAX: potential new object start. | 1145 // EAX: potential new object start. |
1139 // EBX: potential next object start. | 1146 // EBX: potential next object start. |
1140 __ cmpl(EBX, Address::Absolute(heap->EndAddress())); | 1147 __ cmpl(EBX, Address::Absolute(heap->EndAddress())); |
1141 if (FLAG_use_slow_path) { | 1148 if (FLAG_use_slow_path) { |
1142 __ jmp(&slow_case); | 1149 __ jmp(&slow_case); |
1143 } else { | 1150 } else { |
1144 __ j(ABOVE_EQUAL, &slow_case, Assembler::kNearJump); | 1151 __ j(ABOVE_EQUAL, &slow_case); |
1145 } | 1152 } |
1146 | 1153 |
1147 // Successfully allocated the object(s), now update top to point to | 1154 // Successfully allocated the object(s), now update top to point to |
1148 // next object start and initialize the object. | 1155 // next object start and initialize the object. |
1149 __ movl(Address::Absolute(heap->TopAddress()), EBX); | 1156 __ movl(Address::Absolute(heap->TopAddress()), EBX); |
| 1157 __ UpdateAllocationStats(cls.id(), EDI); |
1150 | 1158 |
1151 if (is_cls_parameterized) { | 1159 if (is_cls_parameterized) { |
1152 // Initialize the type arguments field in the object. | 1160 // Initialize the type arguments field in the object. |
1153 // EAX: new object start. | 1161 // EAX: new object start. |
1154 // ECX: potential new object end and, if ECX != EBX, potential new | 1162 // ECX: potential new object end and, if ECX != EBX, potential new |
1155 // InstantiatedTypeArguments object start. | 1163 // InstantiatedTypeArguments object start. |
1156 // EBX: next object start. | 1164 // EBX: next object start. |
1157 Label type_arguments_ready; | 1165 Label type_arguments_ready; |
1158 __ movl(EDI, Address(ESP, kObjectTypeArgumentsOffset)); | 1166 __ movl(EDI, Address(ESP, kObjectTypeArgumentsOffset)); |
1159 __ cmpl(ECX, EBX); | 1167 __ cmpl(ECX, EBX); |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1304 __ cmpl(EBX, Address::Absolute(heap->EndAddress())); | 1312 __ cmpl(EBX, Address::Absolute(heap->EndAddress())); |
1305 if (FLAG_use_slow_path) { | 1313 if (FLAG_use_slow_path) { |
1306 __ jmp(&slow_case); | 1314 __ jmp(&slow_case); |
1307 } else { | 1315 } else { |
1308 __ j(ABOVE_EQUAL, &slow_case, Assembler::kNearJump); | 1316 __ j(ABOVE_EQUAL, &slow_case, Assembler::kNearJump); |
1309 } | 1317 } |
1310 | 1318 |
1311 // Successfully allocated the object, now update top to point to | 1319 // Successfully allocated the object, now update top to point to |
1312 // next object start and initialize the object. | 1320 // next object start and initialize the object. |
1313 __ movl(Address::Absolute(heap->TopAddress()), EBX); | 1321 __ movl(Address::Absolute(heap->TopAddress()), EBX); |
| 1322 // EAX: new closure object. |
| 1323 // ECX: new context object (only if is_implicit_closure). |
| 1324 if (is_implicit_instance_closure) { |
| 1325 // This closure allocates a context, update allocation stats. |
| 1326 // EBX: context size. |
| 1327 __ movl(EBX, Immediate(context_size)); |
| 1328 // EDX: Clobbered. |
| 1329 __ UpdateAllocationStatsWithSize(kContextCid, EBX, EDX); |
| 1330 } |
| 1331 // The closure allocation is attributed to the signature class. |
| 1332 // EDX: Will be clobbered. |
| 1333 __ UpdateAllocationStats(cls.id(), EDX); |
1314 | 1334 |
1315 // EAX: new closure object. | 1335 // EAX: new closure object. |
1316 // ECX: new context object (only if is_implicit_closure). | 1336 // ECX: new context object (only if is_implicit_closure). |
1317 // Set the tags. | 1337 // Set the tags. |
1318 uword tags = 0; | 1338 uword tags = 0; |
1319 tags = RawObject::SizeTag::update(closure_size, tags); | 1339 tags = RawObject::SizeTag::update(closure_size, tags); |
1320 tags = RawObject::ClassIdTag::update(cls.id(), tags); | 1340 tags = RawObject::ClassIdTag::update(cls.id(), tags); |
1321 __ movl(Address(EAX, Instance::tags_offset()), Immediate(tags)); | 1341 __ movl(Address(EAX, Instance::tags_offset()), Immediate(tags)); |
1322 | 1342 |
1323 // Initialize the function field in the object. | 1343 // Initialize the function field in the object. |
1324 // EAX: new closure object. | 1344 // EAX: new closure object. |
1325 // ECX: new context object (only if is_implicit_closure). | 1345 // ECX: new context object (only if is_implicit_closure). |
1326 // EBX: next object start. | |
1327 __ LoadObject(EDX, func); // Load function of closure to be allocated. | 1346 __ LoadObject(EDX, func); // Load function of closure to be allocated. |
1328 __ movl(Address(EAX, Closure::function_offset()), EDX); | 1347 __ movl(Address(EAX, Closure::function_offset()), EDX); |
1329 | 1348 |
1330 // Setup the context for this closure. | 1349 // Setup the context for this closure. |
1331 if (is_implicit_instance_closure) { | 1350 if (is_implicit_instance_closure) { |
1332 // Initialize the new context capturing the receiver. | 1351 // Initialize the new context capturing the receiver. |
1333 const Class& context_class = Class::ZoneHandle(Object::context_class()); | 1352 const Class& context_class = Class::ZoneHandle(Object::context_class()); |
1334 // Set the tags. | 1353 // Set the tags. |
1335 uword tags = 0; | 1354 uword tags = 0; |
1336 tags = RawObject::SizeTag::update(context_size, tags); | 1355 tags = RawObject::SizeTag::update(context_size, tags); |
(...skipping 813 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2150 const Register temp = ECX; | 2169 const Register temp = ECX; |
2151 __ movl(left, Address(ESP, 2 * kWordSize)); | 2170 __ movl(left, Address(ESP, 2 * kWordSize)); |
2152 __ movl(right, Address(ESP, 1 * kWordSize)); | 2171 __ movl(right, Address(ESP, 1 * kWordSize)); |
2153 GenerateIdenticalWithNumberCheckStub(assembler, left, right, temp); | 2172 GenerateIdenticalWithNumberCheckStub(assembler, left, right, temp); |
2154 __ ret(); | 2173 __ ret(); |
2155 } | 2174 } |
2156 | 2175 |
2157 } // namespace dart | 2176 } // namespace dart |
2158 | 2177 |
2159 #endif // defined TARGET_ARCH_IA32 | 2178 #endif // defined TARGET_ARCH_IA32 |
OLD | NEW |