| 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 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 357 __ call(&array_label); | 357 __ call(&array_label); |
| 358 __ SmiUntag(R10); | 358 __ SmiUntag(R10); |
| 359 // RAX: newly allocated array. | 359 // RAX: newly allocated array. |
| 360 // R10: length of the array (was preserved by the stub). | 360 // R10: length of the array (was preserved by the stub). |
| 361 __ pushq(RAX); // Array is in RAX and on top of stack. | 361 __ pushq(RAX); // Array is in RAX and on top of stack. |
| 362 __ leaq(R12, Address(RBP, R10, TIMES_8, kParamEndSlotFromFp * kWordSize)); | 362 __ leaq(R12, Address(RBP, R10, TIMES_8, kParamEndSlotFromFp * kWordSize)); |
| 363 __ leaq(RBX, FieldAddress(RAX, Array::data_offset())); | 363 __ leaq(RBX, FieldAddress(RAX, Array::data_offset())); |
| 364 // R12: address of first argument on stack. | 364 // R12: address of first argument on stack. |
| 365 // RBX: address of first argument in array. | 365 // RBX: address of first argument in array. |
| 366 Label loop, loop_condition; | 366 Label loop, loop_condition; |
| 367 __ jmp(&loop_condition, Assembler::kNearJump); | 367 #if defined(DEBUG) |
| 368 static const bool kJumpLength = Assembler::kFarJump; |
| 369 #else |
| 370 static const bool kJumpLength = Assembler::kNearJump; |
| 371 #endif // DEBUG |
| 372 __ jmp(&loop_condition, kJumpLength); |
| 368 __ Bind(&loop); | 373 __ Bind(&loop); |
| 369 __ movq(RDI, Address(R12, 0)); | 374 __ movq(RDI, Address(R12, 0)); |
| 370 // No generational barrier needed, since array is in new space. | 375 // No generational barrier needed, since array is in new space. |
| 371 __ InitializeFieldNoBarrier(RAX, Address(RBX, 0), RDI); | 376 __ InitializeFieldNoBarrier(RAX, Address(RBX, 0), RDI); |
| 372 __ addq(RBX, Immediate(kWordSize)); | 377 __ addq(RBX, Immediate(kWordSize)); |
| 373 __ subq(R12, Immediate(kWordSize)); | 378 __ subq(R12, Immediate(kWordSize)); |
| 374 __ Bind(&loop_condition); | 379 __ Bind(&loop_condition); |
| 375 __ decq(R10); | 380 __ decq(R10); |
| 376 __ j(POSITIVE, &loop, Assembler::kNearJump); | 381 __ j(POSITIVE, &loop, Assembler::kNearJump); |
| 377 } | 382 } |
| (...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 645 // RAX: new object start as a tagged pointer. | 650 // RAX: new object start as a tagged pointer. |
| 646 // RCX: new object end address. | 651 // RCX: new object end address. |
| 647 // RDI: iterator which initially points to the start of the variable | 652 // RDI: iterator which initially points to the start of the variable |
| 648 // data area to be initialized. | 653 // data area to be initialized. |
| 649 __ LoadObject(R12, Object::null_object(), PP); | 654 __ LoadObject(R12, Object::null_object(), PP); |
| 650 __ leaq(RDI, FieldAddress(RAX, sizeof(RawArray))); | 655 __ leaq(RDI, FieldAddress(RAX, sizeof(RawArray))); |
| 651 Label done; | 656 Label done; |
| 652 Label init_loop; | 657 Label init_loop; |
| 653 __ Bind(&init_loop); | 658 __ Bind(&init_loop); |
| 654 __ cmpq(RDI, RCX); | 659 __ cmpq(RDI, RCX); |
| 655 __ j(ABOVE_EQUAL, &done, Assembler::kNearJump); | 660 #if defined(DEBUG) |
| 661 static const bool kJumpLength = Assembler::kFarJump; |
| 662 #else |
| 663 static const bool kJumpLength = Assembler::kNearJump; |
| 664 #endif // DEBUG |
| 665 __ j(ABOVE_EQUAL, &done, kJumpLength); |
| 656 // No generational barrier needed, since we are storing null. | 666 // No generational barrier needed, since we are storing null. |
| 657 __ InitializeFieldNoBarrier(RAX, Address(RDI, 0), R12); | 667 __ InitializeFieldNoBarrier(RAX, Address(RDI, 0), R12); |
| 658 __ addq(RDI, Immediate(kWordSize)); | 668 __ addq(RDI, Immediate(kWordSize)); |
| 659 __ jmp(&init_loop, Assembler::kNearJump); | 669 __ jmp(&init_loop, kJumpLength); |
| 660 __ Bind(&done); | 670 __ Bind(&done); |
| 661 __ ret(); // returns the newly allocated object in RAX. | 671 __ ret(); // returns the newly allocated object in RAX. |
| 662 | 672 |
| 663 // Unable to allocate the array using the fast inline code, just call | 673 // Unable to allocate the array using the fast inline code, just call |
| 664 // into the runtime. | 674 // into the runtime. |
| 665 __ Bind(&slow_case); | 675 __ Bind(&slow_case); |
| 666 // Create a stub frame as we are pushing some objects on the stack before | 676 // Create a stub frame as we are pushing some objects on the stack before |
| 667 // calling into the runtime. | 677 // calling into the runtime. |
| 668 __ EnterStubFrame(); | 678 __ EnterStubFrame(); |
| 669 // Setup space on stack for return value. | 679 // Setup space on stack for return value. |
| (...skipping 1408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2078 | 2088 |
| 2079 __ movq(left, Address(RSP, 2 * kWordSize)); | 2089 __ movq(left, Address(RSP, 2 * kWordSize)); |
| 2080 __ movq(right, Address(RSP, 1 * kWordSize)); | 2090 __ movq(right, Address(RSP, 1 * kWordSize)); |
| 2081 GenerateIdenticalWithNumberCheckStub(assembler, left, right); | 2091 GenerateIdenticalWithNumberCheckStub(assembler, left, right); |
| 2082 __ ret(); | 2092 __ ret(); |
| 2083 } | 2093 } |
| 2084 | 2094 |
| 2085 } // namespace dart | 2095 } // namespace dart |
| 2086 | 2096 |
| 2087 #endif // defined TARGET_ARCH_X64 | 2097 #endif // defined TARGET_ARCH_X64 |
| OLD | NEW |