| 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 573 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 584 __ cmpq(R12, Address(R13, Scavenger::end_offset())); | 584 __ cmpq(R12, Address(R13, Scavenger::end_offset())); |
| 585 __ j(ABOVE_EQUAL, &slow_case); | 585 __ j(ABOVE_EQUAL, &slow_case); |
| 586 | 586 |
| 587 // Successfully allocated the object(s), now update top to point to | 587 // Successfully allocated the object(s), now update top to point to |
| 588 // next object start and initialize the object. | 588 // next object start and initialize the object. |
| 589 // RAX: potential new object start. | 589 // RAX: potential new object start. |
| 590 // R12: potential next object start. | 590 // R12: potential next object start. |
| 591 // R13: Points to new space object. | 591 // R13: Points to new space object. |
| 592 __ movq(Address(R13, Scavenger::top_offset()), R12); | 592 __ movq(Address(R13, Scavenger::top_offset()), R12); |
| 593 __ addq(RAX, Immediate(kHeapObjectTag)); | 593 __ addq(RAX, Immediate(kHeapObjectTag)); |
| 594 // R13: Size of allocation in bytes. |
| 595 __ movq(R13, R12); |
| 596 __ subq(R13, RAX); |
| 597 __ UpdateAllocationStatsWithSize(kArrayCid, R13); |
| 594 | 598 |
| 595 // RAX: new object start as a tagged pointer. | 599 // RAX: new object start as a tagged pointer. |
| 596 // R12: new object end address. | 600 // R12: new object end address. |
| 597 // RBX: array element type. | 601 // RBX: array element type. |
| 598 // R10: Array length as Smi. | 602 // R10: Array length as Smi. |
| 599 | 603 |
| 600 // Store the type argument field. | 604 // Store the type argument field. |
| 601 __ StoreIntoObjectNoBarrier( | 605 __ StoreIntoObjectNoBarrier( |
| 602 RAX, FieldAddress(RAX, Array::type_arguments_offset()), RBX); | 606 RAX, FieldAddress(RAX, Array::type_arguments_offset()), RBX); |
| 603 | 607 |
| (...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 938 } | 942 } |
| 939 | 943 |
| 940 // Successfully allocated the object, now update top to point to | 944 // Successfully allocated the object, now update top to point to |
| 941 // next object start and initialize the object. | 945 // next object start and initialize the object. |
| 942 // RAX: new object. | 946 // RAX: new object. |
| 943 // R13: next object start. | 947 // R13: next object start. |
| 944 // R10: number of context variables. | 948 // R10: number of context variables. |
| 945 __ movq(RDI, Immediate(heap->TopAddress())); | 949 __ movq(RDI, Immediate(heap->TopAddress())); |
| 946 __ movq(Address(RDI, 0), R13); | 950 __ movq(Address(RDI, 0), R13); |
| 947 __ addq(RAX, Immediate(kHeapObjectTag)); | 951 __ addq(RAX, Immediate(kHeapObjectTag)); |
| 952 // R13: Size of allocation in bytes. |
| 953 __ subq(R13, RAX); |
| 954 __ UpdateAllocationStatsWithSize(context_class.id(), R13); |
| 948 | 955 |
| 949 // Calculate the size tag. | 956 // Calculate the size tag. |
| 950 // RAX: new object. | 957 // RAX: new object. |
| 951 // R10: number of context variables. | 958 // R10: number of context variables. |
| 952 { | 959 { |
| 953 Label size_tag_overflow, done; | 960 Label size_tag_overflow, done; |
| 954 __ leaq(R13, Address(R10, TIMES_8, fixed_size)); | 961 __ leaq(R13, Address(R10, TIMES_8, fixed_size)); |
| 955 __ andq(R13, Immediate(-kObjectAlignment)); | 962 __ andq(R13, Immediate(-kObjectAlignment)); |
| 956 __ cmpq(R13, Immediate(RawObject::SizeTag::kMaxSizeTag)); | 963 __ cmpq(R13, Immediate(RawObject::SizeTag::kMaxSizeTag)); |
| 957 __ j(ABOVE, &size_tag_overflow, Assembler::kNearJump); | 964 __ j(ABOVE, &size_tag_overflow, Assembler::kNearJump); |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1137 if (FLAG_use_slow_path) { | 1144 if (FLAG_use_slow_path) { |
| 1138 __ jmp(&slow_case); | 1145 __ jmp(&slow_case); |
| 1139 } else { | 1146 } else { |
| 1140 __ j(ABOVE_EQUAL, &slow_case); | 1147 __ j(ABOVE_EQUAL, &slow_case); |
| 1141 } | 1148 } |
| 1142 | 1149 |
| 1143 // Successfully allocated the object(s), now update top to point to | 1150 // Successfully allocated the object(s), now update top to point to |
| 1144 // next object start and initialize the object. | 1151 // next object start and initialize the object. |
| 1145 __ movq(RDI, Immediate(heap->TopAddress())); | 1152 __ movq(RDI, Immediate(heap->TopAddress())); |
| 1146 __ movq(Address(RDI, 0), RBX); | 1153 __ movq(Address(RDI, 0), RBX); |
| 1154 __ UpdateAllocationStats(cls.id()); |
| 1147 | 1155 |
| 1148 if (is_cls_parameterized) { | 1156 if (is_cls_parameterized) { |
| 1149 // Initialize the type arguments field in the object. | 1157 // Initialize the type arguments field in the object. |
| 1150 // RAX: new object start. | 1158 // RAX: new object start. |
| 1151 // RCX: potential new object end and, if RCX != RBX, potential new | 1159 // RCX: potential new object end and, if RCX != RBX, potential new |
| 1152 // InstantiatedTypeArguments object start. | 1160 // InstantiatedTypeArguments object start. |
| 1153 // RBX: next object start. | 1161 // RBX: next object start. |
| 1154 Label type_arguments_ready; | 1162 Label type_arguments_ready; |
| 1155 __ movq(RDI, Address(RSP, kObjectTypeArgumentsOffset)); | 1163 __ movq(RDI, Address(RSP, kObjectTypeArgumentsOffset)); |
| 1156 __ cmpq(RCX, RBX); | 1164 __ cmpq(RCX, RBX); |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1303 __ j(ABOVE_EQUAL, &slow_case); | 1311 __ j(ABOVE_EQUAL, &slow_case); |
| 1304 } | 1312 } |
| 1305 | 1313 |
| 1306 // Successfully allocated the object, now update top to point to | 1314 // Successfully allocated the object, now update top to point to |
| 1307 // next object start and initialize the object. | 1315 // next object start and initialize the object. |
| 1308 __ movq(RDI, Immediate(heap->TopAddress())); | 1316 __ movq(RDI, Immediate(heap->TopAddress())); |
| 1309 __ movq(Address(RDI, 0), R13); | 1317 __ movq(Address(RDI, 0), R13); |
| 1310 | 1318 |
| 1311 // RAX: new closure object. | 1319 // RAX: new closure object. |
| 1312 // RBX: new context object (only if is_implicit_closure). | 1320 // RBX: new context object (only if is_implicit_closure). |
| 1321 if (is_implicit_instance_closure) { |
| 1322 // This closure allocates a context, update allocation stats. |
| 1323 // RDI: context size. |
| 1324 __ movq(RDI, Immediate(context_size)); |
| 1325 __ UpdateAllocationStatsWithSize(kContextCid, RDI); |
| 1326 } |
| 1327 // The closure allocation is attributed to the signature class. |
| 1328 __ UpdateAllocationStats(cls.id()); |
| 1329 |
| 1330 // RAX: new closure object. |
| 1331 // RBX: new context object (only if is_implicit_closure). |
| 1313 // Set the tags. | 1332 // Set the tags. |
| 1314 uword tags = 0; | 1333 uword tags = 0; |
| 1315 tags = RawObject::SizeTag::update(closure_size, tags); | 1334 tags = RawObject::SizeTag::update(closure_size, tags); |
| 1316 tags = RawObject::ClassIdTag::update(cls.id(), tags); | 1335 tags = RawObject::ClassIdTag::update(cls.id(), tags); |
| 1317 __ movq(Address(RAX, Instance::tags_offset()), Immediate(tags)); | 1336 __ movq(Address(RAX, Instance::tags_offset()), Immediate(tags)); |
| 1318 | 1337 |
| 1319 // Initialize the function field in the object. | 1338 // Initialize the function field in the object. |
| 1320 // RAX: new closure object. | 1339 // RAX: new closure object. |
| 1321 // RBX: new context object (only if is_implicit_closure). | 1340 // RBX: new context object (only if is_implicit_closure). |
| 1322 // R13: next object start. | 1341 // R13: next object start. |
| (...skipping 806 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2129 | 2148 |
| 2130 __ movq(left, Address(RSP, 2 * kWordSize)); | 2149 __ movq(left, Address(RSP, 2 * kWordSize)); |
| 2131 __ movq(right, Address(RSP, 1 * kWordSize)); | 2150 __ movq(right, Address(RSP, 1 * kWordSize)); |
| 2132 GenerateIdenticalWithNumberCheckStub(assembler, left, right); | 2151 GenerateIdenticalWithNumberCheckStub(assembler, left, right); |
| 2133 __ ret(); | 2152 __ ret(); |
| 2134 } | 2153 } |
| 2135 | 2154 |
| 2136 } // namespace dart | 2155 } // namespace dart |
| 2137 | 2156 |
| 2138 #endif // defined TARGET_ARCH_X64 | 2157 #endif // defined TARGET_ARCH_X64 |
| OLD | NEW |