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

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

Issue 200693002: Set VMTag from stubs when transitioning between Dart and Native (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 9 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"
11 #include "vm/dart_entry.h" 11 #include "vm/dart_entry.h"
12 #include "vm/flow_graph_compiler.h" 12 #include "vm/flow_graph_compiler.h"
13 #include "vm/heap.h" 13 #include "vm/heap.h"
14 #include "vm/instructions.h" 14 #include "vm/instructions.h"
15 #include "vm/object_store.h" 15 #include "vm/object_store.h"
16 #include "vm/stack_frame.h" 16 #include "vm/stack_frame.h"
17 #include "vm/stub_code.h" 17 #include "vm/stub_code.h"
18 #include "vm/tags.h"
18 19
19 #define __ assembler-> 20 #define __ assembler->
20 21
21 namespace dart { 22 namespace dart {
22 23
23 DEFINE_FLAG(bool, inline_alloc, true, "Inline allocation of objects."); 24 DEFINE_FLAG(bool, inline_alloc, true, "Inline allocation of objects.");
24 DEFINE_FLAG(bool, use_slow_path, false, 25 DEFINE_FLAG(bool, use_slow_path, false,
25 "Set to true for debugging & verifying the slow paths."); 26 "Set to true for debugging & verifying the slow paths.");
26 DECLARE_FLAG(bool, trace_optimized_ic_calls); 27 DECLARE_FLAG(bool, trace_optimized_ic_calls);
27 28
(...skipping 26 matching lines...) Expand all
54 // Save exit frame information to enable stack walking as we are about 55 // Save exit frame information to enable stack walking as we are about
55 // to transition to Dart VM C++ code. 56 // to transition to Dart VM C++ code.
56 __ sw(SP, Address(A0, Isolate::top_exit_frame_info_offset())); 57 __ sw(SP, Address(A0, Isolate::top_exit_frame_info_offset()));
57 58
58 // Save current Context pointer into Isolate structure. 59 // Save current Context pointer into Isolate structure.
59 __ sw(CTX, Address(A0, Isolate::top_context_offset())); 60 __ sw(CTX, Address(A0, Isolate::top_context_offset()));
60 61
61 // Cache Isolate pointer into CTX while executing runtime code. 62 // Cache Isolate pointer into CTX while executing runtime code.
62 __ mov(CTX, A0); 63 __ mov(CTX, A0);
63 64
65 #if defined(DEBUG)
66 { Label ok;
67 // Check that we are always entering from Dart code.
68 __ lw(T0, Address(A0, Isolate::vm_tag_offset()));
69 __ BranchEqual(T0, VMTag::kScriptTagId, &ok);
70 __ Stop("Not coming from Dart code.");
71 __ Bind(&ok);
72 }
73 #endif
74
75 // Mark that the isolate is executing VM code.
76 __ LoadImmediate(T0, VMTag::kVMTagId);
77 __ sw(T0, Address(A0, Isolate::vm_tag_offset()));
78
64 // Reserve space for arguments and align frame before entering C++ world. 79 // Reserve space for arguments and align frame before entering C++ world.
65 // NativeArguments are passed in registers. 80 // NativeArguments are passed in registers.
66 ASSERT(sizeof(NativeArguments) == 4 * kWordSize); 81 ASSERT(sizeof(NativeArguments) == 4 * kWordSize);
67 __ ReserveAlignedFrameSpace(4 * kWordSize); // Reserve space for arguments. 82 __ ReserveAlignedFrameSpace(4 * kWordSize); // Reserve space for arguments.
68 83
69 // Pass NativeArguments structure by value and call runtime. 84 // Pass NativeArguments structure by value and call runtime.
70 // Registers A0, A1, A2, and A3 are used. 85 // Registers A0, A1, A2, and A3 are used.
71 86
72 ASSERT(isolate_offset == 0 * kWordSize); 87 ASSERT(isolate_offset == 0 * kWordSize);
73 // Set isolate in NativeArgs: A0 already contains CTX. 88 // Set isolate in NativeArgs: A0 already contains CTX.
(...skipping 14 matching lines...) Expand all
88 // We defensively always jalr through T9 because it is sometimes required by 103 // We defensively always jalr through T9 because it is sometimes required by
89 // the MIPS ABI. 104 // the MIPS ABI.
90 __ mov(T9, S5); 105 __ mov(T9, S5);
91 __ jalr(T9); 106 __ jalr(T9);
92 107
93 ASSERT(retval_offset == 3 * kWordSize); 108 ASSERT(retval_offset == 3 * kWordSize);
94 // Retval is next to 1st argument. 109 // Retval is next to 1st argument.
95 __ delay_slot()->addiu(A3, A2, Immediate(kWordSize)); 110 __ delay_slot()->addiu(A3, A2, Immediate(kWordSize));
96 __ TraceSimMsg("CallToRuntimeStub return"); 111 __ TraceSimMsg("CallToRuntimeStub return");
97 112
113 // Mark that the isolate is executing Dart code.
114 __ LoadImmediate(A2, VMTag::kScriptTagId);
115 __ sw(A2, Address(CTX, Isolate::vm_tag_offset()));
116
98 // Reset exit frame information in Isolate structure. 117 // Reset exit frame information in Isolate structure.
99 __ sw(ZR, Address(CTX, Isolate::top_exit_frame_info_offset())); 118 __ sw(ZR, Address(CTX, Isolate::top_exit_frame_info_offset()));
100 119
101 // Load Context pointer from Isolate structure into A2. 120 // Load Context pointer from Isolate structure into A2.
102 __ lw(A2, Address(CTX, Isolate::top_context_offset())); 121 __ lw(A2, Address(CTX, Isolate::top_context_offset()));
103 122
104 // Load null. 123 // Load null.
105 __ LoadImmediate(TMP, reinterpret_cast<intptr_t>(Object::null())); 124 __ LoadImmediate(TMP, reinterpret_cast<intptr_t>(Object::null()));
106 125
107 // Reset Context pointer in Isolate structure. 126 // Reset Context pointer in Isolate structure.
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 // Save exit frame information to enable stack walking as we are about 182 // Save exit frame information to enable stack walking as we are about
164 // to transition to native code. 183 // to transition to native code.
165 __ sw(SP, Address(A0, Isolate::top_exit_frame_info_offset())); 184 __ sw(SP, Address(A0, Isolate::top_exit_frame_info_offset()));
166 185
167 // Save current Context pointer into Isolate structure. 186 // Save current Context pointer into Isolate structure.
168 __ sw(CTX, Address(A0, Isolate::top_context_offset())); 187 __ sw(CTX, Address(A0, Isolate::top_context_offset()));
169 188
170 // Cache Isolate pointer into CTX while executing native code. 189 // Cache Isolate pointer into CTX while executing native code.
171 __ mov(CTX, A0); 190 __ mov(CTX, A0);
172 191
192 #if defined(DEBUG)
193 { Label ok;
194 // Check that we are always entering from Dart code.
195 __ lw(T0, Address(A0, Isolate::vm_tag_offset()));
196 __ BranchEqual(T0, VMTag::kScriptTagId, &ok);
197 __ Stop("Not coming from Dart code.");
198 __ Bind(&ok);
199 }
200 #endif
201
202 // Mark that the isolate is executing Native code.
203 __ LoadImmediate(T0, VMTag::kRuntimeNativeTagId);
204 __ sw(T0, Address(A0, Isolate::vm_tag_offset()));
205
173 // Initialize NativeArguments structure and call native function. 206 // Initialize NativeArguments structure and call native function.
174 // Registers A0, A1, A2, and A3 are used. 207 // Registers A0, A1, A2, and A3 are used.
175 208
176 ASSERT(isolate_offset == 0 * kWordSize); 209 ASSERT(isolate_offset == 0 * kWordSize);
177 // Set isolate in NativeArgs: A0 already contains CTX. 210 // Set isolate in NativeArgs: A0 already contains CTX.
178 211
179 // There are no native calls to closures, so we do not need to set the tag 212 // There are no native calls to closures, so we do not need to set the tag
180 // bits kClosureFunctionBit and kInstanceFunctionBit in argc_tag_. 213 // bits kClosureFunctionBit and kInstanceFunctionBit in argc_tag_.
181 ASSERT(argc_tag_offset == 1 * kWordSize); 214 ASSERT(argc_tag_offset == 1 * kWordSize);
182 // Set argc in NativeArguments: A1 already contains argc. 215 // Set argc in NativeArguments: A1 already contains argc.
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 __ ReserveAlignedFrameSpace(kWordSize); // Just passing A0. 256 __ ReserveAlignedFrameSpace(kWordSize); // Just passing A0.
224 257
225 258
226 // We defensively always jalr through T9 because it is sometimes required by 259 // We defensively always jalr through T9 because it is sometimes required by
227 // the MIPS ABI. 260 // the MIPS ABI.
228 __ mov(T9, T5); 261 __ mov(T9, T5);
229 __ jalr(T9); 262 __ jalr(T9);
230 263
231 __ Bind(&done); 264 __ Bind(&done);
232 265
266 // Mark that the isolate is executing Dart code.
267 __ LoadImmediate(A2, VMTag::kScriptTagId);
268 __ sw(A2, Address(CTX, Isolate::vm_tag_offset()));
269
233 // Reset exit frame information in Isolate structure. 270 // Reset exit frame information in Isolate structure.
234 __ sw(ZR, Address(CTX, Isolate::top_exit_frame_info_offset())); 271 __ sw(ZR, Address(CTX, Isolate::top_exit_frame_info_offset()));
235 272
236 // Load Context pointer from Isolate structure into A2. 273 // Load Context pointer from Isolate structure into A2.
237 __ lw(A2, Address(CTX, Isolate::top_context_offset())); 274 __ lw(A2, Address(CTX, Isolate::top_context_offset()));
238 275
239 // Load null. 276 // Load null.
240 __ LoadImmediate(TMP, reinterpret_cast<intptr_t>(Object::null())); 277 __ LoadImmediate(TMP, reinterpret_cast<intptr_t>(Object::null()));
241 278
242 // Reset Context pointer in Isolate structure. 279 // Reset Context pointer in Isolate structure.
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 // Save exit frame information to enable stack walking as we are about 316 // Save exit frame information to enable stack walking as we are about
280 // to transition to native code. 317 // to transition to native code.
281 __ sw(SP, Address(A0, Isolate::top_exit_frame_info_offset())); 318 __ sw(SP, Address(A0, Isolate::top_exit_frame_info_offset()));
282 319
283 // Save current Context pointer into Isolate structure. 320 // Save current Context pointer into Isolate structure.
284 __ sw(CTX, Address(A0, Isolate::top_context_offset())); 321 __ sw(CTX, Address(A0, Isolate::top_context_offset()));
285 322
286 // Cache Isolate pointer into CTX while executing native code. 323 // Cache Isolate pointer into CTX while executing native code.
287 __ mov(CTX, A0); 324 __ mov(CTX, A0);
288 325
326 #if defined(DEBUG)
327 { Label ok;
328 // Check that we are always entering from Dart code.
329 __ lw(T0, Address(A0, Isolate::vm_tag_offset()));
330 __ BranchEqual(T0, VMTag::kScriptTagId, &ok);
331 __ Stop("Not coming from Dart code.");
332 __ Bind(&ok);
333 }
334 #endif
335
336 // Mark that the isolate is executing Native code.
337 __ LoadImmediate(T0, VMTag::kRuntimeNativeTagId);
338 __ sw(T0, Address(A0, Isolate::vm_tag_offset()));
339
289 // Initialize NativeArguments structure and call native function. 340 // Initialize NativeArguments structure and call native function.
290 // Registers A0, A1, A2, and A3 are used. 341 // Registers A0, A1, A2, and A3 are used.
291 342
292 ASSERT(isolate_offset == 0 * kWordSize); 343 ASSERT(isolate_offset == 0 * kWordSize);
293 // Set isolate in NativeArgs: A0 already contains CTX. 344 // Set isolate in NativeArgs: A0 already contains CTX.
294 345
295 // There are no native calls to closures, so we do not need to set the tag 346 // There are no native calls to closures, so we do not need to set the tag
296 // bits kClosureFunctionBit and kInstanceFunctionBit in argc_tag_. 347 // bits kClosureFunctionBit and kInstanceFunctionBit in argc_tag_.
297 ASSERT(argc_tag_offset == 1 * kWordSize); 348 ASSERT(argc_tag_offset == 1 * kWordSize);
298 // Set argc in NativeArguments: A1 already contains argc. 349 // Set argc in NativeArguments: A1 already contains argc.
(...skipping 17 matching lines...) Expand all
316 __ ReserveAlignedFrameSpace(kWordSize); // Just passing A0. 367 __ ReserveAlignedFrameSpace(kWordSize); // Just passing A0.
317 368
318 // Call native function or redirection via simulator. 369 // Call native function or redirection via simulator.
319 370
320 // We defensively always jalr through T9 because it is sometimes required by 371 // We defensively always jalr through T9 because it is sometimes required by
321 // the MIPS ABI. 372 // the MIPS ABI.
322 __ mov(T9, T5); 373 __ mov(T9, T5);
323 __ jalr(T9); 374 __ jalr(T9);
324 __ TraceSimMsg("CallNativeCFunctionStub return"); 375 __ TraceSimMsg("CallNativeCFunctionStub return");
325 376
377 // Mark that the isolate is executing Dart code.
378 __ LoadImmediate(A2, VMTag::kScriptTagId);
379 __ sw(A2, Address(CTX, Isolate::vm_tag_offset()));
380
326 // Reset exit frame information in Isolate structure. 381 // Reset exit frame information in Isolate structure.
327 __ sw(ZR, Address(CTX, Isolate::top_exit_frame_info_offset())); 382 __ sw(ZR, Address(CTX, Isolate::top_exit_frame_info_offset()));
328 383
329 // Load Context pointer from Isolate structure into A2. 384 // Load Context pointer from Isolate structure into A2.
330 __ lw(A2, Address(CTX, Isolate::top_context_offset())); 385 __ lw(A2, Address(CTX, Isolate::top_context_offset()));
331 386
332 // Load null. 387 // Load null.
333 __ LoadImmediate(TMP, reinterpret_cast<intptr_t>(Object::null())); 388 __ LoadImmediate(TMP, reinterpret_cast<intptr_t>(Object::null()));
334 389
335 // Reset Context pointer in Isolate structure. 390 // Reset Context pointer in Isolate structure.
(...skipping 601 matching lines...) Expand 10 before | Expand all | Expand 10 after
937 // A1 : arguments descriptor array. 992 // A1 : arguments descriptor array.
938 // A2 : arguments array. 993 // A2 : arguments array.
939 // A3 : new context containing the current isolate pointer. 994 // A3 : new context containing the current isolate pointer.
940 void StubCode::GenerateInvokeDartCodeStub(Assembler* assembler) { 995 void StubCode::GenerateInvokeDartCodeStub(Assembler* assembler) {
941 // Save frame pointer coming in. 996 // Save frame pointer coming in.
942 __ TraceSimMsg("InvokeDartCodeStub"); 997 __ TraceSimMsg("InvokeDartCodeStub");
943 __ EnterFrame(); 998 __ EnterFrame();
944 999
945 // Save new context and C++ ABI callee-saved registers. 1000 // Save new context and C++ ABI callee-saved registers.
946 1001
947 // The new context, the top exit frame, and the old context. 1002 // The new context, saved vm tag, the top exit frame, and the old context.
948 const intptr_t kPreservedContextSlots = 3; 1003 const intptr_t kPreservedContextSlots = 4;
949 const intptr_t kNewContextOffsetFromFp = 1004 const intptr_t kNewContextOffsetFromFp =
950 -(1 + kAbiPreservedCpuRegCount + kAbiPreservedFpuRegCount) * kWordSize; 1005 -(1 + kAbiPreservedCpuRegCount + kAbiPreservedFpuRegCount) * kWordSize;
951 const intptr_t kPreservedRegSpace = 1006 const intptr_t kPreservedRegSpace =
952 kWordSize * (kAbiPreservedCpuRegCount + kAbiPreservedFpuRegCount + 1007 kWordSize * (kAbiPreservedCpuRegCount + kAbiPreservedFpuRegCount +
953 kPreservedContextSlots); 1008 kPreservedContextSlots);
954 1009
955 __ addiu(SP, SP, Immediate(-kPreservedRegSpace)); 1010 __ addiu(SP, SP, Immediate(-kPreservedRegSpace));
956 for (int i = S0; i <= S7; i++) { 1011 for (int i = S0; i <= S7; i++) {
957 Register r = static_cast<Register>(i); 1012 Register r = static_cast<Register>(i);
958 const intptr_t slot = i - S0 + kPreservedContextSlots; 1013 const intptr_t slot = i - S0 + kPreservedContextSlots;
959 __ sw(r, Address(SP, slot * kWordSize)); 1014 __ sw(r, Address(SP, slot * kWordSize));
960 } 1015 }
961 1016
962 for (intptr_t i = kAbiFirstPreservedFpuReg; 1017 for (intptr_t i = kAbiFirstPreservedFpuReg;
963 i <= kAbiLastPreservedFpuReg; i++) { 1018 i <= kAbiLastPreservedFpuReg; i++) {
964 FRegister r = static_cast<FRegister>(i); 1019 FRegister r = static_cast<FRegister>(i);
965 const intptr_t slot = 1020 const intptr_t slot =
966 kAbiPreservedCpuRegCount + kPreservedContextSlots + i - 1021 kAbiPreservedCpuRegCount + kPreservedContextSlots + i -
967 kAbiFirstPreservedFpuReg; 1022 kAbiFirstPreservedFpuReg;
968 __ swc1(r, Address(SP, slot * kWordSize)); 1023 __ swc1(r, Address(SP, slot * kWordSize));
969 } 1024 }
970 1025
971 __ sw(A3, Address(SP, 2 * kWordSize)); 1026 __ sw(A3, Address(SP, 3 * kWordSize));
972 1027
973 // We now load the pool pointer(PP) as we are about to invoke dart code and we 1028 // We now load the pool pointer(PP) as we are about to invoke dart code and we
974 // could potentially invoke some intrinsic functions which need the PP to be 1029 // could potentially invoke some intrinsic functions which need the PP to be
975 // set up. 1030 // set up.
976 __ LoadPoolPointer(); 1031 __ LoadPoolPointer();
977 1032
978 // The new Context structure contains a pointer to the current Isolate 1033 // The new Context structure contains a pointer to the current Isolate
979 // structure. Cache the Context pointer in the CTX register so that it is 1034 // structure. Cache the Context pointer in the CTX register so that it is
980 // available in generated code and calls to Isolate::Current() need not be 1035 // available in generated code and calls to Isolate::Current() need not be
981 // done. The assumption is that this register will never be clobbered by 1036 // done. The assumption is that this register will never be clobbered by
982 // compiled or runtime stub code. 1037 // compiled or runtime stub code.
983 1038
984 // Cache the new Context pointer into CTX while executing Dart code. 1039 // Cache the new Context pointer into CTX while executing Dart code.
985 __ lw(CTX, Address(A3, VMHandles::kOffsetOfRawPtrInHandle)); 1040 __ lw(CTX, Address(A3, VMHandles::kOffsetOfRawPtrInHandle));
986 1041
987 // Load Isolate pointer from Context structure into temporary register R8. 1042 // Load Isolate pointer from Context structure into temporary register R8.
988 __ lw(T2, FieldAddress(CTX, Context::isolate_offset())); 1043 __ lw(T2, FieldAddress(CTX, Context::isolate_offset()));
989 1044
1045 // Save the current VMTag on the stack.
1046 ASSERT(kSavedVMTagSlotFromEntryFp == -22);
1047 __ lw(T1, Address(T2, Isolate::vm_tag_offset()));
1048 __ sw(T1, Address(SP, 2 * kWordSize));
1049
1050 // Mark that the isolate is executing Dart code.
1051 __ LoadImmediate(T0, VMTag::kScriptTagId);
1052 __ sw(T0, Address(T2, Isolate::vm_tag_offset()));
1053
990 // Save the top exit frame info. Use T0 as a temporary register. 1054 // Save the top exit frame info. Use T0 as a temporary register.
991 // StackFrameIterator reads the top exit frame info saved in this frame. 1055 // StackFrameIterator reads the top exit frame info saved in this frame.
992 __ lw(T0, Address(T2, Isolate::top_exit_frame_info_offset())); 1056 __ lw(T0, Address(T2, Isolate::top_exit_frame_info_offset()));
993 __ sw(ZR, Address(T2, Isolate::top_exit_frame_info_offset())); 1057 __ sw(ZR, Address(T2, Isolate::top_exit_frame_info_offset()));
994 1058
995 // Save the old Context pointer. Use T1 as a temporary register. 1059 // Save the old Context pointer. Use T1 as a temporary register.
996 // Note that VisitObjectPointers will find this saved Context pointer during 1060 // Note that VisitObjectPointers will find this saved Context pointer during
997 // GC marking, since it traverses any information between SP and 1061 // GC marking, since it traverses any information between SP and
998 // FP - kExitLinkSlotFromEntryFp. 1062 // FP - kExitLinkSlotFromEntryFp.
999 // EntryFrame::SavedContext reads the context saved in this frame. 1063 // EntryFrame::SavedContext reads the context saved in this frame.
1000 __ lw(T1, Address(T2, Isolate::top_context_offset())); 1064 __ lw(T1, Address(T2, Isolate::top_context_offset()));
1001 1065
1002 // The constants kSavedContextSlotFromEntryFp and 1066 // The constants kSavedContextSlotFromEntryFp and
1003 // kExitLinkSlotFromEntryFp must be kept in sync with the code below. 1067 // kExitLinkSlotFromEntryFp must be kept in sync with the code below.
1004 ASSERT(kExitLinkSlotFromEntryFp == -22); 1068 ASSERT(kExitLinkSlotFromEntryFp == -23);
1005 ASSERT(kSavedContextSlotFromEntryFp == -23); 1069 ASSERT(kSavedContextSlotFromEntryFp == -24);
1006 __ sw(T0, Address(SP, 1 * kWordSize)); 1070 __ sw(T0, Address(SP, 1 * kWordSize));
1007 __ sw(T1, Address(SP, 0 * kWordSize)); 1071 __ sw(T1, Address(SP, 0 * kWordSize));
1008 1072
1009 // After the call, The stack pointer is restored to this location. 1073 // After the call, The stack pointer is restored to this location.
1010 // Pushed A3, S0-7, F20-31, T0, T1 = 23. 1074 // Pushed A3, S0-7, F20-31, T0, T1 = 23.
1011 1075
1012 // Load arguments descriptor array into S4, which is passed to Dart code. 1076 // Load arguments descriptor array into S4, which is passed to Dart code.
1013 __ lw(S4, Address(A1, VMHandles::kOffsetOfRawPtrInHandle)); 1077 __ lw(S4, Address(A1, VMHandles::kOffsetOfRawPtrInHandle));
1014 1078
1015 // Load number of arguments into S5. 1079 // Load number of arguments into S5.
(...skipping 28 matching lines...) Expand all
1044 // Read the saved new Context pointer. 1108 // Read the saved new Context pointer.
1045 __ lw(CTX, Address(FP, kNewContextOffsetFromFp)); 1109 __ lw(CTX, Address(FP, kNewContextOffsetFromFp));
1046 __ lw(CTX, Address(CTX, VMHandles::kOffsetOfRawPtrInHandle)); 1110 __ lw(CTX, Address(CTX, VMHandles::kOffsetOfRawPtrInHandle));
1047 1111
1048 // Get rid of arguments pushed on the stack. 1112 // Get rid of arguments pushed on the stack.
1049 __ AddImmediate(SP, FP, kSavedContextSlotFromEntryFp * kWordSize); 1113 __ AddImmediate(SP, FP, kSavedContextSlotFromEntryFp * kWordSize);
1050 1114
1051 // Load Isolate pointer from Context structure into CTX. Drop Context. 1115 // Load Isolate pointer from Context structure into CTX. Drop Context.
1052 __ lw(CTX, FieldAddress(CTX, Context::isolate_offset())); 1116 __ lw(CTX, FieldAddress(CTX, Context::isolate_offset()));
1053 1117
1118 // Restore the current VMTag from the stack.
1119 __ lw(T1, Address(SP, 2 * kWordSize));
1120 __ sw(T1, Address(CTX, Isolate::vm_tag_offset()));
1121
1054 // Restore the saved Context pointer into the Isolate structure. 1122 // Restore the saved Context pointer into the Isolate structure.
1055 // Uses T1 as a temporary register for this. 1123 // Uses T1 as a temporary register for this.
1056 // Restore the saved top exit frame info back into the Isolate structure. 1124 // Restore the saved top exit frame info back into the Isolate structure.
1057 // Uses T0 as a temporary register for this. 1125 // Uses T0 as a temporary register for this.
1058 __ lw(T1, Address(SP, 0 * kWordSize)); 1126 __ lw(T1, Address(SP, 0 * kWordSize));
1059 __ lw(T0, Address(SP, 1 * kWordSize)); 1127 __ lw(T0, Address(SP, 1 * kWordSize));
1060 __ sw(T1, Address(CTX, Isolate::top_context_offset())); 1128 __ sw(T1, Address(CTX, Isolate::top_context_offset()));
1061 __ sw(T0, Address(CTX, Isolate::top_exit_frame_info_offset())); 1129 __ sw(T0, Address(CTX, Isolate::top_exit_frame_info_offset()));
1062 1130
1063 // Restore C++ ABI callee-saved registers. 1131 // Restore C++ ABI callee-saved registers.
1064 for (int i = S0; i <= S7; i++) { 1132 for (int i = S0; i <= S7; i++) {
1065 Register r = static_cast<Register>(i); 1133 Register r = static_cast<Register>(i);
1066 const intptr_t slot = i - S0 + kPreservedContextSlots; 1134 const intptr_t slot = i - S0 + kPreservedContextSlots;
1067 __ lw(r, Address(SP, slot * kWordSize)); 1135 __ lw(r, Address(SP, slot * kWordSize));
1068 } 1136 }
1069 1137
1070 for (intptr_t i = kAbiFirstPreservedFpuReg; 1138 for (intptr_t i = kAbiFirstPreservedFpuReg;
1071 i <= kAbiLastPreservedFpuReg; i++) { 1139 i <= kAbiLastPreservedFpuReg; i++) {
1072 FRegister r = static_cast<FRegister>(i); 1140 FRegister r = static_cast<FRegister>(i);
1073 const intptr_t slot = 1141 const intptr_t slot =
1074 kAbiPreservedCpuRegCount + kPreservedContextSlots + i - 1142 kAbiPreservedCpuRegCount + kPreservedContextSlots + i -
1075 kAbiFirstPreservedFpuReg; 1143 kAbiFirstPreservedFpuReg;
1076 __ lwc1(r, Address(SP, slot * kWordSize)); 1144 __ lwc1(r, Address(SP, slot * kWordSize));
1077 } 1145 }
1078 1146
1079 __ lw(A3, Address(SP, 2 * kWordSize)); 1147 __ lw(A3, Address(SP, 3 * kWordSize));
1080 __ addiu(SP, SP, Immediate(kPreservedRegSpace)); 1148 __ addiu(SP, SP, Immediate(kPreservedRegSpace));
1081 1149
1082 // Restore the frame pointer and return. 1150 // Restore the frame pointer and return.
1083 __ LeaveFrameAndReturn(); 1151 __ LeaveFrameAndReturn();
1084 } 1152 }
1085 1153
1086 1154
1087 // Called for inline allocation of contexts. 1155 // Called for inline allocation of contexts.
1088 // Input: 1156 // Input:
1089 // T1: number of context variables. 1157 // T1: number of context variables.
(...skipping 1137 matching lines...) Expand 10 before | Expand all | Expand 10 after
2227 const Register right = T0; 2295 const Register right = T0;
2228 __ lw(left, Address(SP, 1 * kWordSize)); 2296 __ lw(left, Address(SP, 1 * kWordSize));
2229 __ lw(right, Address(SP, 0 * kWordSize)); 2297 __ lw(right, Address(SP, 0 * kWordSize));
2230 GenerateIdenticalWithNumberCheckStub(assembler, left, right, temp1, temp2); 2298 GenerateIdenticalWithNumberCheckStub(assembler, left, right, temp1, temp2);
2231 __ Ret(); 2299 __ Ret();
2232 } 2300 }
2233 2301
2234 } // namespace dart 2302 } // namespace dart
2235 2303
2236 #endif // defined TARGET_ARCH_MIPS 2304 #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