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

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

Issue 315223003: Use CallBootstrapC stub for leaf native calls. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 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 | « runtime/vm/stub_code_ia32.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 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 // Passing the structure by value as in runtime calls would require changing 222 // Passing the structure by value as in runtime calls would require changing
223 // Dart API for native functions. 223 // Dart API for native functions.
224 // For now, space is reserved on the stack and we pass a pointer to it. 224 // For now, space is reserved on the stack and we pass a pointer to it.
225 __ addiu(SP, SP, Immediate(-4 * kWordSize)); 225 __ addiu(SP, SP, Immediate(-4 * kWordSize));
226 __ sw(A3, Address(SP, 3 * kWordSize)); 226 __ sw(A3, Address(SP, 3 * kWordSize));
227 __ sw(A2, Address(SP, 2 * kWordSize)); 227 __ sw(A2, Address(SP, 2 * kWordSize));
228 __ sw(A1, Address(SP, 1 * kWordSize)); 228 __ sw(A1, Address(SP, 1 * kWordSize));
229 __ sw(A0, Address(SP, 0 * kWordSize)); 229 __ sw(A0, Address(SP, 0 * kWordSize));
230 __ mov(A0, SP); // Pass the pointer to the NativeArguments. 230 __ mov(A0, SP); // Pass the pointer to the NativeArguments.
231 231
232 // Call native function (setup scope if not leaf function).
233 Label leaf_call;
234 Label done;
235 __ AndImmediate(CMPRES1, A1, NativeArguments::AutoSetupScopeMask());
236 __ beq(CMPRES1, ZR, &leaf_call);
237 232
238 __ mov(A1, T5); // Pass the function entrypoint. 233 __ mov(A1, T5); // Pass the function entrypoint.
239 __ ReserveAlignedFrameSpace(2 * kWordSize); // Just passing A0, A1. 234 __ ReserveAlignedFrameSpace(2 * kWordSize); // Just passing A0, A1.
240 // Call native wrapper function or redirection via simulator. 235 // Call native wrapper function or redirection via simulator.
241 #if defined(USING_SIMULATOR) 236 #if defined(USING_SIMULATOR)
242 uword entry = reinterpret_cast<uword>(NativeEntry::NativeCallWrapper); 237 uword entry = reinterpret_cast<uword>(NativeEntry::NativeCallWrapper);
243 entry = Simulator::RedirectExternalReference( 238 entry = Simulator::RedirectExternalReference(
244 entry, Simulator::kNativeCall, NativeEntry::kNumCallWrapperArguments); 239 entry, Simulator::kNativeCall, NativeEntry::kNumCallWrapperArguments);
245 __ LoadImmediate(T9, entry); 240 __ LoadImmediate(T9, entry);
246 __ jalr(T9); 241 __ jalr(T9);
247 #else 242 #else
248 __ BranchLink(&NativeEntry::NativeCallWrapperLabel()); 243 __ BranchLink(&NativeEntry::NativeCallWrapperLabel());
249 #endif 244 #endif
250 __ TraceSimMsg("CallNativeCFunctionStub return"); 245 __ TraceSimMsg("CallNativeCFunctionStub return");
251 __ b(&done);
252
253 __ Bind(&leaf_call);
254 // Call native function or redirection via simulator.
255 __ ReserveAlignedFrameSpace(kWordSize); // Just passing A0.
256
257
258 // We defensively always jalr through T9 because it is sometimes required by
259 // the MIPS ABI.
260 __ mov(T9, T5);
261 __ jalr(T9);
262
263 __ Bind(&done);
264 246
265 // Mark that the isolate is executing Dart code. 247 // Mark that the isolate is executing Dart code.
266 __ LoadImmediate(A2, VMTag::kScriptTagId); 248 __ LoadImmediate(A2, VMTag::kScriptTagId);
267 __ sw(A2, Address(CTX, Isolate::vm_tag_offset())); 249 __ sw(A2, Address(CTX, Isolate::vm_tag_offset()));
268 250
269 // Reset exit frame information in Isolate structure. 251 // Reset exit frame information in Isolate structure.
270 __ sw(ZR, Address(CTX, Isolate::top_exit_frame_info_offset())); 252 __ sw(ZR, Address(CTX, Isolate::top_exit_frame_info_offset()));
271 253
272 // Load Context pointer from Isolate structure into A2. 254 // Load Context pointer from Isolate structure into A2.
273 __ lw(A2, Address(CTX, Isolate::top_context_offset())); 255 __ lw(A2, Address(CTX, Isolate::top_context_offset()));
(...skipping 1805 matching lines...) Expand 10 before | Expand all | Expand 10 after
2079 const Register right = T0; 2061 const Register right = T0;
2080 __ lw(left, Address(SP, 1 * kWordSize)); 2062 __ lw(left, Address(SP, 1 * kWordSize));
2081 __ lw(right, Address(SP, 0 * kWordSize)); 2063 __ lw(right, Address(SP, 0 * kWordSize));
2082 GenerateIdenticalWithNumberCheckStub(assembler, left, right, temp1, temp2); 2064 GenerateIdenticalWithNumberCheckStub(assembler, left, right, temp1, temp2);
2083 __ Ret(); 2065 __ Ret();
2084 } 2066 }
2085 2067
2086 } // namespace dart 2068 } // namespace dart
2087 2069
2088 #endif // defined TARGET_ARCH_MIPS 2070 #endif // defined TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « runtime/vm/stub_code_ia32.cc ('k') | runtime/vm/stub_code_x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698