| 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 1571 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1582 Immediate(reinterpret_cast<intptr_t>(Object::null())); | 1582 Immediate(reinterpret_cast<intptr_t>(Object::null())); |
| 1583 Label loop, found; | 1583 Label loop, found; |
| 1584 if (num_args == 1) { | 1584 if (num_args == 1) { |
| 1585 __ call(&get_class_id_as_smi); | 1585 __ call(&get_class_id_as_smi); |
| 1586 // RAX: receiver's class id as Smi. | 1586 // RAX: receiver's class id as Smi. |
| 1587 __ Bind(&loop); | 1587 __ Bind(&loop); |
| 1588 __ movq(R13, Address(R12, 0)); // Get class if (Smi) to check. | 1588 __ movq(R13, Address(R12, 0)); // Get class if (Smi) to check. |
| 1589 __ cmpq(RAX, R13); // Match? | 1589 __ cmpq(RAX, R13); // Match? |
| 1590 __ j(EQUAL, &found, Assembler::kNearJump); | 1590 __ j(EQUAL, &found, Assembler::kNearJump); |
| 1591 __ addq(R12, Immediate(kWordSize * 2)); // Next element (class + target). | 1591 __ addq(R12, Immediate(kWordSize * 2)); // Next element (class + target). |
| 1592 __ cmpq(R13, raw_null); // Done? | 1592 __ cmpq(R13, Immediate(Smi::RawValue(kIllegalObjectKind))); // Done? |
| 1593 __ j(NOT_EQUAL, &loop, Assembler::kNearJump); | 1593 __ j(NOT_EQUAL, &loop, Assembler::kNearJump); |
| 1594 } else if (num_args == 2) { | 1594 } else if (num_args == 2) { |
| 1595 Label no_match; | 1595 Label no_match; |
| 1596 __ Bind(&loop); | 1596 __ Bind(&loop); |
| 1597 // Get receiver. | 1597 // Get receiver. |
| 1598 __ movq(RAX, FieldAddress(R10, Array::data_offset())); | 1598 __ movq(RAX, FieldAddress(R10, Array::data_offset())); |
| 1599 __ movq(RAX, Address(RSP, RAX, TIMES_4, 0)); // RAX is Smi. | 1599 __ movq(RAX, Address(RSP, RAX, TIMES_4, 0)); // RAX is Smi. |
| 1600 __ call(&get_class_id_as_smi); | 1600 __ call(&get_class_id_as_smi); |
| 1601 __ movq(R13, Address(R12, 0)); // Get class id from IC data to check. | 1601 __ movq(R13, Address(R12, 0)); // Get class id from IC data to check. |
| 1602 __ cmpq(RAX, R13); // Class id match? | 1602 __ cmpq(RAX, R13); // Class id match? |
| 1603 __ j(NOT_EQUAL, &no_match, Assembler::kNearJump); | 1603 __ j(NOT_EQUAL, &no_match, Assembler::kNearJump); |
| 1604 // Check second. | 1604 // Check second. |
| 1605 // Get next argument. | 1605 // Get next argument. |
| 1606 __ movq(RAX, FieldAddress(R10, Array::data_offset())); | 1606 __ movq(RAX, FieldAddress(R10, Array::data_offset())); |
| 1607 __ movq(RAX, Address(RSP, RAX, TIMES_4, -kWordSize)); // RAX is Smi. | 1607 __ movq(RAX, Address(RSP, RAX, TIMES_4, -kWordSize)); // RAX is Smi. |
| 1608 __ call(&get_class_id_as_smi); | 1608 __ call(&get_class_id_as_smi); |
| 1609 __ movq(R13, Address(R12, kWordSize)); // Get class id from IC data. | 1609 __ movq(R13, Address(R12, kWordSize)); // Get class id from IC data. |
| 1610 __ cmpq(RAX, R13); // Class id match? | 1610 __ cmpq(RAX, R13); // Class id match? |
| 1611 __ j(EQUAL, &found); | 1611 __ j(EQUAL, &found); |
| 1612 __ Bind(&no_match); | 1612 __ Bind(&no_match); |
| 1613 __ addq(R12, Immediate(kWordSize * (1 + num_args))); // Next element. | 1613 __ addq(R12, Immediate(kWordSize * (1 + num_args))); // Next element. |
| 1614 __ cmpq(R13, raw_null); // Done? | 1614 __ cmpq(R13, Immediate(Smi::RawValue(kIllegalObjectKind))); // Done? |
| 1615 __ j(NOT_EQUAL, &loop, Assembler::kNearJump); | 1615 __ j(NOT_EQUAL, &loop, Assembler::kNearJump); |
| 1616 } | 1616 } |
| 1617 | 1617 |
| 1618 __ Bind(&ic_miss); | 1618 __ Bind(&ic_miss); |
| 1619 // Compute address of arguments (first read number of arguments from argument | 1619 // Compute address of arguments (first read number of arguments from argument |
| 1620 // descriptor array and then compute address on the stack). | 1620 // descriptor array and then compute address on the stack). |
| 1621 __ movq(RAX, FieldAddress(R10, Array::data_offset())); | 1621 __ movq(RAX, FieldAddress(R10, Array::data_offset())); |
| 1622 __ leaq(RAX, Address(RSP, RAX, TIMES_4, 0)); // RAX is Smi. | 1622 __ leaq(RAX, Address(RSP, RAX, TIMES_4, 0)); // RAX is Smi. |
| 1623 AssemblerMacros::EnterStubFrame(assembler); | 1623 AssemblerMacros::EnterStubFrame(assembler); |
| 1624 __ pushq(R10); // Preserve arguments array. | 1624 __ pushq(R10); // Preserve arguments array. |
| (...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1903 void StubCode::GenerateJumpToErrorHandlerStub(Assembler* assembler) { | 1903 void StubCode::GenerateJumpToErrorHandlerStub(Assembler* assembler) { |
| 1904 __ movq(RAX, RCX); // error object. | 1904 __ movq(RAX, RCX); // error object. |
| 1905 __ movq(RBP, RDX); // target frame_pointer. | 1905 __ movq(RBP, RDX); // target frame_pointer. |
| 1906 __ movq(RSP, RSI); // target stack_pointer. | 1906 __ movq(RSP, RSI); // target stack_pointer. |
| 1907 __ jmp(RDI); // Jump to the exception handler code. | 1907 __ jmp(RDI); // Jump to the exception handler code. |
| 1908 } | 1908 } |
| 1909 | 1909 |
| 1910 } // namespace dart | 1910 } // namespace dart |
| 1911 | 1911 |
| 1912 #endif // defined TARGET_ARCH_X64 | 1912 #endif // defined TARGET_ARCH_X64 |
| OLD | NEW |