| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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_IA32) | 6 #if defined(TARGET_ARCH_IA32) |
| 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 1595 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1606 // EBX: points directly to the first ic data array element. | 1606 // EBX: points directly to the first ic data array element. |
| 1607 Label loop, found; | 1607 Label loop, found; |
| 1608 if (num_args == 1) { | 1608 if (num_args == 1) { |
| 1609 __ call(&get_class_id_as_smi); | 1609 __ call(&get_class_id_as_smi); |
| 1610 // EAX: receiver's class id Smi. | 1610 // EAX: receiver's class id Smi. |
| 1611 __ Bind(&loop); | 1611 __ Bind(&loop); |
| 1612 __ movl(EDI, Address(EBX, 0)); // Get class id (Smi) to check. | 1612 __ movl(EDI, Address(EBX, 0)); // Get class id (Smi) to check. |
| 1613 __ cmpl(EAX, EDI); // Class id match? | 1613 __ cmpl(EAX, EDI); // Class id match? |
| 1614 __ j(EQUAL, &found, Assembler::kNearJump); | 1614 __ j(EQUAL, &found, Assembler::kNearJump); |
| 1615 __ addl(EBX, Immediate(kWordSize * 2)); // Next element (class + target). | 1615 __ addl(EBX, Immediate(kWordSize * 2)); // Next element (class + target). |
| 1616 __ cmpl(EDI, raw_null); // Done? | 1616 __ cmpl(EDI, Immediate(Smi::RawValue(kIllegalObjectKind))); // Done? |
| 1617 __ j(NOT_EQUAL, &loop, Assembler::kNearJump); | 1617 __ j(NOT_EQUAL, &loop, Assembler::kNearJump); |
| 1618 } else if (num_args == 2) { | 1618 } else if (num_args == 2) { |
| 1619 // EDI: class to check. | 1619 // EDI: class to check. |
| 1620 Label no_match; | 1620 Label no_match; |
| 1621 __ Bind(&loop); | 1621 __ Bind(&loop); |
| 1622 // Get class id from IC data to check. | 1622 // Get class id from IC data to check. |
| 1623 // Get receiver using argument descriptor in EDX. | 1623 // Get receiver using argument descriptor in EDX. |
| 1624 __ movl(EAX, FieldAddress(EDX, Array::data_offset())); | 1624 __ movl(EAX, FieldAddress(EDX, Array::data_offset())); |
| 1625 __ movl(EAX, Address(ESP, EAX, TIMES_2, 0)); // EAX (arg. count) is Smi. | 1625 __ movl(EAX, Address(ESP, EAX, TIMES_2, 0)); // EAX (arg. count) is Smi. |
| 1626 __ call(&get_class_id_as_smi); | 1626 __ call(&get_class_id_as_smi); |
| 1627 __ movl(EDI, Address(EBX, 0)); | 1627 __ movl(EDI, Address(EBX, 0)); |
| 1628 __ cmpl(EAX, EDI); // Class id match? | 1628 __ cmpl(EAX, EDI); // Class id match? |
| 1629 __ j(NOT_EQUAL, &no_match, Assembler::kNearJump); | 1629 __ j(NOT_EQUAL, &no_match, Assembler::kNearJump); |
| 1630 // Check second class/argument. | 1630 // Check second class/argument. |
| 1631 // Get class id from IC data to check. | 1631 // Get class id from IC data to check. |
| 1632 // Get next argument. | 1632 // Get next argument. |
| 1633 __ movl(EAX, FieldAddress(EDX, Array::data_offset())); | 1633 __ movl(EAX, FieldAddress(EDX, Array::data_offset())); |
| 1634 __ movl(EAX, Address(ESP, EAX, TIMES_2, -kWordSize)); | 1634 __ movl(EAX, Address(ESP, EAX, TIMES_2, -kWordSize)); |
| 1635 // EAX (argument count) is Smi. | 1635 // EAX (argument count) is Smi. |
| 1636 __ call(&get_class_id_as_smi); | 1636 __ call(&get_class_id_as_smi); |
| 1637 __ movl(EDI, Address(EBX, kWordSize)); | 1637 __ movl(EDI, Address(EBX, kWordSize)); |
| 1638 __ cmpl(EAX, EDI); // Class id match? | 1638 __ cmpl(EAX, EDI); // Class id match? |
| 1639 __ j(EQUAL, &found, Assembler::kNearJump); | 1639 __ j(EQUAL, &found, Assembler::kNearJump); |
| 1640 __ Bind(&no_match); | 1640 __ Bind(&no_match); |
| 1641 // Each test entry has (1 + num_args) array elements. | 1641 // Each test entry has (1 + num_args) array elements. |
| 1642 __ addl(EBX, Immediate(kWordSize * (1 + num_args))); // Next element. | 1642 __ addl(EBX, Immediate(kWordSize * (1 + num_args))); // Next element. |
| 1643 __ cmpl(EDI, raw_null); // Done? | 1643 __ cmpl(EDI, Immediate(Smi::RawValue(kIllegalObjectKind))); // Done? |
| 1644 __ j(NOT_EQUAL, &loop, Assembler::kNearJump); | 1644 __ j(NOT_EQUAL, &loop, Assembler::kNearJump); |
| 1645 } | 1645 } |
| 1646 | 1646 |
| 1647 __ Bind(&ic_miss); | 1647 __ Bind(&ic_miss); |
| 1648 // Compute address of arguments (first read number of arguments from argument | 1648 // Compute address of arguments (first read number of arguments from argument |
| 1649 // descriptor array and then compute address on the stack). | 1649 // descriptor array and then compute address on the stack). |
| 1650 __ movl(EAX, FieldAddress(EDX, Array::data_offset())); | 1650 __ movl(EAX, FieldAddress(EDX, Array::data_offset())); |
| 1651 __ leal(EAX, Address(ESP, EAX, TIMES_2, 0)); // EAX is Smi. | 1651 __ leal(EAX, Address(ESP, EAX, TIMES_2, 0)); // EAX is Smi. |
| 1652 // Create a stub frame as we are pushing some objects on the stack before | 1652 // Create a stub frame as we are pushing some objects on the stack before |
| 1653 // calling into the runtime. | 1653 // calling into the runtime. |
| (...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1945 __ movl(EAX, Address(ESP, 4 * kWordSize)); // Load error object. | 1945 __ movl(EAX, Address(ESP, 4 * kWordSize)); // Load error object. |
| 1946 __ movl(EBP, Address(ESP, 3 * kWordSize)); // Load target frame_pointer. | 1946 __ movl(EBP, Address(ESP, 3 * kWordSize)); // Load target frame_pointer. |
| 1947 __ movl(EBX, Address(ESP, 1 * kWordSize)); // Load target PC into EBX. | 1947 __ movl(EBX, Address(ESP, 1 * kWordSize)); // Load target PC into EBX. |
| 1948 __ movl(ESP, Address(ESP, 2 * kWordSize)); // Load target stack_pointer. | 1948 __ movl(ESP, Address(ESP, 2 * kWordSize)); // Load target stack_pointer. |
| 1949 __ jmp(EBX); // Jump to the exception handler code. | 1949 __ jmp(EBX); // Jump to the exception handler code. |
| 1950 } | 1950 } |
| 1951 | 1951 |
| 1952 } // namespace dart | 1952 } // namespace dart |
| 1953 | 1953 |
| 1954 #endif // defined TARGET_ARCH_IA32 | 1954 #endif // defined TARGET_ARCH_IA32 |
| OLD | NEW |