| 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 23 matching lines...) Expand all Loading... |
| 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 it 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, Assembler::kNearJump); | 44 __ j(NOT_ZERO, &fall_through); |
| 45 __ cmpl(EDI, Immediate(0)); | 45 __ cmpl(EDI, Immediate(0)); |
| 46 __ j(LESS, &fall_through, Assembler::kNearJump); | 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); |
| 50 __ andl(EDI, Immediate(-kObjectAlignment)); | 50 __ andl(EDI, Immediate(-kObjectAlignment)); |
| 51 | 51 |
| 52 Isolate* isolate = Isolate::Current(); | 52 Isolate* isolate = Isolate::Current(); |
| 53 Heap* heap = isolate->heap(); | 53 Heap* heap = isolate->heap(); |
| 54 | 54 |
| 55 // EDI: allocation size. | 55 // EDI: allocation size. |
| 56 __ movl(EAX, Address::Absolute(heap->TopAddress())); | 56 __ movl(EAX, Address::Absolute(heap->TopAddress())); |
| 57 __ leal(EBX, Address(EAX, EDI, TIMES_1, 0)); | 57 __ leal(EBX, Address(EAX, EDI, TIMES_1, 0)); |
| 58 | 58 |
| 59 // Check if the allocation fits into the remaining space. | 59 // Check if the allocation fits into the remaining space. |
| 60 // EAX: potential new object start. | 60 // EAX: potential new object start. |
| 61 // EBX: potential next object start. | 61 // EBX: potential next object start. |
| 62 // EDI: allocation size. | 62 // EDI: allocation size. |
| 63 __ cmpl(EBX, Address::Absolute(heap->EndAddress())); | 63 __ cmpl(EBX, Address::Absolute(heap->EndAddress())); |
| 64 __ j(ABOVE_EQUAL, &fall_through, Assembler::kNearJump); | 64 __ j(ABOVE_EQUAL, &fall_through); |
| 65 | 65 |
| 66 // Successfully allocated the object(s), now update top to point to | 66 // Successfully allocated the object(s), now update top to point to |
| 67 // next object start and initialize the object. | 67 // next object start and initialize the object. |
| 68 __ movl(Address::Absolute(heap->TopAddress()), EBX); | 68 __ movl(Address::Absolute(heap->TopAddress()), EBX); |
| 69 __ addl(EAX, Immediate(kHeapObjectTag)); | 69 __ addl(EAX, Immediate(kHeapObjectTag)); |
| 70 | 70 |
| 71 // Initialize the tags. | 71 // Initialize the tags. |
| 72 // EAX: new object start as a tagged pointer. | 72 // EAX: new object start as a tagged pointer. |
| 73 // EBX: new object end address. | 73 // EBX: new object end address. |
| 74 // EDI: allocation size. | 74 // EDI: allocation size. |
| (...skipping 1276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1351 __ Bind(&is_true); | 1351 __ Bind(&is_true); |
| 1352 __ LoadObject(EAX, bool_true); | 1352 __ LoadObject(EAX, bool_true); |
| 1353 __ ret(); | 1353 __ ret(); |
| 1354 return true; | 1354 return true; |
| 1355 } | 1355 } |
| 1356 | 1356 |
| 1357 #undef __ | 1357 #undef __ |
| 1358 } // namespace dart | 1358 } // namespace dart |
| 1359 | 1359 |
| 1360 #endif // defined TARGET_ARCH_IA32 | 1360 #endif // defined TARGET_ARCH_IA32 |
| OLD | NEW |