Chromium Code Reviews| 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 // Align frame before entering C++ world. | |
| 133 if (OS::ActivationFrameAlignment() > 0) { | |
| 134 __ andl(ESP, Immediate(~(OS::ActivationFrameAlignment() - 1))); | |
| 135 } | |
| 136 | |
| 137 __ pushl(EAX); | |
|
Ivan Posva
2012/01/10 00:18:17
Destroys stack alignment.
regis
2012/01/10 00:32:37
Good catch. Fixed.
| |
| 138 __ movl(EAX, Immediate(reinterpret_cast<uword>(&PrintStopMessage))); | |
| 139 __ call(EAX); | |
| 140 __ popl(EAX); | |
| 141 | |
| 142 __ LeaveFrame(); | |
| 143 | |
| 144 // Restore caller-saved registers. | |
| 145 __ popl(EDX); | |
| 146 __ popl(ECX); | |
| 147 | |
| 148 __ ret(); | |
| 149 } | |
| 150 | |
| 151 | |
| 115 // Input parameters: | 152 // Input parameters: |
| 116 // ESP : points to return address. | 153 // ESP : points to return address. |
| 117 // ESP + 4 : address of return value. | 154 // ESP + 4 : address of return value. |
| 118 // EAX : address of first argument in argument array. | 155 // EAX : address of first argument in argument array. |
| 119 // EAX - 4*EDX + 4 : address of last argument in argument array. | 156 // EAX - 4*EDX + 4 : address of last argument in argument array. |
| 120 // ECX : address of the native function to call. | 157 // ECX : address of the native function to call. |
| 121 // EDX : number of arguments to the call. | 158 // EDX : number of arguments to the call. |
| 122 // Uses EDI. | 159 // Uses EDI. |
| 123 void StubCode::GenerateCallNativeCFunctionStub(Assembler* assembler) { | 160 void StubCode::GenerateCallNativeCFunctionStub(Assembler* assembler) { |
| 124 const intptr_t native_args_struct_offset = kWordSize; | 161 const intptr_t native_args_struct_offset = kWordSize; |
| (...skipping 1562 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1687 __ popl(EDX); | 1724 __ popl(EDX); |
| 1688 __ popl(ECX); | 1725 __ popl(ECX); |
| 1689 __ LeaveFrame(); | 1726 __ LeaveFrame(); |
| 1690 // Now call the dynamic function. | 1727 // Now call the dynamic function. |
| 1691 __ jmp(&StubCode::OneArgCheckInlineCacheLabel()); | 1728 __ jmp(&StubCode::OneArgCheckInlineCacheLabel()); |
| 1692 } | 1729 } |
| 1693 | 1730 |
| 1694 } // namespace dart | 1731 } // namespace dart |
| 1695 | 1732 |
| 1696 #endif // defined TARGET_ARCH_IA32 | 1733 #endif // defined TARGET_ARCH_IA32 |
| OLD | NEW |