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 521 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
532 } | 532 } |
533 | 533 |
534 | 534 |
535 // Called for inline allocation of arrays. | 535 // Called for inline allocation of arrays. |
536 // Input parameters: | 536 // Input parameters: |
537 // EDX : Array length as Smi. | 537 // EDX : Array length as Smi. |
538 // ECX : array element type (either NULL or an instantiated type). | 538 // ECX : array element type (either NULL or an instantiated type). |
539 // Uses EAX, EBX, ECX, EDI as temporary registers. | 539 // Uses EAX, EBX, ECX, EDI as temporary registers. |
540 // NOTE: EDX cannot be clobbered here as the caller relies on it being saved. | 540 // NOTE: EDX cannot be clobbered here as the caller relies on it being saved. |
541 // The newly allocated object is returned in EAX. | 541 // The newly allocated object is returned in EAX. |
542 void StubCode::GenerateAllocateArrayStub(Assembler* assembler) { | 542 void StubCode::GenerateAllocateArrayStub(Assembler* assembler) { |
Florian Schneider
2013/11/13 18:06:53
Also count allocation for arrays?
Cutch
2013/11/13 19:09:34
Done.
| |
543 Label slow_case; | 543 Label slow_case; |
544 const Immediate& raw_null = | 544 const Immediate& raw_null = |
545 Immediate(reinterpret_cast<intptr_t>(Object::null())); | 545 Immediate(reinterpret_cast<intptr_t>(Object::null())); |
546 | 546 |
547 if (FLAG_inline_alloc) { | 547 if (FLAG_inline_alloc) { |
548 // Compute the size to be allocated, it is based on the array length | 548 // Compute the size to be allocated, it is based on the array length |
549 // and is computed as: | 549 // and is computed as: |
550 // RoundedAllocationSize((array_length * kwordSize) + sizeof(RawArray)). | 550 // RoundedAllocationSize((array_length * kwordSize) + sizeof(RawArray)). |
551 // Assert that length is a Smi. | 551 // Assert that length is a Smi. |
552 __ testl(EDX, Immediate(kSmiTagMask)); | 552 __ testl(EDX, Immediate(kSmiTagMask)); |
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
888 __ ret(); | 888 __ ret(); |
889 } | 889 } |
890 | 890 |
891 | 891 |
892 // Called for inline allocation of contexts. | 892 // Called for inline allocation of contexts. |
893 // Input: | 893 // Input: |
894 // EDX: number of context variables. | 894 // EDX: number of context variables. |
895 // Output: | 895 // Output: |
896 // EAX: new allocated RawContext object. | 896 // EAX: new allocated RawContext object. |
897 // EBX and EDX are destroyed. | 897 // EBX and EDX are destroyed. |
898 void StubCode::GenerateAllocateContextStub(Assembler* assembler) { | 898 void StubCode::GenerateAllocateContextStub(Assembler* assembler) { |
Florian Schneider
2013/11/13 18:06:53
Also count allocations of contexts?
Cutch
2013/11/13 19:09:34
Done.
| |
899 const Immediate& raw_null = | 899 const Immediate& raw_null = |
900 Immediate(reinterpret_cast<intptr_t>(Object::null())); | 900 Immediate(reinterpret_cast<intptr_t>(Object::null())); |
901 if (FLAG_inline_alloc) { | 901 if (FLAG_inline_alloc) { |
902 const Class& context_class = Class::ZoneHandle(Object::context_class()); | 902 const Class& context_class = Class::ZoneHandle(Object::context_class()); |
903 Label slow_case; | 903 Label slow_case; |
904 Heap* heap = Isolate::Current()->heap(); | 904 Heap* heap = Isolate::Current()->heap(); |
905 // First compute the rounded instance size. | 905 // First compute the rounded instance size. |
906 // EDX: number of context variables. | 906 // EDX: number of context variables. |
907 intptr_t fixed_size = (sizeof(RawContext) + kObjectAlignment - 1); | 907 intptr_t fixed_size = (sizeof(RawContext) + kObjectAlignment - 1); |
908 __ leal(EBX, Address(EDX, TIMES_4, fixed_size)); | 908 __ leal(EBX, Address(EDX, TIMES_4, fixed_size)); |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1124 // ECX: potential new object end and, if ECX != EBX, potential new | 1124 // ECX: potential new object end and, if ECX != EBX, potential new |
1125 // InstantiatedTypeArguments object start. | 1125 // InstantiatedTypeArguments object start. |
1126 } | 1126 } |
1127 // Check if the allocation fits into the remaining space. | 1127 // Check if the allocation fits into the remaining space. |
1128 // EAX: potential new object start. | 1128 // EAX: potential new object start. |
1129 // EBX: potential next object start. | 1129 // EBX: potential next object start. |
1130 __ cmpl(EBX, Address::Absolute(heap->EndAddress())); | 1130 __ cmpl(EBX, Address::Absolute(heap->EndAddress())); |
1131 if (FLAG_use_slow_path) { | 1131 if (FLAG_use_slow_path) { |
1132 __ jmp(&slow_case); | 1132 __ jmp(&slow_case); |
1133 } else { | 1133 } else { |
1134 __ j(ABOVE_EQUAL, &slow_case, Assembler::kNearJump); | 1134 __ j(ABOVE_EQUAL, &slow_case); |
1135 } | 1135 } |
1136 | 1136 |
1137 // Successfully allocated the object(s), now update top to point to | 1137 // Successfully allocated the object(s), now update top to point to |
1138 // next object start and initialize the object. | 1138 // next object start and initialize the object. |
1139 __ movl(Address::Absolute(heap->TopAddress()), EBX); | 1139 __ movl(Address::Absolute(heap->TopAddress()), EBX); |
1140 __ BumpAllocationCount(Heap::kNew, cls.id(), EDI); | |
1140 | 1141 |
1141 if (is_cls_parameterized) { | 1142 if (is_cls_parameterized) { |
1142 // Initialize the type arguments field in the object. | 1143 // Initialize the type arguments field in the object. |
1143 // EAX: new object start. | 1144 // EAX: new object start. |
1144 // ECX: potential new object end and, if ECX != EBX, potential new | 1145 // ECX: potential new object end and, if ECX != EBX, potential new |
1145 // InstantiatedTypeArguments object start. | 1146 // InstantiatedTypeArguments object start. |
1146 // EBX: next object start. | 1147 // EBX: next object start. |
1147 Label type_arguments_ready; | 1148 Label type_arguments_ready; |
1148 __ movl(EDI, Address(ESP, kObjectTypeArgumentsOffset)); | 1149 __ movl(EDI, Address(ESP, kObjectTypeArgumentsOffset)); |
1149 __ cmpl(ECX, EBX); | 1150 __ cmpl(ECX, EBX); |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1256 __ ret(); | 1257 __ ret(); |
1257 } | 1258 } |
1258 | 1259 |
1259 | 1260 |
1260 // Called for inline allocation of closures. | 1261 // Called for inline allocation of closures. |
1261 // Input parameters: | 1262 // Input parameters: |
1262 // ESP + 8 : receiver (null if not an implicit instance closure). | 1263 // ESP + 8 : receiver (null if not an implicit instance closure). |
1263 // ESP + 4 : type arguments object (null if class is no parameterized). | 1264 // ESP + 4 : type arguments object (null if class is no parameterized). |
1264 // ESP : points to return address. | 1265 // ESP : points to return address. |
1265 // Uses EAX, EBX, ECX, EDX as temporary registers. | 1266 // Uses EAX, EBX, ECX, EDX as temporary registers. |
1266 void StubCode::GenerateAllocationStubForClosure(Assembler* assembler, | 1267 void StubCode::GenerateAllocationStubForClosure(Assembler* assembler, |
Florian Schneider
2013/11/13 18:06:53
Also count allocation for closures?
Cutch
2013/11/13 19:09:34
Done.
| |
1267 const Function& func) { | 1268 const Function& func) { |
1268 const Immediate& raw_null = | 1269 const Immediate& raw_null = |
1269 Immediate(reinterpret_cast<intptr_t>(Object::null())); | 1270 Immediate(reinterpret_cast<intptr_t>(Object::null())); |
1270 ASSERT(func.IsClosureFunction()); | 1271 ASSERT(func.IsClosureFunction()); |
1271 ASSERT(!func.IsImplicitStaticClosureFunction()); | 1272 ASSERT(!func.IsImplicitStaticClosureFunction()); |
1272 const bool is_implicit_instance_closure = | 1273 const bool is_implicit_instance_closure = |
1273 func.IsImplicitInstanceClosureFunction(); | 1274 func.IsImplicitInstanceClosureFunction(); |
1274 const Class& cls = Class::ZoneHandle(func.signature_class()); | 1275 const Class& cls = Class::ZoneHandle(func.signature_class()); |
1275 const bool has_type_arguments = cls.NumTypeArguments() > 0; | 1276 const bool has_type_arguments = cls.NumTypeArguments() > 0; |
1276 const intptr_t kTypeArgumentsOffset = 1 * kWordSize; | 1277 const intptr_t kTypeArgumentsOffset = 1 * kWordSize; |
(...skipping 923 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2200 const Register temp = ECX; | 2201 const Register temp = ECX; |
2201 __ movl(left, Address(ESP, 2 * kWordSize)); | 2202 __ movl(left, Address(ESP, 2 * kWordSize)); |
2202 __ movl(right, Address(ESP, 1 * kWordSize)); | 2203 __ movl(right, Address(ESP, 1 * kWordSize)); |
2203 GenerateIdenticalWithNumberCheckStub(assembler, left, right, temp); | 2204 GenerateIdenticalWithNumberCheckStub(assembler, left, right, temp); |
2204 __ ret(); | 2205 __ ret(); |
2205 } | 2206 } |
2206 | 2207 |
2207 } // namespace dart | 2208 } // namespace dart |
2208 | 2209 |
2209 #endif // defined TARGET_ARCH_IA32 | 2210 #endif // defined TARGET_ARCH_IA32 |
OLD | NEW |