| 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 464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 475 /* EDI: requested array length argument. */ \ | 475 /* EDI: requested array length argument. */ \ |
| 476 __ testl(EDI, Immediate(kSmiTagSize)); \ | 476 __ testl(EDI, Immediate(kSmiTagSize)); \ |
| 477 __ j(NOT_ZERO, &fall_through); \ | 477 __ j(NOT_ZERO, &fall_through); \ |
| 478 __ cmpl(EDI, Immediate(0)); \ | 478 __ cmpl(EDI, Immediate(0)); \ |
| 479 __ j(LESS, &fall_through); \ | 479 __ j(LESS, &fall_through); \ |
| 480 __ SmiUntag(EDI); \ | 480 __ SmiUntag(EDI); \ |
| 481 /* Check for maximum allowed length. */ \ | 481 /* Check for maximum allowed length. */ \ |
| 482 /* EDI: untagged array length. */ \ | 482 /* EDI: untagged array length. */ \ |
| 483 __ cmpl(EDI, Immediate(max_len)); \ | 483 __ cmpl(EDI, Immediate(max_len)); \ |
| 484 __ j(GREATER, &fall_through); \ | 484 __ j(GREATER, &fall_through); \ |
| 485 /* Special case for scaling by 16. */ \ |
| 486 if (scale_factor == TIMES_16) { \ |
| 487 /* double length of array. */ \ |
| 488 __ addl(EDI, EDI); \ |
| 489 /* only scale by 8. */ \ |
| 490 scale_factor = TIMES_8; \ |
| 491 } \ |
| 485 const intptr_t fixed_size = sizeof(Raw##type_name) + kObjectAlignment - 1; \ | 492 const intptr_t fixed_size = sizeof(Raw##type_name) + kObjectAlignment - 1; \ |
| 486 __ leal(EDI, Address(EDI, scale_factor, fixed_size)); \ | 493 __ leal(EDI, Address(EDI, scale_factor, fixed_size)); \ |
| 487 __ andl(EDI, Immediate(-kObjectAlignment)); \ | 494 __ andl(EDI, Immediate(-kObjectAlignment)); \ |
| 488 Heap* heap = Isolate::Current()->heap(); \ | 495 Heap* heap = Isolate::Current()->heap(); \ |
| 489 \ | 496 \ |
| 490 __ movl(EAX, Address::Absolute(heap->TopAddress())); \ | 497 __ movl(EAX, Address::Absolute(heap->TopAddress())); \ |
| 491 __ movl(EBX, EAX); \ | 498 __ movl(EBX, EAX); \ |
| 492 \ | 499 \ |
| 493 /* EDI: allocation size. */ \ | 500 /* EDI: allocation size. */ \ |
| 494 __ addl(EBX, EDI); \ | 501 __ addl(EBX, EDI); \ |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 546 __ j(ABOVE_EQUAL, &done, Assembler::kNearJump); \ | 553 __ j(ABOVE_EQUAL, &done, Assembler::kNearJump); \ |
| 547 __ movl(Address(EDI, 0), ECX); \ | 554 __ movl(Address(EDI, 0), ECX); \ |
| 548 __ addl(EDI, Immediate(kWordSize)); \ | 555 __ addl(EDI, Immediate(kWordSize)); \ |
| 549 __ jmp(&init_loop, Assembler::kNearJump); \ | 556 __ jmp(&init_loop, Assembler::kNearJump); \ |
| 550 __ Bind(&done); \ | 557 __ Bind(&done); \ |
| 551 \ | 558 \ |
| 552 __ ret(); \ | 559 __ ret(); \ |
| 553 __ Bind(&fall_through); \ | 560 __ Bind(&fall_through); \ |
| 554 | 561 |
| 555 | 562 |
| 556 #define SCALARLIST_ALLOCATOR(clazz, scale) \ | 563 #define SCALARLIST_ALLOCATOR(clazz, scale_) \ |
| 557 bool Intrinsifier::clazz##_new(Assembler* assembler) { \ | 564 bool Intrinsifier::clazz##_new(Assembler* assembler) { \ |
| 565 ScaleFactor scale = scale_; \ |
| 558 TYPED_ARRAY_ALLOCATION(clazz, k##clazz##Cid, clazz::kMaxElements, scale); \ | 566 TYPED_ARRAY_ALLOCATION(clazz, k##clazz##Cid, clazz::kMaxElements, scale); \ |
| 559 return false; \ | 567 return false; \ |
| 560 } \ | 568 } \ |
| 561 bool Intrinsifier::clazz##_factory(Assembler* assembler) { \ | 569 bool Intrinsifier::clazz##_factory(Assembler* assembler) { \ |
| 570 ScaleFactor scale = scale_; \ |
| 562 TYPED_ARRAY_ALLOCATION(clazz, k##clazz##Cid, clazz::kMaxElements, scale); \ | 571 TYPED_ARRAY_ALLOCATION(clazz, k##clazz##Cid, clazz::kMaxElements, scale); \ |
| 563 return false; \ | 572 return false; \ |
| 564 } | 573 } |
| 565 | 574 |
| 566 | 575 |
| 567 SCALARLIST_ALLOCATOR(Int8Array, TIMES_1) | 576 SCALARLIST_ALLOCATOR(Int8Array, TIMES_1) |
| 568 SCALARLIST_ALLOCATOR(Uint8Array, TIMES_1) | 577 SCALARLIST_ALLOCATOR(Uint8Array, TIMES_1) |
| 569 SCALARLIST_ALLOCATOR(Uint8ClampedArray, TIMES_1) | 578 SCALARLIST_ALLOCATOR(Uint8ClampedArray, TIMES_1) |
| 570 SCALARLIST_ALLOCATOR(Int16Array, TIMES_2) | 579 SCALARLIST_ALLOCATOR(Int16Array, TIMES_2) |
| 571 SCALARLIST_ALLOCATOR(Uint16Array, TIMES_2) | 580 SCALARLIST_ALLOCATOR(Uint16Array, TIMES_2) |
| (...skipping 23 matching lines...) Expand all Loading... |
| 595 return true; | 604 return true; |
| 596 } | 605 } |
| 597 | 606 |
| 598 | 607 |
| 599 static ScaleFactor GetScaleFactor(intptr_t size) { | 608 static ScaleFactor GetScaleFactor(intptr_t size) { |
| 600 switch (size) { | 609 switch (size) { |
| 601 case 1: return TIMES_1; | 610 case 1: return TIMES_1; |
| 602 case 2: return TIMES_2; | 611 case 2: return TIMES_2; |
| 603 case 4: return TIMES_4; | 612 case 4: return TIMES_4; |
| 604 case 8: return TIMES_8; | 613 case 8: return TIMES_8; |
| 614 case 16: return TIMES_16; |
| 605 } | 615 } |
| 606 UNREACHABLE(); | 616 UNREACHABLE(); |
| 607 return static_cast<ScaleFactor>(0); | 617 return static_cast<ScaleFactor>(0); |
| 608 }; | 618 }; |
| 609 | 619 |
| 610 | 620 |
| 611 #define TYPEDDATA_ALLOCATOR(clazz) \ | 621 #define TYPEDDATA_ALLOCATOR(clazz) \ |
| 612 bool Intrinsifier::TypedData_##clazz##_new(Assembler* assembler) { \ | 622 bool Intrinsifier::TypedData_##clazz##_new(Assembler* assembler) { \ |
| 613 intptr_t size = TypedData::ElementSizeInBytes(kTypedData##clazz##Cid); \ | 623 intptr_t size = TypedData::ElementSizeInBytes(kTypedData##clazz##Cid); \ |
| 614 intptr_t max_len = TypedData::MaxElements(kTypedData##clazz##Cid); \ | 624 intptr_t max_len = TypedData::MaxElements(kTypedData##clazz##Cid); \ |
| (...skipping 914 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1529 __ SmiTag(EAX); | 1539 __ SmiTag(EAX); |
| 1530 __ movl(FieldAddress(EBX, String::hash_offset()), EAX); | 1540 __ movl(FieldAddress(EBX, String::hash_offset()), EAX); |
| 1531 __ ret(); | 1541 __ ret(); |
| 1532 return true; | 1542 return true; |
| 1533 } | 1543 } |
| 1534 | 1544 |
| 1535 #undef __ | 1545 #undef __ |
| 1536 } // namespace dart | 1546 } // namespace dart |
| 1537 | 1547 |
| 1538 #endif // defined TARGET_ARCH_IA32 | 1548 #endif // defined TARGET_ARCH_IA32 |
| OLD | NEW |