| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 // The intrinsic code below is executed before a method has built its frame. | 5 // The intrinsic code below is executed before a method has built its frame. |
| 6 // The return address is on the stack and the arguments below it. | 6 // The return address is on the stack and the arguments below it. |
| 7 // Registers EDX (arguments descriptor) and ECX (function) must be preserved. | 7 // Registers EDX (arguments descriptor) and ECX (function) must be preserved. |
| 8 // Each intrinsification method returns true if the corresponding | 8 // Each intrinsification method returns true if the corresponding |
| 9 // Dart method was intrinsified. | 9 // Dart method was intrinsified. |
| 10 | 10 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 | 29 |
| 30 bool Intrinsifier::ObjectArray_Allocate(Assembler* assembler) { | 30 bool Intrinsifier::ObjectArray_Allocate(Assembler* assembler) { |
| 31 // This snippet of inlined code uses the following registers: | 31 // This snippet of inlined code uses the following registers: |
| 32 // EAX, EBX, EDI | 32 // EAX, EBX, EDI |
| 33 // and the newly allocated object is returned in EAX. | 33 // and the newly allocated object is returned in EAX. |
| 34 const intptr_t kTypeArgumentsOffset = 2 * kWordSize; | 34 const intptr_t kTypeArgumentsOffset = 2 * kWordSize; |
| 35 const intptr_t kArrayLengthOffset = 1 * kWordSize; | 35 const intptr_t kArrayLengthOffset = 1 * kWordSize; |
| 36 Label fall_through; | 36 Label fall_through; |
| 37 | 37 |
| 38 // Compute the size to be allocated, it is based on the array length | 38 // Compute the size to be allocated, it is based on the array length |
| 39 // and it computed as: | 39 // and is computed as: |
| 40 // RoundedAllocationSize((array_length * kwordSize) + sizeof(RawArray)). | 40 // RoundedAllocationSize((array_length * kwordSize) + sizeof(RawArray)). |
| 41 __ movl(EDI, Address(ESP, kArrayLengthOffset)); // Array Length. | 41 __ movl(EDI, Address(ESP, kArrayLengthOffset)); // Array Length. |
| 42 // Assert that length is a Smi. | 42 // Assert that length is a Smi. |
| 43 __ testl(EDI, Immediate(kSmiTagSize)); | 43 __ testl(EDI, Immediate(kSmiTagSize)); |
| 44 __ j(NOT_ZERO, &fall_through); | 44 __ j(NOT_ZERO, &fall_through); |
| 45 __ cmpl(EDI, Immediate(0)); | 45 __ cmpl(EDI, Immediate(0)); |
| 46 __ j(LESS, &fall_through); | 46 __ j(LESS, &fall_through); |
| 47 intptr_t fixed_size = sizeof(RawArray) + kObjectAlignment - 1; | 47 intptr_t fixed_size = sizeof(RawArray) + kObjectAlignment - 1; |
| 48 __ leal(EDI, Address(EDI, TIMES_2, fixed_size)); // EDI is a Smi. | 48 __ leal(EDI, Address(EDI, TIMES_2, fixed_size)); // EDI is a Smi. |
| 49 ASSERT(kSmiTagShift == 1); | 49 ASSERT(kSmiTagShift == 1); |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 255 // On stack: type argument (+2), data (+1), return-address (+0). | 255 // On stack: type argument (+2), data (+1), return-address (+0). |
| 256 bool Intrinsifier::GArray_Allocate(Assembler* assembler) { | 256 bool Intrinsifier::GArray_Allocate(Assembler* assembler) { |
| 257 // This snippet of inlined code uses the following registers: | 257 // This snippet of inlined code uses the following registers: |
| 258 // EAX, EBX | 258 // EAX, EBX |
| 259 // and the newly allocated object is returned in EAX. | 259 // and the newly allocated object is returned in EAX. |
| 260 const intptr_t kTypeArgumentsOffset = 2 * kWordSize; | 260 const intptr_t kTypeArgumentsOffset = 2 * kWordSize; |
| 261 const intptr_t kArrayOffset = 1 * kWordSize; | 261 const intptr_t kArrayOffset = 1 * kWordSize; |
| 262 Label fall_through; | 262 Label fall_through; |
| 263 | 263 |
| 264 // Compute the size to be allocated, it is based on the array length | 264 // Compute the size to be allocated, it is based on the array length |
| 265 // and it computed as: | 265 // and is computed as: |
| 266 // RoundedAllocationSize(sizeof(RawGrowableObjectArray)) + | 266 // RoundedAllocationSize(sizeof(RawGrowableObjectArray)) + |
| 267 intptr_t fixed_size = GrowableObjectArray::InstanceSize(); | 267 intptr_t fixed_size = GrowableObjectArray::InstanceSize(); |
| 268 | 268 |
| 269 Isolate* isolate = Isolate::Current(); | 269 Isolate* isolate = Isolate::Current(); |
| 270 Heap* heap = isolate->heap(); | 270 Heap* heap = isolate->heap(); |
| 271 | 271 |
| 272 __ movl(EAX, Address::Absolute(heap->TopAddress())); | 272 __ movl(EAX, Address::Absolute(heap->TopAddress())); |
| 273 __ leal(EBX, Address(EAX, fixed_size)); | 273 __ leal(EBX, Address(EAX, fixed_size)); |
| 274 | 274 |
| 275 // Check if the allocation fits into the remaining space. | 275 // Check if the allocation fits into the remaining space. |
| (...skipping 1088 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1364 __ Bind(&is_true); | 1364 __ Bind(&is_true); |
| 1365 __ LoadObject(EAX, bool_true); | 1365 __ LoadObject(EAX, bool_true); |
| 1366 __ ret(); | 1366 __ ret(); |
| 1367 return true; | 1367 return true; |
| 1368 } | 1368 } |
| 1369 | 1369 |
| 1370 #undef __ | 1370 #undef __ |
| 1371 } // namespace dart | 1371 } // namespace dart |
| 1372 | 1372 |
| 1373 #endif // defined TARGET_ARCH_IA32 | 1373 #endif // defined TARGET_ARCH_IA32 |
| OLD | NEW |