OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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/assembler_macros.h" | 9 #include "vm/assembler_macros.h" |
10 #include "vm/compiler.h" | 10 #include "vm/compiler.h" |
(...skipping 1340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1351 // next object start and initialize the object. | 1351 // next object start and initialize the object. |
1352 __ movq(RDI, Immediate(heap->TopAddress())); | 1352 __ movq(RDI, Immediate(heap->TopAddress())); |
1353 __ movq(Address(RDI, 0), R13); | 1353 __ movq(Address(RDI, 0), R13); |
1354 | 1354 |
1355 // RAX: new closure object. | 1355 // RAX: new closure object. |
1356 // RBX: new context object (only if is_implicit_closure). | 1356 // RBX: new context object (only if is_implicit_closure). |
1357 // Set the tags. | 1357 // Set the tags. |
1358 uword tags = 0; | 1358 uword tags = 0; |
1359 tags = RawObject::SizeTag::update(closure_size, tags); | 1359 tags = RawObject::SizeTag::update(closure_size, tags); |
1360 tags = RawObject::ClassIdTag::update(cls.id(), tags); | 1360 tags = RawObject::ClassIdTag::update(cls.id(), tags); |
1361 __ movq(Address(RAX, Closure::tags_offset()), Immediate(tags)); | 1361 __ movq(Address(RAX, Instance::tags_offset()), Immediate(tags)); |
1362 | 1362 |
1363 // Initialize the function field in the object. | 1363 // Initialize the function field in the object. |
1364 // RAX: new closure object. | 1364 // RAX: new closure object. |
1365 // RBX: new context object (only if is_implicit_closure). | 1365 // RBX: new context object (only if is_implicit_closure). |
1366 // R13: next object start. | 1366 // R13: next object start. |
1367 __ LoadObject(R10, func); // Load function of closure to be allocated. | 1367 __ LoadObject(R10, func); // Load function of closure to be allocated. |
1368 __ movq(Address(RAX, Closure::function_offset()), R10); | 1368 __ movq(Address(RAX, Closure::function_offset()), R10); |
1369 | 1369 |
1370 // Setup the context for this closure. | 1370 // Setup the context for this closure. |
1371 if (is_implicit_static_closure) { | 1371 if (is_implicit_static_closure) { |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1403 __ addq(RBX, Immediate(kHeapObjectTag)); | 1403 __ addq(RBX, Immediate(kHeapObjectTag)); |
1404 __ movq(Address(RAX, Closure::context_offset()), RBX); | 1404 __ movq(Address(RAX, Closure::context_offset()), RBX); |
1405 } else { | 1405 } else { |
1406 __ movq(Address(RAX, Closure::context_offset()), CTX); | 1406 __ movq(Address(RAX, Closure::context_offset()), CTX); |
1407 } | 1407 } |
1408 | 1408 |
1409 // Set the type arguments field in the newly allocated closure. | 1409 // Set the type arguments field in the newly allocated closure. |
1410 __ movq(R10, Address(RSP, kTypeArgumentsOffset)); | 1410 __ movq(R10, Address(RSP, kTypeArgumentsOffset)); |
1411 __ movq(Address(RAX, Closure::type_arguments_offset()), R10); | 1411 __ movq(Address(RAX, Closure::type_arguments_offset()), R10); |
1412 | 1412 |
1413 __ movq(Address(RAX, Closure::smrck_offset()), raw_null); | |
1414 | |
1415 // Done allocating and initializing the instance. | 1413 // Done allocating and initializing the instance. |
1416 // RAX: new object. | 1414 // RAX: new object. |
1417 __ addq(RAX, Immediate(kHeapObjectTag)); | 1415 __ addq(RAX, Immediate(kHeapObjectTag)); |
1418 __ ret(); | 1416 __ ret(); |
1419 | 1417 |
1420 __ Bind(&slow_case); | 1418 __ Bind(&slow_case); |
1421 } | 1419 } |
1422 if (has_type_arguments) { | 1420 if (has_type_arguments) { |
1423 __ movq(RCX, Address(RSP, kTypeArgumentsOffset)); | 1421 __ movq(RCX, Address(RSP, kTypeArgumentsOffset)); |
1424 } | 1422 } |
(...skipping 590 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2015 __ CallRuntime(kUpdateICDataTwoArgsRuntimeEntry); | 2013 __ CallRuntime(kUpdateICDataTwoArgsRuntimeEntry); |
2016 __ Drop(4); | 2014 __ Drop(4); |
2017 __ LeaveFrame(); | 2015 __ LeaveFrame(); |
2018 | 2016 |
2019 __ jmp(&compute_result, Assembler::kNearJump); | 2017 __ jmp(&compute_result, Assembler::kNearJump); |
2020 } | 2018 } |
2021 | 2019 |
2022 } // namespace dart | 2020 } // namespace dart |
2023 | 2021 |
2024 #endif // defined TARGET_ARCH_X64 | 2022 #endif // defined TARGET_ARCH_X64 |
OLD | NEW |