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

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

Issue 1189573004: Use object pool for runtime calls. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 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
« no previous file with comments | « runtime/vm/stub_code_arm64.cc ('k') | runtime/vm/stub_code_x64.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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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_MIPS) 6 #if defined(TARGET_ARCH_MIPS)
7 7
8 #include "vm/assembler.h" 8 #include "vm/assembler.h"
9 #include "vm/code_generator.h" 9 #include "vm/code_generator.h"
10 #include "vm/compiler.h" 10 #include "vm/compiler.h"
(...skipping 26 matching lines...) Expand all
37 // S4 : number of arguments to the call. 37 // S4 : number of arguments to the call.
38 void StubCode::GenerateCallToRuntimeStub(Assembler* assembler) { 38 void StubCode::GenerateCallToRuntimeStub(Assembler* assembler) {
39 const intptr_t thread_offset = NativeArguments::thread_offset(); 39 const intptr_t thread_offset = NativeArguments::thread_offset();
40 const intptr_t argc_tag_offset = NativeArguments::argc_tag_offset(); 40 const intptr_t argc_tag_offset = NativeArguments::argc_tag_offset();
41 const intptr_t argv_offset = NativeArguments::argv_offset(); 41 const intptr_t argv_offset = NativeArguments::argv_offset();
42 const intptr_t retval_offset = NativeArguments::retval_offset(); 42 const intptr_t retval_offset = NativeArguments::retval_offset();
43 const intptr_t exitframe_last_param_slot_from_fp = 2; 43 const intptr_t exitframe_last_param_slot_from_fp = 2;
44 44
45 __ SetPrologueOffset(); 45 __ SetPrologueOffset();
46 __ Comment("CallToRuntimeStub"); 46 __ Comment("CallToRuntimeStub");
47 __ addiu(SP, SP, Immediate(-3 * kWordSize)); 47 __ EnterStubFrame();
48 __ sw(ZR, Address(SP, 2 * kWordSize)); // Push 0 for the PC marker
49 __ sw(RA, Address(SP, 1 * kWordSize));
50 __ sw(FP, Address(SP, 0 * kWordSize));
51 __ mov(FP, SP);
52 48
53 COMPILE_ASSERT((kAbiPreservedCpuRegs & (1 << S6)) != 0); 49 COMPILE_ASSERT((kAbiPreservedCpuRegs & (1 << S6)) != 0);
54 __ LoadIsolate(S6); 50 __ LoadIsolate(S6);
55 51
56 // Save exit frame information to enable stack walking as we are about 52 // Save exit frame information to enable stack walking as we are about
57 // to transition to Dart VM C++ code. 53 // to transition to Dart VM C++ code.
58 __ sw(FP, Address(S6, Isolate::top_exit_frame_info_offset())); 54 __ sw(FP, Address(S6, Isolate::top_exit_frame_info_offset()));
59 55
60 #if defined(DEBUG) 56 #if defined(DEBUG)
61 { Label ok; 57 { Label ok;
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 __ delay_slot()->addiu(A3, A2, Immediate(kWordSize)); 101 __ delay_slot()->addiu(A3, A2, Immediate(kWordSize));
106 __ Comment("CallToRuntimeStub return"); 102 __ Comment("CallToRuntimeStub return");
107 103
108 // Mark that the isolate is executing Dart code. 104 // Mark that the isolate is executing Dart code.
109 __ LoadImmediate(A2, VMTag::kDartTagId); 105 __ LoadImmediate(A2, VMTag::kDartTagId);
110 __ sw(A2, Address(S6, Isolate::vm_tag_offset())); 106 __ sw(A2, Address(S6, Isolate::vm_tag_offset()));
111 107
112 // Reset exit frame information in Isolate structure. 108 // Reset exit frame information in Isolate structure.
113 __ sw(ZR, Address(S6, Isolate::top_exit_frame_info_offset())); 109 __ sw(ZR, Address(S6, Isolate::top_exit_frame_info_offset()));
114 110
115 __ mov(SP, FP); 111 __ LeaveStubFrameAndReturn();
116 __ lw(RA, Address(SP, 1 * kWordSize));
117 __ lw(FP, Address(SP, 0 * kWordSize));
118 __ Ret();
119 __ delay_slot()->addiu(SP, SP, Immediate(3 * kWordSize));
120 } 112 }
121 113
122 114
123 // Print the stop message. 115 // Print the stop message.
124 DEFINE_LEAF_RUNTIME_ENTRY(void, PrintStopMessage, 1, const char* message) { 116 DEFINE_LEAF_RUNTIME_ENTRY(void, PrintStopMessage, 1, const char* message) {
125 OS::Print("Stop message: %s\n", message); 117 OS::Print("Stop message: %s\n", message);
126 } 118 }
127 END_LEAF_RUNTIME_ENTRY 119 END_LEAF_RUNTIME_ENTRY
128 120
129 121
(...skipping 16 matching lines...) Expand all
146 // A2 : address of first argument in argument array. 138 // A2 : address of first argument in argument array.
147 // A1 : argc_tag including number of arguments and function kind. 139 // A1 : argc_tag including number of arguments and function kind.
148 void StubCode::GenerateCallNativeCFunctionStub(Assembler* assembler) { 140 void StubCode::GenerateCallNativeCFunctionStub(Assembler* assembler) {
149 const intptr_t thread_offset = NativeArguments::thread_offset(); 141 const intptr_t thread_offset = NativeArguments::thread_offset();
150 const intptr_t argc_tag_offset = NativeArguments::argc_tag_offset(); 142 const intptr_t argc_tag_offset = NativeArguments::argc_tag_offset();
151 const intptr_t argv_offset = NativeArguments::argv_offset(); 143 const intptr_t argv_offset = NativeArguments::argv_offset();
152 const intptr_t retval_offset = NativeArguments::retval_offset(); 144 const intptr_t retval_offset = NativeArguments::retval_offset();
153 145
154 __ SetPrologueOffset(); 146 __ SetPrologueOffset();
155 __ Comment("CallNativeCFunctionStub"); 147 __ Comment("CallNativeCFunctionStub");
156 __ addiu(SP, SP, Immediate(-3 * kWordSize)); 148 __ EnterStubFrame();
157 __ sw(ZR, Address(SP, 2 * kWordSize)); // Push 0 for the PC marker
158 __ sw(RA, Address(SP, 1 * kWordSize));
159 __ sw(FP, Address(SP, 0 * kWordSize));
160 __ mov(FP, SP);
161 149
162 COMPILE_ASSERT((kAbiPreservedCpuRegs & (1 << S6)) != 0); 150 COMPILE_ASSERT((kAbiPreservedCpuRegs & (1 << S6)) != 0);
163 __ LoadIsolate(S6); 151 __ LoadIsolate(S6);
164 152
165 // Save exit frame information to enable stack walking as we are about 153 // Save exit frame information to enable stack walking as we are about
166 // to transition to native code. 154 // to transition to native code.
167 __ sw(FP, Address(S6, Isolate::top_exit_frame_info_offset())); 155 __ sw(FP, Address(S6, Isolate::top_exit_frame_info_offset()));
168 156
169 #if defined(DEBUG) 157 #if defined(DEBUG)
170 { Label ok; 158 { Label ok;
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 #endif 210 #endif
223 __ Comment("CallNativeCFunctionStub return"); 211 __ Comment("CallNativeCFunctionStub return");
224 212
225 // Mark that the isolate is executing Dart code. 213 // Mark that the isolate is executing Dart code.
226 __ LoadImmediate(A2, VMTag::kDartTagId); 214 __ LoadImmediate(A2, VMTag::kDartTagId);
227 __ sw(A2, Address(S6, Isolate::vm_tag_offset())); 215 __ sw(A2, Address(S6, Isolate::vm_tag_offset()));
228 216
229 // Reset exit frame information in Isolate structure. 217 // Reset exit frame information in Isolate structure.
230 __ sw(ZR, Address(S6, Isolate::top_exit_frame_info_offset())); 218 __ sw(ZR, Address(S6, Isolate::top_exit_frame_info_offset()));
231 219
232 __ mov(SP, FP); 220 __ LeaveStubFrameAndReturn();
233 __ lw(RA, Address(SP, 1 * kWordSize));
234 __ lw(FP, Address(SP, 0 * kWordSize));
235 __ Ret();
236 __ delay_slot()->addiu(SP, SP, Immediate(3 * kWordSize));
237 } 221 }
238 222
239 223
240 // Input parameters: 224 // Input parameters:
241 // RA : return address. 225 // RA : return address.
242 // SP : address of return value. 226 // SP : address of return value.
243 // T5 : address of the native function to call. 227 // T5 : address of the native function to call.
244 // A2 : address of first argument in argument array. 228 // A2 : address of first argument in argument array.
245 // A1 : argc_tag including number of arguments and function kind. 229 // A1 : argc_tag including number of arguments and function kind.
246 void StubCode::GenerateCallBootstrapCFunctionStub(Assembler* assembler) { 230 void StubCode::GenerateCallBootstrapCFunctionStub(Assembler* assembler) {
247 const intptr_t thread_offset = NativeArguments::thread_offset(); 231 const intptr_t thread_offset = NativeArguments::thread_offset();
248 const intptr_t argc_tag_offset = NativeArguments::argc_tag_offset(); 232 const intptr_t argc_tag_offset = NativeArguments::argc_tag_offset();
249 const intptr_t argv_offset = NativeArguments::argv_offset(); 233 const intptr_t argv_offset = NativeArguments::argv_offset();
250 const intptr_t retval_offset = NativeArguments::retval_offset(); 234 const intptr_t retval_offset = NativeArguments::retval_offset();
251 235
252 __ SetPrologueOffset(); 236 __ SetPrologueOffset();
253 __ Comment("CallNativeCFunctionStub"); 237 __ Comment("CallNativeCFunctionStub");
254 __ addiu(SP, SP, Immediate(-3 * kWordSize)); 238 __ EnterStubFrame();
255 __ sw(ZR, Address(SP, 2 * kWordSize)); // Push 0 for the PC marker
256 __ sw(RA, Address(SP, 1 * kWordSize));
257 __ sw(FP, Address(SP, 0 * kWordSize));
258 __ mov(FP, SP);
259 239
260 COMPILE_ASSERT((kAbiPreservedCpuRegs & (1 << S6)) != 0); 240 COMPILE_ASSERT((kAbiPreservedCpuRegs & (1 << S6)) != 0);
261 __ LoadIsolate(S6); 241 __ LoadIsolate(S6);
262 242
263 // Save exit frame information to enable stack walking as we are about 243 // Save exit frame information to enable stack walking as we are about
264 // to transition to native code. 244 // to transition to native code.
265 __ sw(FP, Address(S6, Isolate::top_exit_frame_info_offset())); 245 __ sw(FP, Address(S6, Isolate::top_exit_frame_info_offset()));
266 246
267 #if defined(DEBUG) 247 #if defined(DEBUG)
268 { Label ok; 248 { Label ok;
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
315 __ jalr(T9); 295 __ jalr(T9);
316 __ Comment("CallNativeCFunctionStub return"); 296 __ Comment("CallNativeCFunctionStub return");
317 297
318 // Mark that the isolate is executing Dart code. 298 // Mark that the isolate is executing Dart code.
319 __ LoadImmediate(A2, VMTag::kDartTagId); 299 __ LoadImmediate(A2, VMTag::kDartTagId);
320 __ sw(A2, Address(S6, Isolate::vm_tag_offset())); 300 __ sw(A2, Address(S6, Isolate::vm_tag_offset()));
321 301
322 // Reset exit frame information in Isolate structure. 302 // Reset exit frame information in Isolate structure.
323 __ sw(ZR, Address(S6, Isolate::top_exit_frame_info_offset())); 303 __ sw(ZR, Address(S6, Isolate::top_exit_frame_info_offset()));
324 304
325 __ mov(SP, FP); 305 __ LeaveStubFrameAndReturn();
326 __ lw(RA, Address(SP, 1 * kWordSize));
327 __ lw(FP, Address(SP, 0 * kWordSize));
328 __ Ret();
329 __ delay_slot()->addiu(SP, SP, Immediate(3 * kWordSize));
330 } 306 }
331 307
332 308
333 // Input parameters: 309 // Input parameters:
334 // S4: arguments descriptor array. 310 // S4: arguments descriptor array.
335 void StubCode::GenerateCallStaticFunctionStub(Assembler* assembler) { 311 void StubCode::GenerateCallStaticFunctionStub(Assembler* assembler) {
336 __ Comment("CallStaticFunctionStub"); 312 __ Comment("CallStaticFunctionStub");
337 __ EnterStubFrame(); 313 __ EnterStubFrame();
338 // Setup space on stack for return value and preserve arguments descriptor. 314 // Setup space on stack for return value and preserve arguments descriptor.
339 315
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
584 __ addiu(SP, FP, Immediate(-kWordSize)); 560 __ addiu(SP, FP, Immediate(-kWordSize));
585 __ lw(RA, Address(SP, 2 * kWordSize)); 561 __ lw(RA, Address(SP, 2 * kWordSize));
586 __ lw(FP, Address(SP, 1 * kWordSize)); 562 __ lw(FP, Address(SP, 1 * kWordSize));
587 __ lw(PP, Address(SP, 0 * kWordSize)); 563 __ lw(PP, Address(SP, 0 * kWordSize));
588 __ addiu(SP, SP, Immediate(4 * kWordSize)); 564 __ addiu(SP, SP, Immediate(4 * kWordSize));
589 565
590 // Frame is fully rewritten at this point and it is safe to perform a GC. 566 // Frame is fully rewritten at this point and it is safe to perform a GC.
591 // Materialize any objects that were deferred by FillFrame because they 567 // Materialize any objects that were deferred by FillFrame because they
592 // require allocation. 568 // require allocation.
593 // Enter stub frame with loading PP. The caller's PP is not materialized yet. 569 // Enter stub frame with loading PP. The caller's PP is not materialized yet.
594 __ EnterStubFrame(true); 570 __ EnterStubFrame();
595 if (preserve_result) { 571 if (preserve_result) {
596 __ Push(T1); // Preserve result, it will be GC-d here. 572 __ Push(T1); // Preserve result, it will be GC-d here.
597 } 573 }
598 __ PushObject(Smi::ZoneHandle()); // Space for the result. 574 __ PushObject(Smi::ZoneHandle()); // Space for the result.
599 __ CallRuntime(kDeoptimizeMaterializeRuntimeEntry, 0); 575 __ CallRuntime(kDeoptimizeMaterializeRuntimeEntry, 0);
600 // Result tells stub how many bytes to remove from the expression stack 576 // Result tells stub how many bytes to remove from the expression stack
601 // of the bottom-most frame. They were used as materialization arguments. 577 // of the bottom-most frame. They were used as materialization arguments.
602 __ Pop(T1); 578 __ Pop(T1);
603 if (preserve_result) { 579 if (preserve_result) {
604 __ Pop(V0); // Restore result. 580 __ Pop(V0); // Restore result.
(...skipping 631 matching lines...) Expand 10 before | Expand all | Expand 10 after
1236 // T2: new object still missing its heap tag. 1212 // T2: new object still missing its heap tag.
1237 __ Ret(); 1213 __ Ret();
1238 __ delay_slot()->addiu(V0, T2, Immediate(kHeapObjectTag)); 1214 __ delay_slot()->addiu(V0, T2, Immediate(kHeapObjectTag));
1239 1215
1240 __ Bind(&slow_case); 1216 __ Bind(&slow_case);
1241 } 1217 }
1242 // If is_cls_parameterized: 1218 // If is_cls_parameterized:
1243 // T1: new object type arguments (instantiated or not). 1219 // T1: new object type arguments (instantiated or not).
1244 // Create a stub frame as we are pushing some objects on the stack before 1220 // Create a stub frame as we are pushing some objects on the stack before
1245 // calling into the runtime. 1221 // calling into the runtime.
1246 __ EnterStubFrame(true); // Uses pool pointer to pass cls to runtime. 1222 __ EnterStubFrame(); // Uses pool pointer to pass cls to runtime.
1247 __ LoadObject(TMP, cls); 1223 __ LoadObject(TMP, cls);
1248 1224
1249 __ addiu(SP, SP, Immediate(-3 * kWordSize)); 1225 __ addiu(SP, SP, Immediate(-3 * kWordSize));
1250 // Space on stack for return value. 1226 // Space on stack for return value.
1251 __ LoadImmediate(T7, reinterpret_cast<intptr_t>(Object::null())); 1227 __ LoadImmediate(T7, reinterpret_cast<intptr_t>(Object::null()));
1252 __ sw(T7, Address(SP, 2 * kWordSize)); 1228 __ sw(T7, Address(SP, 2 * kWordSize));
1253 __ sw(TMP, Address(SP, 1 * kWordSize)); // Class of object to be allocated. 1229 __ sw(TMP, Address(SP, 1 * kWordSize)); // Class of object to be allocated.
1254 1230
1255 if (is_cls_parameterized) { 1231 if (is_cls_parameterized) {
1256 // Push type arguments of object to be allocated and of instantiator. 1232 // Push type arguments of object to be allocated and of instantiator.
(...skipping 1032 matching lines...) Expand 10 before | Expand all | Expand 10 after
2289 // Result: 2265 // Result:
2290 // T1: entry point. 2266 // T1: entry point.
2291 void StubCode::GenerateMegamorphicLookupStub(Assembler* assembler) { 2267 void StubCode::GenerateMegamorphicLookupStub(Assembler* assembler) {
2292 EmitMegamorphicLookup(assembler, T0, T1, T1); 2268 EmitMegamorphicLookup(assembler, T0, T1, T1);
2293 __ Ret(); 2269 __ Ret();
2294 } 2270 }
2295 2271
2296 } // namespace dart 2272 } // namespace dart
2297 2273
2298 #endif // defined TARGET_ARCH_MIPS 2274 #endif // defined TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « runtime/vm/stub_code_arm64.cc ('k') | runtime/vm/stub_code_x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698