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

Side by Side Diff: runtime/vm/stub_code_x64.cc

Issue 9128002: Print stop message. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 11 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
« runtime/vm/stub_code_ia32.cc ('K') | « runtime/vm/stub_code_ia32.cc ('k') | no next file » | 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_X64) 6 #if defined(TARGET_ARCH_X64)
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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 // RSP + 8*R10 : address of first argument in argument array. 106 // RSP + 8*R10 : address of first argument in argument array.
107 // RSP + 8*R10 + 8 : address of return value. 107 // RSP + 8*R10 + 8 : address of return value.
108 // RBX : address of the runtime function to call. 108 // RBX : address of the runtime function to call.
109 // R10 : number of arguments to the call. 109 // R10 : number of arguments to the call.
110 // Must preserve callee saved registers R12 and R13. 110 // Must preserve callee saved registers R12 and R13.
111 void StubCode::GenerateStubCallToRuntimeStub(Assembler* assembler) { 111 void StubCode::GenerateStubCallToRuntimeStub(Assembler* assembler) {
112 GenerateCallRuntimeStub(assembler); 112 GenerateCallRuntimeStub(assembler);
113 } 113 }
114 114
115 115
116 // Input parameters: 116 // Input parameters:
Ivan Posva 2012/01/09 17:26:42 Same concerns as in the ia32 code.
regis 2012/01/10 00:09:16 Done.
117 // RSP : points to return address. 117 // RSP : points to return address.
118 // RSP + 8 : address of last argument in argument array.
119 // RSP + 8*R10 : address of first argument in argument array.
120 // RSP + 8*R10 + 8 : address of return value.
121 // RBX : address of the leaf function to call.
122 // R10 : number of arguments to the call.
123 // Must preserve callee saved registers R12 and R13.
124 static void GenerateCallLeafStub(Assembler* assembler) {
125 ASSERT((R12 != CTX) && (R13 != CTX));
126 const intptr_t isolate_offset = NativeArguments::isolate_offset();
127 const intptr_t argc_offset = NativeArguments::argc_offset();
128 const intptr_t argv_offset = NativeArguments::argv_offset();
129 const intptr_t retval_offset = NativeArguments::retval_offset();
130
131 __ EnterFrame(0);
132
133 // Reserve space for arguments and align frame before entering C++ world.
134 __ AddImmediate(RSP, Immediate(-sizeof(NativeArguments)));
135 if (OS::ActivationFrameAlignment() > 0) {
136 __ andq(RSP, Immediate(~(OS::ActivationFrameAlignment() - 1)));
137 }
138
139 // Pass NativeArguments structure by value and call runtime.
140 __ movq(Address(RSP, isolate_offset), Immediate(0)); // Set null isolate.
141 __ movq(Address(RSP, argc_offset), R10); // Set argc in NativeArguments.
142 __ leaq(RAX, Address(RBP, R10, TIMES_8, 1 * kWordSize)); // Compute argv.
143 __ movq(Address(RSP, argv_offset), RAX); // Set argv in NativeArguments.
144 __ addq(RAX, Immediate(1 * kWordSize)); // Retval is next to 1st argument.
145 __ movq(Address(RSP, retval_offset), RAX); // Set retval in NativeArguments.
146 __ call(RBX);
147
148 __ LeaveFrame();
149 __ ret();
150 }
151
152
153 // Print the stop message.
154 static void PrintStopMessage(NativeArguments arguments) {
155 ASSERT(arguments.Count() == 1);
156 const char* message = reinterpret_cast<const char*>(arguments.At(0));
157 OS::Print("Stop message: %s\n", message);
158 }
159
160
161 // Input parameters:
162 // RSP : points to return address.
163 // RSP + 8 : stop message (const char*).
164 void StubCode::GeneratePrintStopMessageStub(Assembler* assembler) {
165 __ movq(RBX, Immediate(reinterpret_cast<uword>(&PrintStopMessage)));
166 __ movq(R10, Immediate(1)); // One argument.
167 GenerateCallLeafStub(assembler);
168 }
169
170
171 // Input parameters:
172 // RSP : points to return address.
118 // RSP + 8 : address of return value. 173 // RSP + 8 : address of return value.
119 // RAX : address of first argument in argument array. 174 // RAX : address of first argument in argument array.
120 // RAX - 8*R10 + 8 : address of last argument in argument array. 175 // RAX - 8*R10 + 8 : address of last argument in argument array.
121 // RBX : address of the native function to call. 176 // RBX : address of the native function to call.
122 // R10 : number of arguments to the call. 177 // R10 : number of arguments to the call.
123 // Uses R8. 178 // Uses R8.
124 void StubCode::GenerateCallNativeCFunctionStub(Assembler* assembler) { 179 void StubCode::GenerateCallNativeCFunctionStub(Assembler* assembler) {
125 const intptr_t native_args_struct_offset = 0; 180 const intptr_t native_args_struct_offset = 0;
126 const intptr_t isolate_offset = 181 const intptr_t isolate_offset =
127 NativeArguments::isolate_offset() + native_args_struct_offset; 182 NativeArguments::isolate_offset() + native_args_struct_offset;
(...skipping 898 matching lines...) Expand 10 before | Expand all | Expand 10 after
1026 // RAX: new object 1081 // RAX: new object
1027 // Restore the frame pointer. 1082 // Restore the frame pointer.
1028 __ LeaveFrame(); 1083 __ LeaveFrame();
1029 __ ret(); 1084 __ ret();
1030 } 1085 }
1031 1086
1032 1087
1033 // Called for inline allocation of closures. 1088 // Called for inline allocation of closures.
1034 // Input parameters: 1089 // Input parameters:
1035 // If the signature class is not parameterized, the receiver, if any, will be 1090 // If the signature class is not parameterized, the receiver, if any, will be
1036 // at RSP + 4 instead of RSP + 8, since no type arguments are passed. 1091 // at RSP + 8 instead of RSP + 16, since no type arguments are passed.
Ivan Posva 2012/01/09 17:26:42 Thanks!
regis 2012/01/10 00:09:16 Welcome.
1037 // RSP + 8 (or RSP + 4): receiver (only if implicit instance closure). 1092 // RSP + 16 (or RSP + 8): receiver (only if implicit instance closure).
1038 // RSP + 4 : type arguments object (only if signature class is parameterized). 1093 // RSP + 8 : type arguments object (only if signature class is parameterized).
1039 // RSP : points to return address. 1094 // RSP : points to return address.
1040 // Uses RAX, RBX, RCX, RDX as temporary registers. 1095 // Uses RAX, RCX as temporary registers.
1041 void StubCode::GenerateAllocationStubForClosure(Assembler* assembler, 1096 void StubCode::GenerateAllocationStubForClosure(Assembler* assembler,
1042 const Function& func) { 1097 const Function& func) {
1043 const Immediate raw_null = 1098 const Immediate raw_null =
1044 Immediate(reinterpret_cast<intptr_t>(Object::null())); 1099 Immediate(reinterpret_cast<intptr_t>(Object::null()));
1045 ASSERT(func.IsClosureFunction()); 1100 ASSERT(func.IsClosureFunction());
1046 const bool is_implicit_static_closure = 1101 const bool is_implicit_static_closure =
1047 func.IsImplicitStaticClosureFunction(); 1102 func.IsImplicitStaticClosureFunction();
1048 const bool is_implicit_instance_closure = 1103 const bool is_implicit_instance_closure =
1049 func.IsImplicitInstanceClosureFunction(); 1104 func.IsImplicitInstanceClosureFunction();
1050 const Class& cls = Class::ZoneHandle(func.signature_class()); 1105 const Class& cls = Class::ZoneHandle(func.signature_class());
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
1266 } 1321 }
1267 1322
1268 1323
1269 void StubCode::GenerateBreakpointDynamicStub(Assembler* assembler) { 1324 void StubCode::GenerateBreakpointDynamicStub(Assembler* assembler) {
1270 __ Unimplemented("BreakpointDynamic stub"); 1325 __ Unimplemented("BreakpointDynamic stub");
1271 } 1326 }
1272 1327
1273 } // namespace dart 1328 } // namespace dart
1274 1329
1275 #endif // defined TARGET_ARCH_X64 1330 #endif // defined TARGET_ARCH_X64
OLDNEW
« runtime/vm/stub_code_ia32.cc ('K') | « runtime/vm/stub_code_ia32.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698