| 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 // 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 22 matching lines...) Expand all Loading... |
| 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 is 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 // Check that length is a positive Smi. | 42 // Check that length is a positive Smi. |
| 43 __ testl(EDI, Immediate(kSmiTagSize)); | 43 __ testl(EDI, Immediate(kSmiTagMask)); |
| 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 // Check for maximum allowed length. | 47 // Check for maximum allowed length. |
| 48 const Immediate& max_len = | 48 const Immediate& max_len = |
| 49 Immediate(reinterpret_cast<int32_t>(Smi::New(Array::kMaxElements))); | 49 Immediate(reinterpret_cast<int32_t>(Smi::New(Array::kMaxElements))); |
| 50 __ cmpl(EDI, max_len); | 50 __ cmpl(EDI, max_len); |
| 51 __ j(GREATER, &fall_through); | 51 __ j(GREATER, &fall_through); |
| 52 const intptr_t fixed_size = sizeof(RawArray) + kObjectAlignment - 1; | 52 const intptr_t fixed_size = sizeof(RawArray) + kObjectAlignment - 1; |
| 53 __ leal(EDI, Address(EDI, TIMES_2, fixed_size)); // EDI is a Smi. | 53 __ leal(EDI, Address(EDI, TIMES_2, fixed_size)); // EDI is a Smi. |
| (...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 457 return false; | 457 return false; |
| 458 } | 458 } |
| 459 | 459 |
| 460 | 460 |
| 461 #define TYPED_ARRAY_ALLOCATION(type_name, cid, max_len, scale_factor) \ | 461 #define TYPED_ARRAY_ALLOCATION(type_name, cid, max_len, scale_factor) \ |
| 462 Label fall_through; \ | 462 Label fall_through; \ |
| 463 const intptr_t kArrayLengthStackOffset = 1 * kWordSize; \ | 463 const intptr_t kArrayLengthStackOffset = 1 * kWordSize; \ |
| 464 __ movl(EDI, Address(ESP, kArrayLengthStackOffset)); /* Array length. */ \ | 464 __ movl(EDI, Address(ESP, kArrayLengthStackOffset)); /* Array length. */ \ |
| 465 /* Check that length is a positive Smi. */ \ | 465 /* Check that length is a positive Smi. */ \ |
| 466 /* EDI: requested array length argument. */ \ | 466 /* EDI: requested array length argument. */ \ |
| 467 __ testl(EDI, Immediate(kSmiTagSize)); \ | 467 __ testl(EDI, Immediate(kSmiTagMask)); \ |
| 468 __ j(NOT_ZERO, &fall_through); \ | 468 __ j(NOT_ZERO, &fall_through); \ |
| 469 __ cmpl(EDI, Immediate(0)); \ | 469 __ cmpl(EDI, Immediate(0)); \ |
| 470 __ j(LESS, &fall_through); \ | 470 __ j(LESS, &fall_through); \ |
| 471 __ SmiUntag(EDI); \ | 471 __ SmiUntag(EDI); \ |
| 472 /* Check for maximum allowed length. */ \ | 472 /* Check for maximum allowed length. */ \ |
| 473 /* EDI: untagged array length. */ \ | 473 /* EDI: untagged array length. */ \ |
| 474 __ cmpl(EDI, Immediate(max_len)); \ | 474 __ cmpl(EDI, Immediate(max_len)); \ |
| 475 __ j(GREATER, &fall_through); \ | 475 __ j(GREATER, &fall_through); \ |
| 476 /* Special case for scaling by 16. */ \ | 476 /* Special case for scaling by 16. */ \ |
| 477 if (scale_factor == TIMES_16) { \ | 477 if (scale_factor == TIMES_16) { \ |
| (...skipping 1128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1606 __ j(LESS, &loop, Assembler::kNearJump); | 1606 __ j(LESS, &loop, Assembler::kNearJump); |
| 1607 __ ret(); | 1607 __ ret(); |
| 1608 __ Bind(&fall_through); | 1608 __ Bind(&fall_through); |
| 1609 return false; | 1609 return false; |
| 1610 } | 1610 } |
| 1611 | 1611 |
| 1612 #undef __ | 1612 #undef __ |
| 1613 } // namespace dart | 1613 } // namespace dart |
| 1614 | 1614 |
| 1615 #endif // defined TARGET_ARCH_IA32 | 1615 #endif // defined TARGET_ARCH_IA32 |
| OLD | NEW |