Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(248)

Side by Side Diff: vm/stub_code_ia32.cc

Issue 10592006: Rework leaf calls as just simple C calls with a signature and not the NativeArgumentDescriptor. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « vm/stub_code.h ('k') | vm/stub_code_ia32_test.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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);
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
134 // Print the stop message. 91 // Print the stop message.
135 static void PrintStopMessage(const char* message) { 92 static void PrintStopMessage(const char* message) {
136 OS::Print("Stop message: %s\n", message); 93 OS::Print("Stop message: %s\n", message);
137 } 94 }
138 95
139 96
140 // Input parameters: 97 // Input parameters:
141 // ESP : points to return address. 98 // ESP : points to return address.
142 // EAX : stop message (const char*). 99 // EAX : stop message (const char*).
143 // Must preserve all registers, except EAX. 100 // Must preserve all registers, except EAX.
(...skipping 1756 matching lines...) Expand 10 before | Expand all | Expand 10 after
1900 // TOS + 2: instance. 1857 // TOS + 2: instance.
1901 // TOS + 3: cache array. 1858 // TOS + 3: cache array.
1902 // Result in ECX: null -> not found, otherwise result (true or false). 1859 // Result in ECX: null -> not found, otherwise result (true or false).
1903 void StubCode::GenerateSubtype3TestCacheStub(Assembler* assembler) { 1860 void StubCode::GenerateSubtype3TestCacheStub(Assembler* assembler) {
1904 GenerateSubtypeNTestCacheStub(assembler, 3); 1861 GenerateSubtypeNTestCacheStub(assembler, 3);
1905 } 1862 }
1906 1863
1907 } // namespace dart 1864 } // namespace dart
1908 1865
1909 #endif // defined TARGET_ARCH_IA32 1866 #endif // defined TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « vm/stub_code.h ('k') | vm/stub_code_ia32_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698