| 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 27 matching lines...) Expand all Loading... |
| 38 | 38 |
| 39 // Compute the size to be allocated, it is based on the array length | 39 // Compute the size to be allocated, it is based on the array length |
| 40 // and is computed as: | 40 // and is computed as: |
| 41 // RoundedAllocationSize((array_length * kwordSize) + sizeof(RawArray)). | 41 // RoundedAllocationSize((array_length * kwordSize) + sizeof(RawArray)). |
| 42 __ movl(EDI, Address(ESP, kArrayLengthOffset)); // Array Length. | 42 __ movl(EDI, Address(ESP, kArrayLengthOffset)); // Array Length. |
| 43 // Assert that length is a Smi. | 43 // Assert that length is a Smi. |
| 44 __ testl(EDI, Immediate(kSmiTagSize)); | 44 __ testl(EDI, Immediate(kSmiTagSize)); |
| 45 __ j(NOT_ZERO, &fall_through); | 45 __ j(NOT_ZERO, &fall_through); |
| 46 __ cmpl(EDI, Immediate(0)); | 46 __ cmpl(EDI, Immediate(0)); |
| 47 __ j(LESS, &fall_through); | 47 __ j(LESS, &fall_through); |
| 48 // Check for maximum allowed length. |
| 49 const Immediate max_len = |
| 50 Immediate(reinterpret_cast<int32_t>(Smi::New(Array::kMaxElements))); |
| 51 __ cmpl(EDI, max_len); |
| 52 __ j(GREATER, &fall_through); |
| 48 intptr_t fixed_size = sizeof(RawArray) + kObjectAlignment - 1; | 53 intptr_t fixed_size = sizeof(RawArray) + kObjectAlignment - 1; |
| 49 __ leal(EDI, Address(EDI, TIMES_2, fixed_size)); // EDI is a Smi. | 54 __ leal(EDI, Address(EDI, TIMES_2, fixed_size)); // EDI is a Smi. |
| 50 ASSERT(kSmiTagShift == 1); | 55 ASSERT(kSmiTagShift == 1); |
| 51 __ andl(EDI, Immediate(-kObjectAlignment)); | 56 __ andl(EDI, Immediate(-kObjectAlignment)); |
| 52 | 57 |
| 53 Isolate* isolate = Isolate::Current(); | 58 Isolate* isolate = Isolate::Current(); |
| 54 Heap* heap = isolate->heap(); | 59 Heap* heap = isolate->heap(); |
| 55 | 60 |
| 56 // EDI: allocation size. | 61 // EDI: allocation size. |
| 57 __ movl(EAX, Address::Absolute(heap->TopAddress())); | 62 __ movl(EAX, Address::Absolute(heap->TopAddress())); |
| (...skipping 1343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1401 __ Bind(&is_true); | 1406 __ Bind(&is_true); |
| 1402 __ LoadObject(EAX, bool_true); | 1407 __ LoadObject(EAX, bool_true); |
| 1403 __ ret(); | 1408 __ ret(); |
| 1404 return true; | 1409 return true; |
| 1405 } | 1410 } |
| 1406 | 1411 |
| 1407 #undef __ | 1412 #undef __ |
| 1408 } // namespace dart | 1413 } // namespace dart |
| 1409 | 1414 |
| 1410 #endif // defined TARGET_ARCH_IA32 | 1415 #endif // defined TARGET_ARCH_IA32 |
| OLD | NEW |