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_IA32) | 6 #if defined(TARGET_ARCH_IA32) |
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 1595 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1606 const intptr_t target_offset = ICData::TargetIndexFor(num_args) * kWordSize; | 1606 const intptr_t target_offset = ICData::TargetIndexFor(num_args) * kWordSize; |
1607 const intptr_t count_offset = ICData::CountIndexFor(num_args) * kWordSize; | 1607 const intptr_t count_offset = ICData::CountIndexFor(num_args) * kWordSize; |
1608 __ movl(EAX, Address(EBX, target_offset)); | 1608 __ movl(EAX, Address(EBX, target_offset)); |
1609 __ addl(Address(EBX, count_offset), Immediate(Smi::RawValue(1))); | 1609 __ addl(Address(EBX, count_offset), Immediate(Smi::RawValue(1))); |
1610 __ j(NO_OVERFLOW, &call_target_function, Assembler::kNearJump); | 1610 __ j(NO_OVERFLOW, &call_target_function, Assembler::kNearJump); |
1611 __ movl(Address(EBX, count_offset), | 1611 __ movl(Address(EBX, count_offset), |
1612 Immediate(Smi::RawValue(Smi::kMaxValue))); | 1612 Immediate(Smi::RawValue(Smi::kMaxValue))); |
1613 | 1613 |
1614 __ Bind(&call_target_function); | 1614 __ Bind(&call_target_function); |
1615 // EAX: Target function. | 1615 // EAX: Target function. |
1616 __ movl(EAX, FieldAddress(EAX, Function::code_offset())); | 1616 Label is_compiled; |
1617 __ movl(EAX, FieldAddress(EAX, Code::instructions_offset())); | 1617 __ movl(EBX, FieldAddress(EAX, Function::code_offset())); |
| 1618 if (FLAG_collect_code) { |
| 1619 // If code might be GC'd, then EBX might be null. If it is, recompile. |
| 1620 __ cmpl(EBX, raw_null); |
| 1621 __ j(NOT_EQUAL, &is_compiled, Assembler::kNearJump); |
| 1622 __ EnterStubFrame(); |
| 1623 __ pushl(EDX); // Preserve arguments descriptor array. |
| 1624 __ pushl(ECX); // Preserve IC data object. |
| 1625 __ pushl(EAX); // Pass function. |
| 1626 __ CallRuntime(kCompileFunctionRuntimeEntry, 1); |
| 1627 __ popl(EAX); // Restore function. |
| 1628 __ popl(ECX); // Restore IC data array. |
| 1629 __ popl(EDX); // Restore arguments descriptor array. |
| 1630 __ LeaveFrame(); |
| 1631 __ movl(EBX, FieldAddress(EAX, Function::code_offset())); |
| 1632 __ Bind(&is_compiled); |
| 1633 } |
| 1634 __ movl(EAX, FieldAddress(EBX, Code::instructions_offset())); |
1618 __ addl(EAX, Immediate(Instructions::HeaderSize() - kHeapObjectTag)); | 1635 __ addl(EAX, Immediate(Instructions::HeaderSize() - kHeapObjectTag)); |
1619 __ jmp(EAX); | 1636 __ jmp(EAX); |
1620 | 1637 |
1621 // Instance in EAX, return its class-id in EAX as Smi. | 1638 // Instance in EAX, return its class-id in EAX as Smi. |
1622 __ Bind(&get_class_id_as_smi); | 1639 __ Bind(&get_class_id_as_smi); |
1623 Label not_smi; | 1640 Label not_smi; |
1624 // Test if Smi -> load Smi class for comparison. | 1641 // Test if Smi -> load Smi class for comparison. |
1625 __ testl(EAX, Immediate(kSmiTagMask)); | 1642 __ testl(EAX, Immediate(kSmiTagMask)); |
1626 __ j(NOT_ZERO, ¬_smi, Assembler::kNearJump); | 1643 __ j(NOT_ZERO, ¬_smi, Assembler::kNearJump); |
1627 __ movl(EAX, Immediate(Smi::RawValue(kSmiCid))); | 1644 __ movl(EAX, Immediate(Smi::RawValue(kSmiCid))); |
(...skipping 545 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2173 GenerateIdenticalWithNumberCheckStub(assembler, left, right, temp); | 2190 GenerateIdenticalWithNumberCheckStub(assembler, left, right, temp); |
2174 __ popl(temp); | 2191 __ popl(temp); |
2175 __ popl(right); | 2192 __ popl(right); |
2176 __ popl(left); | 2193 __ popl(left); |
2177 __ ret(); | 2194 __ ret(); |
2178 } | 2195 } |
2179 | 2196 |
2180 } // namespace dart | 2197 } // namespace dart |
2181 | 2198 |
2182 #endif // defined TARGET_ARCH_IA32 | 2199 #endif // defined TARGET_ARCH_IA32 |
OLD | NEW |