| 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 771 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 782 __ SmiUntag(EAX); // Value. | 782 __ SmiUntag(EAX); // Value. |
| 783 __ sarl(EAX, ECX); | 783 __ sarl(EAX, ECX); |
| 784 __ SmiTag(EAX); | 784 __ SmiTag(EAX); |
| 785 __ ret(); | 785 __ ret(); |
| 786 __ Bind(&fall_through); | 786 __ Bind(&fall_through); |
| 787 } | 787 } |
| 788 | 788 |
| 789 | 789 |
| 790 // Argument is Smi (receiver). | 790 // Argument is Smi (receiver). |
| 791 void Intrinsifier::Smi_bitNegate(Assembler* assembler) { | 791 void Intrinsifier::Smi_bitNegate(Assembler* assembler) { |
| 792 __ movl(EAX, Address(ESP, + 1 * kWordSize)); // Index. | 792 __ movl(EAX, Address(ESP, + 1 * kWordSize)); // Receiver. |
| 793 __ notl(EAX); | 793 __ notl(EAX); |
| 794 __ andl(EAX, Immediate(~kSmiTagMask)); // Remove inverted smi-tag. | 794 __ andl(EAX, Immediate(~kSmiTagMask)); // Remove inverted smi-tag. |
| 795 __ ret(); | 795 __ ret(); |
| 796 } | 796 } |
| 797 | 797 |
| 798 | 798 |
| 799 void Intrinsifier::Smi_bitLength(Assembler* assembler) { | 799 void Intrinsifier::Smi_bitLength(Assembler* assembler) { |
| 800 ASSERT(kSmiTagShift == 1); | 800 ASSERT(kSmiTagShift == 1); |
| 801 __ movl(EAX, Address(ESP, + 1 * kWordSize)); // Index. | 801 __ movl(EAX, Address(ESP, + 1 * kWordSize)); // Receiver. |
| 802 // XOR with sign bit to complement bits if value is negative. | 802 // XOR with sign bit to complement bits if value is negative. |
| 803 __ movl(ECX, EAX); | 803 __ movl(ECX, EAX); |
| 804 __ sarl(ECX, Immediate(31)); // All 0 or all 1. | 804 __ sarl(ECX, Immediate(31)); // All 0 or all 1. |
| 805 __ xorl(EAX, ECX); | 805 __ xorl(EAX, ECX); |
| 806 // BSR does not write the destination register if source is zero. Put a 1 in | 806 // BSR does not write the destination register if source is zero. Put a 1 in |
| 807 // the Smi tag bit to ensure BSR writes to destination register. | 807 // the Smi tag bit to ensure BSR writes to destination register. |
| 808 __ orl(EAX, Immediate(kSmiTagMask)); | 808 __ orl(EAX, Immediate(kSmiTagMask)); |
| 809 __ bsrl(EAX, EAX); | 809 __ bsrl(EAX, EAX); |
| 810 __ SmiTag(EAX); | 810 __ SmiTag(EAX); |
| 811 __ ret(); | 811 __ ret(); |
| (...skipping 1276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2088 Isolate::current_tag_offset()); | 2088 Isolate::current_tag_offset()); |
| 2089 // Set return value to Isolate::current_tag_. | 2089 // Set return value to Isolate::current_tag_. |
| 2090 __ movl(EAX, current_tag_addr); | 2090 __ movl(EAX, current_tag_addr); |
| 2091 __ ret(); | 2091 __ ret(); |
| 2092 } | 2092 } |
| 2093 | 2093 |
| 2094 #undef __ | 2094 #undef __ |
| 2095 } // namespace dart | 2095 } // namespace dart |
| 2096 | 2096 |
| 2097 #endif // defined TARGET_ARCH_IA32 | 2097 #endif // defined TARGET_ARCH_IA32 |
| OLD | NEW |