| 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 #include "vm/globals.h" | 5 #include "vm/globals.h" |
| 6 #if defined(TARGET_ARCH_X64) | 6 #if defined(TARGET_ARCH_X64) |
| 7 | 7 |
| 8 #include "vm/assembler.h" | 8 #include "vm/assembler.h" |
| 9 #include "vm/compiler.h" | 9 #include "vm/compiler.h" |
| 10 #include "vm/dart_entry.h" | 10 #include "vm/dart_entry.h" |
| (...skipping 1203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1214 __ pushq(ic_reg); // Preserve. | 1214 __ pushq(ic_reg); // Preserve. |
| 1215 __ pushq(ic_reg); // Argument. | 1215 __ pushq(ic_reg); // Argument. |
| 1216 __ pushq(func_reg); // Argument. | 1216 __ pushq(func_reg); // Argument. |
| 1217 __ CallRuntime(kTraceICCallRuntimeEntry, 2); | 1217 __ CallRuntime(kTraceICCallRuntimeEntry, 2); |
| 1218 __ popq(RAX); // Discard argument; | 1218 __ popq(RAX); // Discard argument; |
| 1219 __ popq(RAX); // Discard argument; | 1219 __ popq(RAX); // Discard argument; |
| 1220 __ popq(ic_reg); // Restore. | 1220 __ popq(ic_reg); // Restore. |
| 1221 __ popq(func_reg); // Restore. | 1221 __ popq(func_reg); // Restore. |
| 1222 __ LeaveStubFrame(); | 1222 __ LeaveStubFrame(); |
| 1223 } | 1223 } |
| 1224 __ incq(FieldAddress(func_reg, Function::usage_counter_offset())); | 1224 __ incl(FieldAddress(func_reg, Function::usage_counter_offset())); |
| 1225 } | 1225 } |
| 1226 | 1226 |
| 1227 | 1227 |
| 1228 // Loads function into 'temp_reg', preserves 'ic_reg'. | 1228 // Loads function into 'temp_reg', preserves 'ic_reg'. |
| 1229 void StubCode::GenerateUsageCounterIncrement(Assembler* assembler, | 1229 void StubCode::GenerateUsageCounterIncrement(Assembler* assembler, |
| 1230 Register temp_reg) { | 1230 Register temp_reg) { |
| 1231 Register ic_reg = RBX; | 1231 Register ic_reg = RBX; |
| 1232 Register func_reg = temp_reg; | 1232 Register func_reg = temp_reg; |
| 1233 ASSERT(ic_reg != func_reg); | 1233 ASSERT(ic_reg != func_reg); |
| 1234 __ movq(func_reg, FieldAddress(ic_reg, ICData::owner_offset())); | 1234 __ movq(func_reg, FieldAddress(ic_reg, ICData::owner_offset())); |
| 1235 __ incq(FieldAddress(func_reg, Function::usage_counter_offset())); | 1235 __ incl(FieldAddress(func_reg, Function::usage_counter_offset())); |
| 1236 } | 1236 } |
| 1237 | 1237 |
| 1238 | 1238 |
| 1239 // Generate inline cache check for 'num_args'. | 1239 // Generate inline cache check for 'num_args'. |
| 1240 // RBX: Inline cache data object. | 1240 // RBX: Inline cache data object. |
| 1241 // TOS(0): return address | 1241 // TOS(0): return address |
| 1242 // Control flow: | 1242 // Control flow: |
| 1243 // - If receiver is null -> jump to IC miss. | 1243 // - If receiver is null -> jump to IC miss. |
| 1244 // - If receiver is Smi -> load Smi class. | 1244 // - If receiver is Smi -> load Smi class. |
| 1245 // - If receiver is not-Smi -> load receiver's class. | 1245 // - If receiver is not-Smi -> load receiver's class. |
| (...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1593 const intptr_t kInstantiatorTypeArgumentsInBytes = 1 * kWordSize; | 1593 const intptr_t kInstantiatorTypeArgumentsInBytes = 1 * kWordSize; |
| 1594 const intptr_t kInstanceOffsetInBytes = 2 * kWordSize; | 1594 const intptr_t kInstanceOffsetInBytes = 2 * kWordSize; |
| 1595 const intptr_t kCacheOffsetInBytes = 3 * kWordSize; | 1595 const intptr_t kCacheOffsetInBytes = 3 * kWordSize; |
| 1596 __ movq(RAX, Address(RSP, kInstanceOffsetInBytes)); | 1596 __ movq(RAX, Address(RSP, kInstanceOffsetInBytes)); |
| 1597 __ LoadObject(R12, Object::null_object(), PP); | 1597 __ LoadObject(R12, Object::null_object(), PP); |
| 1598 if (n > 1) { | 1598 if (n > 1) { |
| 1599 __ LoadClass(R10, RAX); | 1599 __ LoadClass(R10, RAX); |
| 1600 // Compute instance type arguments into R13. | 1600 // Compute instance type arguments into R13. |
| 1601 Label has_no_type_arguments; | 1601 Label has_no_type_arguments; |
| 1602 __ movq(R13, R12); | 1602 __ movq(R13, R12); |
| 1603 __ movq(RDI, FieldAddress(R10, | 1603 __ movl(RDI, FieldAddress(R10, |
| 1604 Class::type_arguments_field_offset_in_words_offset())); | 1604 Class::type_arguments_field_offset_in_words_offset())); |
| 1605 __ cmpq(RDI, Immediate(Class::kNoTypeArguments)); | 1605 __ cmpl(RDI, Immediate(Class::kNoTypeArguments)); |
| 1606 __ j(EQUAL, &has_no_type_arguments, Assembler::kNearJump); | 1606 __ j(EQUAL, &has_no_type_arguments, Assembler::kNearJump); |
| 1607 __ movq(R13, FieldAddress(RAX, RDI, TIMES_8, 0)); | 1607 __ movq(R13, FieldAddress(RAX, RDI, TIMES_8, 0)); |
| 1608 __ Bind(&has_no_type_arguments); | 1608 __ Bind(&has_no_type_arguments); |
| 1609 } | 1609 } |
| 1610 __ LoadClassId(R10, RAX); | 1610 __ LoadClassId(R10, RAX); |
| 1611 // RAX: instance, R10: instance class id. | 1611 // RAX: instance, R10: instance class id. |
| 1612 // R13: instance type arguments or null, used only if n > 1. | 1612 // R13: instance type arguments or null, used only if n > 1. |
| 1613 __ movq(RDX, Address(RSP, kCacheOffsetInBytes)); | 1613 __ movq(RDX, Address(RSP, kCacheOffsetInBytes)); |
| 1614 // RDX: SubtypeTestCache. | 1614 // RDX: SubtypeTestCache. |
| 1615 __ movq(RDX, FieldAddress(RDX, SubtypeTestCache::cache_offset())); | 1615 __ movq(RDX, FieldAddress(RDX, SubtypeTestCache::cache_offset())); |
| (...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1857 | 1857 |
| 1858 __ movq(left, Address(RSP, 2 * kWordSize)); | 1858 __ movq(left, Address(RSP, 2 * kWordSize)); |
| 1859 __ movq(right, Address(RSP, 1 * kWordSize)); | 1859 __ movq(right, Address(RSP, 1 * kWordSize)); |
| 1860 GenerateIdenticalWithNumberCheckStub(assembler, left, right); | 1860 GenerateIdenticalWithNumberCheckStub(assembler, left, right); |
| 1861 __ ret(); | 1861 __ ret(); |
| 1862 } | 1862 } |
| 1863 | 1863 |
| 1864 } // namespace dart | 1864 } // namespace dart |
| 1865 | 1865 |
| 1866 #endif // defined TARGET_ARCH_X64 | 1866 #endif // defined TARGET_ARCH_X64 |
| OLD | NEW |