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 556 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
567 case 2: return TIMES_2; | 567 case 2: return TIMES_2; |
568 case 4: return TIMES_4; | 568 case 4: return TIMES_4; |
569 case 8: return TIMES_8; | 569 case 8: return TIMES_8; |
570 case 16: return TIMES_16; | 570 case 16: return TIMES_16; |
571 } | 571 } |
572 UNREACHABLE(); | 572 UNREACHABLE(); |
573 return static_cast<ScaleFactor>(0); | 573 return static_cast<ScaleFactor>(0); |
574 }; | 574 }; |
575 | 575 |
576 | 576 |
577 #define TYPEDDATA_ALLOCATOR(clazz) \ | 577 #define TYPED_DATA_ALLOCATOR(clazz) \ |
578 bool Intrinsifier::TypedData_##clazz##_new(Assembler* assembler) { \ | 578 bool Intrinsifier::TypedData_##clazz##_new(Assembler* assembler) { \ |
579 intptr_t size = TypedData::ElementSizeInBytes(kTypedData##clazz##Cid); \ | 579 intptr_t size = TypedData::ElementSizeInBytes(kTypedData##clazz##Cid); \ |
580 intptr_t max_len = TypedData::MaxElements(kTypedData##clazz##Cid); \ | 580 intptr_t max_len = TypedData::MaxElements(kTypedData##clazz##Cid); \ |
581 ScaleFactor scale = GetScaleFactor(size); \ | 581 ScaleFactor scale = GetScaleFactor(size); \ |
582 TYPED_ARRAY_ALLOCATION(TypedData, kTypedData##clazz##Cid, max_len, scale); \ | 582 TYPED_ARRAY_ALLOCATION(TypedData, kTypedData##clazz##Cid, max_len, scale); \ |
583 return false; \ | 583 return false; \ |
584 } \ | 584 } \ |
585 bool Intrinsifier::TypedData_##clazz##_factory(Assembler* assembler) { \ | 585 bool Intrinsifier::TypedData_##clazz##_factory(Assembler* assembler) { \ |
586 intptr_t size = TypedData::ElementSizeInBytes(kTypedData##clazz##Cid); \ | 586 intptr_t size = TypedData::ElementSizeInBytes(kTypedData##clazz##Cid); \ |
587 intptr_t max_len = TypedData::MaxElements(kTypedData##clazz##Cid); \ | 587 intptr_t max_len = TypedData::MaxElements(kTypedData##clazz##Cid); \ |
588 ScaleFactor scale = GetScaleFactor(size); \ | 588 ScaleFactor scale = GetScaleFactor(size); \ |
589 TYPED_ARRAY_ALLOCATION(TypedData, kTypedData##clazz##Cid, max_len, scale); \ | 589 TYPED_ARRAY_ALLOCATION(TypedData, kTypedData##clazz##Cid, max_len, scale); \ |
590 return false; \ | 590 return false; \ |
591 } | 591 } |
592 CLASS_LIST_TYPED_DATA(TYPEDDATA_ALLOCATOR) | 592 CLASS_LIST_TYPED_DATA(TYPED_DATA_ALLOCATOR) |
593 #undef TYPEDDATA_ALLOCATOR | 593 #undef TYPED_DATA_ALLOCATOR |
594 | 594 |
595 | 595 |
596 // Tests if two top most arguments are smis, jumps to label not_smi if not. | 596 // Tests if two top most arguments are smis, jumps to label not_smi if not. |
597 // Topmost argument is in EAX. | 597 // Topmost argument is in EAX. |
598 static void TestBothArgumentsSmis(Assembler* assembler, Label* not_smi) { | 598 static void TestBothArgumentsSmis(Assembler* assembler, Label* not_smi) { |
599 __ movl(EAX, Address(ESP, + 1 * kWordSize)); | 599 __ movl(EAX, Address(ESP, + 1 * kWordSize)); |
600 __ movl(EBX, Address(ESP, + 2 * kWordSize)); | 600 __ movl(EBX, Address(ESP, + 2 * kWordSize)); |
601 __ orl(EBX, EAX); | 601 __ orl(EBX, EAX); |
602 __ testl(EBX, Immediate(kSmiTagMask)); | 602 __ testl(EBX, Immediate(kSmiTagMask)); |
603 __ j(NOT_ZERO, not_smi, Assembler::kNearJump); | 603 __ j(NOT_ZERO, not_smi, Assembler::kNearJump); |
(...skipping 1074 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1678 __ j(LESS, &loop, Assembler::kNearJump); | 1678 __ j(LESS, &loop, Assembler::kNearJump); |
1679 __ ret(); | 1679 __ ret(); |
1680 __ Bind(&fall_through); | 1680 __ Bind(&fall_through); |
1681 return false; | 1681 return false; |
1682 } | 1682 } |
1683 | 1683 |
1684 #undef __ | 1684 #undef __ |
1685 } // namespace dart | 1685 } // namespace dart |
1686 | 1686 |
1687 #endif // defined TARGET_ARCH_IA32 | 1687 #endif // defined TARGET_ARCH_IA32 |
OLD | NEW |