| 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 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 // This snippet of inlined code uses the following registers: | 129 // This snippet of inlined code uses the following registers: |
| 130 // EAX, EBX | 130 // EAX, EBX |
| 131 // and the newly allocated object is returned in EAX. | 131 // and the newly allocated object is returned in EAX. |
| 132 const intptr_t kTypeArgumentsOffset = 2 * kWordSize; | 132 const intptr_t kTypeArgumentsOffset = 2 * kWordSize; |
| 133 const intptr_t kArrayOffset = 1 * kWordSize; | 133 const intptr_t kArrayOffset = 1 * kWordSize; |
| 134 Label fall_through; | 134 Label fall_through; |
| 135 | 135 |
| 136 // Try allocating in new space. | 136 // Try allocating in new space. |
| 137 const Class& cls = Class::Handle( | 137 const Class& cls = Class::Handle( |
| 138 Isolate::Current()->object_store()->growable_object_array_class()); | 138 Isolate::Current()->object_store()->growable_object_array_class()); |
| 139 #if defined(DEBUG) | 139 __ TryAllocate(cls, &fall_through, Assembler::kNearJump, EAX, EBX); |
| 140 static const bool kJumpLength = Assembler::kFarJump; | |
| 141 #else | |
| 142 static const bool kJumpLength = Assembler::kNearJump; | |
| 143 #endif // DEBUG | |
| 144 __ TryAllocate(cls, &fall_through, kJumpLength, EAX, EBX); | |
| 145 | 140 |
| 146 // Store backing array object in growable array object. | 141 // Store backing array object in growable array object. |
| 147 __ movl(EBX, Address(ESP, kArrayOffset)); // data argument. | 142 __ movl(EBX, Address(ESP, kArrayOffset)); // data argument. |
| 148 // EAX is new, no barrier needed. | 143 // EAX is new, no barrier needed. |
| 149 __ InitializeFieldNoBarrier( | 144 __ StoreIntoObjectNoBarrier( |
| 150 EAX, | 145 EAX, |
| 151 FieldAddress(EAX, GrowableObjectArray::data_offset()), | 146 FieldAddress(EAX, GrowableObjectArray::data_offset()), |
| 152 EBX); | 147 EBX); |
| 153 | 148 |
| 154 // EAX: new growable array object start as a tagged pointer. | 149 // EAX: new growable array object start as a tagged pointer. |
| 155 // Store the type argument field in the growable array object. | 150 // Store the type argument field in the growable array object. |
| 156 __ movl(EBX, Address(ESP, kTypeArgumentsOffset)); // type argument. | 151 __ movl(EBX, Address(ESP, kTypeArgumentsOffset)); // type argument. |
| 157 __ InitializeFieldNoBarrier( | 152 __ StoreIntoObjectNoBarrier( |
| 158 EAX, | 153 EAX, |
| 159 FieldAddress(EAX, GrowableObjectArray::type_arguments_offset()), | 154 FieldAddress(EAX, GrowableObjectArray::type_arguments_offset()), |
| 160 EBX); | 155 EBX); |
| 161 | 156 |
| 162 __ ZeroInitSmiField(FieldAddress(EAX, GrowableObjectArray::length_offset())); | 157 __ ZeroInitSmiField(FieldAddress(EAX, GrowableObjectArray::length_offset())); |
| 163 __ ret(); // returns the newly allocated object in EAX. | 158 __ ret(); // returns the newly allocated object in EAX. |
| 164 | 159 |
| 165 __ Bind(&fall_through); | 160 __ Bind(&fall_through); |
| 166 } | 161 } |
| 167 | 162 |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 262 __ Bind(&done); \ | 257 __ Bind(&done); \ |
| 263 \ | 258 \ |
| 264 /* Get the class index and insert it into the tags. */ \ | 259 /* Get the class index and insert it into the tags. */ \ |
| 265 __ orl(EDI, Immediate(RawObject::ClassIdTag::encode(cid))); \ | 260 __ orl(EDI, Immediate(RawObject::ClassIdTag::encode(cid))); \ |
| 266 __ movl(FieldAddress(EAX, type_name::tags_offset()), EDI); /* Tags. */ \ | 261 __ movl(FieldAddress(EAX, type_name::tags_offset()), EDI); /* Tags. */ \ |
| 267 } \ | 262 } \ |
| 268 /* Set the length field. */ \ | 263 /* Set the length field. */ \ |
| 269 /* EAX: new object start as a tagged pointer. */ \ | 264 /* EAX: new object start as a tagged pointer. */ \ |
| 270 /* EBX: new object end address. */ \ | 265 /* EBX: new object end address. */ \ |
| 271 __ movl(EDI, Address(ESP, kArrayLengthStackOffset)); /* Array length. */ \ | 266 __ movl(EDI, Address(ESP, kArrayLengthStackOffset)); /* Array length. */ \ |
| 272 __ InitializeFieldNoBarrier(EAX, \ | 267 __ StoreIntoObjectNoBarrier(EAX, \ |
| 273 FieldAddress(EAX, type_name::length_offset()), \ | 268 FieldAddress(EAX, type_name::length_offset()), \ |
| 274 EDI); \ | 269 EDI); \ |
| 275 /* Initialize all array elements to 0. */ \ | 270 /* Initialize all array elements to 0. */ \ |
| 276 /* EAX: new object start as a tagged pointer. */ \ | 271 /* EAX: new object start as a tagged pointer. */ \ |
| 277 /* EBX: new object end address. */ \ | 272 /* EBX: new object end address. */ \ |
| 278 /* EDI: iterator which initially points to the start of the variable */ \ | 273 /* EDI: iterator which initially points to the start of the variable */ \ |
| 279 /* ECX: scratch register. */ \ | 274 /* ECX: scratch register. */ \ |
| 280 /* data area to be initialized. */ \ | 275 /* data area to be initialized. */ \ |
| 281 __ xorl(ECX, ECX); /* Zero. */ \ | 276 __ xorl(ECX, ECX); /* Zero. */ \ |
| 282 __ leal(EDI, FieldAddress(EAX, sizeof(Raw##type_name))); \ | 277 __ leal(EDI, FieldAddress(EAX, sizeof(Raw##type_name))); \ |
| (...skipping 1628 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1911 __ xorl(EDI, EDI); | 1906 __ xorl(EDI, EDI); |
| 1912 __ Bind(&done); | 1907 __ Bind(&done); |
| 1913 | 1908 |
| 1914 // Get the class index and insert it into the tags. | 1909 // Get the class index and insert it into the tags. |
| 1915 __ orl(EDI, Immediate(RawObject::ClassIdTag::encode(cid))); | 1910 __ orl(EDI, Immediate(RawObject::ClassIdTag::encode(cid))); |
| 1916 __ movl(FieldAddress(EAX, String::tags_offset()), EDI); // Tags. | 1911 __ movl(FieldAddress(EAX, String::tags_offset()), EDI); // Tags. |
| 1917 } | 1912 } |
| 1918 | 1913 |
| 1919 // Set the length field. | 1914 // Set the length field. |
| 1920 __ popl(EDI); | 1915 __ popl(EDI); |
| 1921 __ InitializeFieldNoBarrier(EAX, | 1916 __ StoreIntoObjectNoBarrier(EAX, |
| 1922 FieldAddress(EAX, String::length_offset()), | 1917 FieldAddress(EAX, String::length_offset()), |
| 1923 EDI); | 1918 EDI); |
| 1924 // Clear hash. | 1919 // Clear hash. |
| 1925 __ ZeroInitSmiField(FieldAddress(EAX, String::hash_offset())); | 1920 __ ZeroInitSmiField(FieldAddress(EAX, String::hash_offset())); |
| 1926 __ jmp(ok, Assembler::kNearJump); | 1921 __ jmp(ok, Assembler::kNearJump); |
| 1927 | 1922 |
| 1928 __ Bind(&pop_and_fail); | 1923 __ Bind(&pop_and_fail); |
| 1929 __ popl(EDI); | 1924 __ popl(EDI); |
| 1930 __ jmp(failure); | 1925 __ jmp(failure); |
| 1931 } | 1926 } |
| (...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2154 __ Bind(&true_label); | 2149 __ Bind(&true_label); |
| 2155 __ LoadObject(EAX, Bool::True()); | 2150 __ LoadObject(EAX, Bool::True()); |
| 2156 __ ret(); | 2151 __ ret(); |
| 2157 } | 2152 } |
| 2158 | 2153 |
| 2159 #undef __ | 2154 #undef __ |
| 2160 | 2155 |
| 2161 } // namespace dart | 2156 } // namespace dart |
| 2162 | 2157 |
| 2163 #endif // defined TARGET_ARCH_IA32 | 2158 #endif // defined TARGET_ARCH_IA32 |
| OLD | NEW |