| 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/code_generator.h" | 8 #include "vm/code_generator.h" |
| 9 #include "vm/compiler.h" | 9 #include "vm/compiler.h" |
| 10 #include "vm/ic_data.h" | 10 #include "vm/ic_data.h" |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 // ESP + 4*EDX : address of first argument in argument array. | 105 // ESP + 4*EDX : address of first argument in argument array. |
| 106 // ESP + 4*EDX + 4 : address of return value. | 106 // ESP + 4*EDX + 4 : address of return value. |
| 107 // ECX : address of the runtime function to call. | 107 // ECX : address of the runtime function to call. |
| 108 // EDX : number of arguments to the call. | 108 // EDX : number of arguments to the call. |
| 109 // Must preserve callee saved registers EDI and EBX. | 109 // Must preserve callee saved registers EDI and EBX. |
| 110 void StubCode::GenerateStubCallToRuntimeStub(Assembler* assembler) { | 110 void StubCode::GenerateStubCallToRuntimeStub(Assembler* assembler) { |
| 111 GenerateCallRuntimeStub(assembler); | 111 GenerateCallRuntimeStub(assembler); |
| 112 } | 112 } |
| 113 | 113 |
| 114 | 114 |
| 115 // Print the stop message. |
| 116 static void PrintStopMessage(const char* message) { |
| 117 OS::Print("Stop message: %s\n", message); |
| 118 } |
| 119 |
| 120 |
| 121 // Input parameters: |
| 122 // ESP : points to return address. |
| 123 // EAX : stop message (const char*). |
| 124 // Must preserve all registers, except EAX. |
| 125 void StubCode::GeneratePrintStopMessageStub(Assembler* assembler) { |
| 126 // Preserve caller-saved registers. |
| 127 __ pushl(ECX); |
| 128 __ pushl(EDX); |
| 129 |
| 130 __ EnterFrame(0); |
| 131 |
| 132 // Reserve space for the native argument and align frame before entering |
| 133 // the C++ world. |
| 134 __ AddImmediate(ESP, Immediate(-sizeof(kWordSize))); |
| 135 if (OS::ActivationFrameAlignment() > 0) { |
| 136 __ andl(ESP, Immediate(~(OS::ActivationFrameAlignment() - 1))); |
| 137 } |
| 138 |
| 139 // Pass argument and call native function. |
| 140 __ movl(Address(ESP, 0), EAX); |
| 141 __ movl(EAX, Immediate(reinterpret_cast<uword>(&PrintStopMessage))); |
| 142 __ call(EAX); |
| 143 __ popl(EAX); |
| 144 |
| 145 __ LeaveFrame(); |
| 146 |
| 147 // Restore caller-saved registers. |
| 148 __ popl(EDX); |
| 149 __ popl(ECX); |
| 150 |
| 151 __ ret(); |
| 152 } |
| 153 |
| 154 |
| 115 // Input parameters: | 155 // Input parameters: |
| 116 // ESP : points to return address. | 156 // ESP : points to return address. |
| 117 // ESP + 4 : address of return value. | 157 // ESP + 4 : address of return value. |
| 118 // EAX : address of first argument in argument array. | 158 // EAX : address of first argument in argument array. |
| 119 // EAX - 4*EDX + 4 : address of last argument in argument array. | 159 // EAX - 4*EDX + 4 : address of last argument in argument array. |
| 120 // ECX : address of the native function to call. | 160 // ECX : address of the native function to call. |
| 121 // EDX : number of arguments to the call. | 161 // EDX : number of arguments to the call. |
| 122 // Uses EDI. | 162 // Uses EDI. |
| 123 void StubCode::GenerateCallNativeCFunctionStub(Assembler* assembler) { | 163 void StubCode::GenerateCallNativeCFunctionStub(Assembler* assembler) { |
| 124 const intptr_t native_args_struct_offset = kWordSize; | 164 const intptr_t native_args_struct_offset = kWordSize; |
| (...skipping 1562 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1687 __ popl(EDX); | 1727 __ popl(EDX); |
| 1688 __ popl(ECX); | 1728 __ popl(ECX); |
| 1689 __ LeaveFrame(); | 1729 __ LeaveFrame(); |
| 1690 // Now call the dynamic function. | 1730 // Now call the dynamic function. |
| 1691 __ jmp(&StubCode::OneArgCheckInlineCacheLabel()); | 1731 __ jmp(&StubCode::OneArgCheckInlineCacheLabel()); |
| 1692 } | 1732 } |
| 1693 | 1733 |
| 1694 } // namespace dart | 1734 } // namespace dart |
| 1695 | 1735 |
| 1696 #endif // defined TARGET_ARCH_IA32 | 1736 #endif // defined TARGET_ARCH_IA32 |
| OLD | NEW |