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

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

Issue 117723002: Allow the native resolver to setup whether it needs the Dart API scope to (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years 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/stack_frame_test.cc ('k') | runtime/vm/stub_code_ia32.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_ARM) 6 #if defined(TARGET_ARCH_ARM)
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 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 // Set argv in NativeArguments: R2 already contains argv. 174 // Set argv in NativeArguments: R2 already contains argv.
175 175
176 ASSERT(retval_offset == 3 * kWordSize); 176 ASSERT(retval_offset == 3 * kWordSize);
177 __ add(R3, FP, ShifterOperand(3 * kWordSize)); // Set retval in NativeArgs. 177 __ add(R3, FP, ShifterOperand(3 * kWordSize)); // Set retval in NativeArgs.
178 178
179 // TODO(regis): Should we pass the structure by value as in runtime calls? 179 // TODO(regis): Should we pass the structure by value as in runtime calls?
180 // It would require changing Dart API for native functions. 180 // It would require changing Dart API for native functions.
181 // For now, space is reserved on the stack and we pass a pointer to it. 181 // For now, space is reserved on the stack and we pass a pointer to it.
182 __ stm(IA, SP, (1 << R0) | (1 << R1) | (1 << R2) | (1 << R3)); 182 __ stm(IA, SP, (1 << R0) | (1 << R1) | (1 << R2) | (1 << R3));
183 __ mov(R0, ShifterOperand(SP)); // Pass the pointer to the NativeArguments. 183 __ mov(R0, ShifterOperand(SP)); // Pass the pointer to the NativeArguments.
184
185 // Call native function (setsup scope if not leaf function).
186 Label leaf_call;
187 Label done;
188 __ TestImmediate(R1, NativeArguments::AutoSetupScopeMask());
189 __ b(&leaf_call, EQ);
190
184 __ mov(R1, ShifterOperand(R5)); // Pass the function entrypoint to call. 191 __ mov(R1, ShifterOperand(R5)); // Pass the function entrypoint to call.
185
186 // Call native function invocation wrapper or redirection via simulator. 192 // Call native function invocation wrapper or redirection via simulator.
187 #if defined(USING_SIMULATOR) 193 #if defined(USING_SIMULATOR)
188 uword entry = reinterpret_cast<uword>(NativeEntry::NativeCallWrapper); 194 uword entry = reinterpret_cast<uword>(NativeEntry::NativeCallWrapper);
189 entry = Simulator::RedirectExternalReference( 195 entry = Simulator::RedirectExternalReference(
190 entry, Simulator::kNativeCall, NativeEntry::kNumCallWrapperArguments); 196 entry, Simulator::kNativeCall, NativeEntry::kNumCallWrapperArguments);
191 __ LoadImmediate(R2, entry); 197 __ LoadImmediate(R2, entry);
192 __ blx(R2); 198 __ blx(R2);
193 #else 199 #else
194 __ BranchLink(&NativeEntry::NativeCallWrapperLabel()); 200 __ BranchLink(&NativeEntry::NativeCallWrapperLabel());
195 #endif 201 #endif
202 __ b(&done);
203
204 __ Bind(&leaf_call);
205 // Call native function or redirection via simulator.
206 __ blx(R5);
207
208 __ Bind(&done);
196 209
197 // Reset exit frame information in Isolate structure. 210 // Reset exit frame information in Isolate structure.
198 __ LoadImmediate(R2, 0); 211 __ LoadImmediate(R2, 0);
199 __ StoreToOffset(kWord, R2, CTX, Isolate::top_exit_frame_info_offset()); 212 __ StoreToOffset(kWord, R2, CTX, Isolate::top_exit_frame_info_offset());
200 213
201 // Load Context pointer from Isolate structure into R2. 214 // Load Context pointer from Isolate structure into R2.
202 __ LoadFromOffset(kWord, R2, CTX, Isolate::top_context_offset()); 215 __ LoadFromOffset(kWord, R2, CTX, Isolate::top_context_offset());
203 216
204 // Reset Context pointer in Isolate structure. 217 // Reset Context pointer in Isolate structure.
205 __ LoadImmediate(R3, reinterpret_cast<intptr_t>(Object::null())); 218 __ LoadImmediate(R3, reinterpret_cast<intptr_t>(Object::null()));
(...skipping 1948 matching lines...) Expand 10 before | Expand all | Expand 10 after
2154 const Register right = R0; 2167 const Register right = R0;
2155 __ ldr(left, Address(SP, 1 * kWordSize)); 2168 __ ldr(left, Address(SP, 1 * kWordSize));
2156 __ ldr(right, Address(SP, 0 * kWordSize)); 2169 __ ldr(right, Address(SP, 0 * kWordSize));
2157 GenerateIdenticalWithNumberCheckStub(assembler, left, right, temp); 2170 GenerateIdenticalWithNumberCheckStub(assembler, left, right, temp);
2158 __ Ret(); 2171 __ Ret();
2159 } 2172 }
2160 2173
2161 } // namespace dart 2174 } // namespace dart
2162 2175
2163 #endif // defined TARGET_ARCH_ARM 2176 #endif // defined TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « runtime/vm/stack_frame_test.cc ('k') | runtime/vm/stub_code_ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698