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 1648 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1659 __ cmpl(EAX, Address(ESP, + 2 * kWordSize)); | 1659 __ cmpl(EAX, Address(ESP, + 2 * kWordSize)); |
1660 __ j(EQUAL, &is_true, Assembler::kNearJump); | 1660 __ j(EQUAL, &is_true, Assembler::kNearJump); |
1661 __ LoadObject(EAX, Bool::False()); | 1661 __ LoadObject(EAX, Bool::False()); |
1662 __ ret(); | 1662 __ ret(); |
1663 __ Bind(&is_true); | 1663 __ Bind(&is_true); |
1664 __ LoadObject(EAX, Bool::True()); | 1664 __ LoadObject(EAX, Bool::True()); |
1665 __ ret(); | 1665 __ ret(); |
1666 } | 1666 } |
1667 | 1667 |
1668 | 1668 |
| 1669 // Return type quickly for simple types (not parameterized and not signature). |
| 1670 void Intrinsifier::ObjectRuntimeType(Assembler* assembler) { |
| 1671 Label fall_through; |
| 1672 __ movl(EAX, Address(ESP, + 1 * kWordSize)); |
| 1673 __ LoadClassIdMayBeSmi(EDI, EAX); |
| 1674 __ LoadClassById(EBX, EDI); |
| 1675 // EBX: class of instance (EAX). |
| 1676 const Immediate& raw_null = |
| 1677 Immediate(reinterpret_cast<intptr_t>(Object::null())); |
| 1678 __ movl(EDI, FieldAddress(EBX, Class::signature_function_offset())); |
| 1679 __ cmpl(EDI, raw_null); |
| 1680 __ j(NOT_EQUAL, &fall_through, Assembler::kNearJump); |
| 1681 |
| 1682 __ movzxw(EDI, FieldAddress(EBX, Class::num_type_arguments_offset())); |
| 1683 __ cmpl(EDI, Immediate(0)); |
| 1684 __ j(NOT_EQUAL, &fall_through, Assembler::kNearJump); |
| 1685 __ movl(EAX, FieldAddress(EBX, Class::canonical_types_offset())); |
| 1686 __ cmpl(EAX, raw_null); |
| 1687 __ j(EQUAL, &fall_through, Assembler::kNearJump); // Not yet set. |
| 1688 __ ret(); |
| 1689 |
| 1690 __ Bind(&fall_through); |
| 1691 } |
| 1692 |
| 1693 |
1669 void Intrinsifier::String_getHashCode(Assembler* assembler) { | 1694 void Intrinsifier::String_getHashCode(Assembler* assembler) { |
1670 Label fall_through; | 1695 Label fall_through; |
1671 __ movl(EAX, Address(ESP, + 1 * kWordSize)); // String object. | 1696 __ movl(EAX, Address(ESP, + 1 * kWordSize)); // String object. |
1672 __ movl(EAX, FieldAddress(EAX, String::hash_offset())); | 1697 __ movl(EAX, FieldAddress(EAX, String::hash_offset())); |
1673 __ cmpl(EAX, Immediate(0)); | 1698 __ cmpl(EAX, Immediate(0)); |
1674 __ j(EQUAL, &fall_through, Assembler::kNearJump); | 1699 __ j(EQUAL, &fall_through, Assembler::kNearJump); |
1675 __ ret(); | 1700 __ ret(); |
1676 __ Bind(&fall_through); | 1701 __ Bind(&fall_through); |
1677 // Hash not yet computed. | 1702 // Hash not yet computed. |
1678 } | 1703 } |
(...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2066 __ movl(EBX, Address(ESP, kRegExpParamOffset)); | 2091 __ movl(EBX, Address(ESP, kRegExpParamOffset)); |
2067 __ movl(EDI, Address(ESP, kStringParamOffset)); | 2092 __ movl(EDI, Address(ESP, kStringParamOffset)); |
2068 __ LoadClassId(EDI, EDI); | 2093 __ LoadClassId(EDI, EDI); |
2069 __ SubImmediate(EDI, Immediate(kOneByteStringCid)); | 2094 __ SubImmediate(EDI, Immediate(kOneByteStringCid)); |
2070 __ movl(EAX, FieldAddress(EBX, EDI, TIMES_4, | 2095 __ movl(EAX, FieldAddress(EBX, EDI, TIMES_4, |
2071 JSRegExp::function_offset(kOneByteStringCid))); | 2096 JSRegExp::function_offset(kOneByteStringCid))); |
2072 | 2097 |
2073 // Registers are now set up for the lazy compile stub. It expects the function | 2098 // Registers are now set up for the lazy compile stub. It expects the function |
2074 // in EAX, the argument descriptor in EDX, and IC-Data in ECX. | 2099 // in EAX, the argument descriptor in EDX, and IC-Data in ECX. |
2075 static const intptr_t arg_count = RegExpMacroAssembler::kParamCount; | 2100 static const intptr_t arg_count = RegExpMacroAssembler::kParamCount; |
2076 __ LoadObject(EDX, Array::Handle(ArgumentsDescriptor::New(arg_count))); | 2101 __ LoadObject(EDX, Array::ZoneHandle(ArgumentsDescriptor::New(arg_count))); |
2077 __ xorl(ECX, ECX); | 2102 __ xorl(ECX, ECX); |
2078 | 2103 |
2079 // Tail-call the function. | 2104 // Tail-call the function. |
2080 __ movl(EDI, FieldAddress(EAX, Function::instructions_offset())); | 2105 __ movl(EDI, FieldAddress(EAX, Function::instructions_offset())); |
2081 __ addl(EDI, Immediate(Instructions::HeaderSize() - kHeapObjectTag)); | 2106 __ addl(EDI, Immediate(Instructions::HeaderSize() - kHeapObjectTag)); |
2082 __ jmp(EDI); | 2107 __ jmp(EDI); |
2083 } | 2108 } |
2084 | 2109 |
2085 | 2110 |
2086 // On stack: user tag (+1), return-address (+0). | 2111 // On stack: user tag (+1), return-address (+0). |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2124 Isolate::current_tag_offset()); | 2149 Isolate::current_tag_offset()); |
2125 // Set return value to Isolate::current_tag_. | 2150 // Set return value to Isolate::current_tag_. |
2126 __ movl(EAX, current_tag_addr); | 2151 __ movl(EAX, current_tag_addr); |
2127 __ ret(); | 2152 __ ret(); |
2128 } | 2153 } |
2129 | 2154 |
2130 #undef __ | 2155 #undef __ |
2131 } // namespace dart | 2156 } // namespace dart |
2132 | 2157 |
2133 #endif // defined TARGET_ARCH_IA32 | 2158 #endif // defined TARGET_ARCH_IA32 |
OLD | NEW |