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/assembler.h" | 8 #include "vm/assembler.h" |
| 9 #include "vm/assembler_macros.h" | 9 #include "vm/assembler_macros.h" |
| 10 #include "vm/code_generator.h" | 10 #include "vm/code_generator.h" |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 81 __ movl(Address(CTX, Isolate::top_context_offset()), raw_null); | 81 __ movl(Address(CTX, Isolate::top_context_offset()), raw_null); |
| 82 | 82 |
| 83 // Cache Context pointer into CTX while executing Dart code. | 83 // Cache Context pointer into CTX while executing Dart code. |
| 84 __ movl(CTX, ECX); | 84 __ movl(CTX, ECX); |
| 85 | 85 |
| 86 __ LeaveFrame(); | 86 __ LeaveFrame(); |
| 87 __ ret(); | 87 __ ret(); |
| 88 } | 88 } |
| 89 | 89 |
| 90 | 90 |
| 91 // Input parameters: | |
| 92 // ESP : points to return address. | |
| 93 // ESP + 4 : address of last argument in argument array. | |
| 94 // ESP + 4*EDX : address of first argument in argument array. | |
| 95 // ESP + 4*EDX + 4 : address of return value. | |
| 96 // ECX : address of the runtime function to call. | |
| 97 // EDX : number of arguments to the call. | |
| 98 // Must preserve callee saved registers EDI and EBX. | |
| 99 void StubCode::GenerateCallToLeafRuntimeStub(Assembler* assembler) { | |
| 100 const intptr_t isolate_offset = NativeArguments::isolate_offset(); | |
| 101 const intptr_t argc_offset = NativeArguments::argc_offset(); | |
| 102 const intptr_t argv_offset = NativeArguments::argv_offset(); | |
| 103 | |
| 104 __ EnterFrame(0); | |
|
srdjan
2012/06/12 20:10:41
Why do you need the frame enter and leave? No stac
siva
2012/06/12 21:18:04
Yes, I would love to get rid of this too, but the
| |
| 105 | |
| 106 // Reserve space for arguments and align frame before entering C++ world. | |
| 107 __ AddImmediate(ESP, Immediate(-sizeof(NativeArguments))); | |
| 108 if (OS::ActivationFrameAlignment() > 0) { | |
| 109 __ andl(ESP, Immediate(~(OS::ActivationFrameAlignment() - 1))); | |
| 110 } | |
| 111 | |
| 112 // Pass NativeArguments structure by value. | |
| 113 // NOTE: the retvalue area in the NativeArguments structure is not setup | |
| 114 // as leaf routines return the value in EAX. | |
| 115 __ movl(EAX, FieldAddress(CTX, Context::isolate_offset())); | |
| 116 __ movl(Address(ESP, isolate_offset), EAX); // Set isolate in NativeArgs. | |
| 117 __ movl(Address(ESP, argc_offset), EDX); // Set argc in NativeArguments. | |
| 118 __ leal(EAX, Address(EBP, EDX, TIMES_4, 1 * kWordSize)); // Compute argv. | |
| 119 __ movl(Address(ESP, argv_offset), EAX); // Set argv in NativeArguments. | |
| 120 | |
| 121 // Make call to leaf runtime entry. | |
| 122 __ call(ECX); | |
| 123 | |
| 124 // Set return value in caller's frame. | |
| 125 __ movl(ECX, Address(ESP, argv_offset)); | |
| 126 __ addl(ECX, Immediate(1 * kWordSize)); // Retval is next to 1st argument. | |
| 127 __ movl(Address(ECX, 0), EAX); | |
| 128 | |
| 129 __ LeaveFrame(); | |
| 130 __ ret(); | |
| 131 } | |
| 132 | |
| 133 | |
| 91 // Print the stop message. | 134 // Print the stop message. |
| 92 static void PrintStopMessage(const char* message) { | 135 static void PrintStopMessage(const char* message) { |
| 93 OS::Print("Stop message: %s\n", message); | 136 OS::Print("Stop message: %s\n", message); |
| 94 } | 137 } |
| 95 | 138 |
| 96 | 139 |
| 97 // Input parameters: | 140 // Input parameters: |
| 98 // ESP : points to return address. | 141 // ESP : points to return address. |
| 99 // EAX : stop message (const char*). | 142 // EAX : stop message (const char*). |
| 100 // Must preserve all registers, except EAX. | 143 // Must preserve all registers, except EAX. |
| (...skipping 1753 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1854 // TOS + 2: instance. | 1897 // TOS + 2: instance. |
| 1855 // TOS + 3: cache array. | 1898 // TOS + 3: cache array. |
| 1856 // Result in ECX: null -> not found, otherwise result (true or false). | 1899 // Result in ECX: null -> not found, otherwise result (true or false). |
| 1857 void StubCode::GenerateSubtype3TestCacheStub(Assembler* assembler) { | 1900 void StubCode::GenerateSubtype3TestCacheStub(Assembler* assembler) { |
| 1858 GenerateSubtypeNTestCacheStub(assembler, 3); | 1901 GenerateSubtypeNTestCacheStub(assembler, 3); |
| 1859 } | 1902 } |
| 1860 | 1903 |
| 1861 } // namespace dart | 1904 } // namespace dart |
| 1862 | 1905 |
| 1863 #endif // defined TARGET_ARCH_IA32 | 1906 #endif // defined TARGET_ARCH_IA32 |
| OLD | NEW |