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

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

Issue 27588004: Fixes a bug in runtime call stub on arm and mips. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 2 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_arm.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) 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 24 matching lines...) Expand all
35 // S5 : address of the runtime function to call. 35 // S5 : address of the runtime function to call.
36 // S4 : number of arguments to the call. 36 // S4 : number of arguments to the call.
37 void StubCode::GenerateCallToRuntimeStub(Assembler* assembler) { 37 void StubCode::GenerateCallToRuntimeStub(Assembler* assembler) {
38 const intptr_t isolate_offset = NativeArguments::isolate_offset(); 38 const intptr_t isolate_offset = NativeArguments::isolate_offset();
39 const intptr_t argc_tag_offset = NativeArguments::argc_tag_offset(); 39 const intptr_t argc_tag_offset = NativeArguments::argc_tag_offset();
40 const intptr_t argv_offset = NativeArguments::argv_offset(); 40 const intptr_t argv_offset = NativeArguments::argv_offset();
41 const intptr_t retval_offset = NativeArguments::retval_offset(); 41 const intptr_t retval_offset = NativeArguments::retval_offset();
42 42
43 __ SetPrologueOffset(); 43 __ SetPrologueOffset();
44 __ TraceSimMsg("CallToRuntimeStub"); 44 __ TraceSimMsg("CallToRuntimeStub");
45 __ addiu(SP, SP, Immediate(-2 * kWordSize)); 45 __ EnterStubFrame();
46 __ sw(RA, Address(SP, 1 * kWordSize));
47 __ sw(FP, Address(SP, 0 * kWordSize));
48 __ mov(FP, SP);
49 46
50 // Load current Isolate pointer from Context structure into A0. 47 // Load current Isolate pointer from Context structure into A0.
51 __ lw(A0, FieldAddress(CTX, Context::isolate_offset())); 48 __ lw(A0, FieldAddress(CTX, Context::isolate_offset()));
52 49
53 // Save exit frame information to enable stack walking as we are about 50 // Save exit frame information to enable stack walking as we are about
54 // to transition to Dart VM C++ code. 51 // to transition to Dart VM C++ code.
55 __ sw(SP, Address(A0, Isolate::top_exit_frame_info_offset())); 52 __ sw(SP, Address(A0, Isolate::top_exit_frame_info_offset()));
56 53
57 // Save current Context pointer into Isolate structure. 54 // Save current Context pointer into Isolate structure.
58 __ sw(CTX, Address(A0, Isolate::top_context_offset())); 55 __ sw(CTX, Address(A0, Isolate::top_context_offset()));
(...skipping 13 matching lines...) Expand all
72 // Set isolate in NativeArgs: A0 already contains CTX. 69 // Set isolate in NativeArgs: A0 already contains CTX.
73 70
74 // There are no runtime calls to closures, so we do not need to set the tag 71 // There are no runtime calls to closures, so we do not need to set the tag
75 // bits kClosureFunctionBit and kInstanceFunctionBit in argc_tag_. 72 // bits kClosureFunctionBit and kInstanceFunctionBit in argc_tag_.
76 ASSERT(argc_tag_offset == 1 * kWordSize); 73 ASSERT(argc_tag_offset == 1 * kWordSize);
77 __ mov(A1, S4); // Set argc in NativeArguments. 74 __ mov(A1, S4); // Set argc in NativeArguments.
78 75
79 ASSERT(argv_offset == 2 * kWordSize); 76 ASSERT(argv_offset == 2 * kWordSize);
80 __ sll(A2, S4, 2); 77 __ sll(A2, S4, 2);
81 __ addu(A2, FP, A2); // Compute argv. 78 __ addu(A2, FP, A2); // Compute argv.
82 __ addiu(A2, A2, Immediate(kWordSize)); // Set argv in NativeArguments. 79 // Set argv in NativeArguments.
80 __ addiu(A2, A2, Immediate(kParamEndSlotFromFp * kWordSize));
83 81
84 ASSERT(retval_offset == 3 * kWordSize); 82 ASSERT(retval_offset == 3 * kWordSize);
85 83
86 // Call runtime or redirection via simulator. 84 // Call runtime or redirection via simulator.
87 __ jalr(S5); 85 __ jalr(S5);
88 // Retval is next to 1st argument. 86 // Retval is next to 1st argument.
89 __ delay_slot()->addiu(A3, A2, Immediate(kWordSize)); 87 __ delay_slot()->addiu(A3, A2, Immediate(kWordSize));
90 __ TraceSimMsg("CallToRuntimeStub return"); 88 __ TraceSimMsg("CallToRuntimeStub return");
91 89
92 // Reset exit frame information in Isolate structure. 90 // Reset exit frame information in Isolate structure.
93 __ sw(ZR, Address(CTX, Isolate::top_exit_frame_info_offset())); 91 __ sw(ZR, Address(CTX, Isolate::top_exit_frame_info_offset()));
94 92
95 // Load Context pointer from Isolate structure into A2. 93 // Load Context pointer from Isolate structure into A2.
96 __ lw(A2, Address(CTX, Isolate::top_context_offset())); 94 __ lw(A2, Address(CTX, Isolate::top_context_offset()));
97 95
98 // Load null. 96 // Load null.
99 __ LoadImmediate(TMP, reinterpret_cast<intptr_t>(Object::null())); 97 __ LoadImmediate(TMP, reinterpret_cast<intptr_t>(Object::null()));
100 98
101 // Reset Context pointer in Isolate structure. 99 // Reset Context pointer in Isolate structure.
102 __ sw(TMP, Address(CTX, Isolate::top_context_offset())); 100 __ sw(TMP, Address(CTX, Isolate::top_context_offset()));
103 101
104 // Cache Context pointer into CTX while executing Dart code. 102 // Cache Context pointer into CTX while executing Dart code.
105 __ mov(CTX, A2); 103 __ mov(CTX, A2);
106 104
107 __ mov(SP, FP); 105 __ LeaveStubFrameAndReturn();
108 __ lw(RA, Address(SP, 1 * kWordSize));
109 __ lw(FP, Address(SP, 0 * kWordSize));
110 __ Ret();
111 __ delay_slot()->addiu(SP, SP, Immediate(2 * kWordSize));
112 } 106 }
113 107
114 108
115 // Print the stop message. 109 // Print the stop message.
116 DEFINE_LEAF_RUNTIME_ENTRY(void, PrintStopMessage, 1, const char* message) { 110 DEFINE_LEAF_RUNTIME_ENTRY(void, PrintStopMessage, 1, const char* message) {
117 OS::Print("Stop message: %s\n", message); 111 OS::Print("Stop message: %s\n", message);
118 } 112 }
119 END_LEAF_RUNTIME_ENTRY 113 END_LEAF_RUNTIME_ENTRY
120 114
121 115
(...skipping 2280 matching lines...) Expand 10 before | Expand all | Expand 10 after
2402 __ lw(left, Address(SP, 1 * kWordSize)); 2396 __ lw(left, Address(SP, 1 * kWordSize));
2403 __ lw(temp2, Address(SP, 2 * kWordSize)); 2397 __ lw(temp2, Address(SP, 2 * kWordSize));
2404 __ lw(temp1, Address(SP, 3 * kWordSize)); 2398 __ lw(temp1, Address(SP, 3 * kWordSize));
2405 __ Ret(); 2399 __ Ret();
2406 __ delay_slot()->addiu(SP, SP, Immediate(4 * kWordSize)); 2400 __ delay_slot()->addiu(SP, SP, Immediate(4 * kWordSize));
2407 } 2401 }
2408 2402
2409 } // namespace dart 2403 } // namespace dart
2410 2404
2411 #endif // defined TARGET_ARCH_MIPS 2405 #endif // defined TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « runtime/vm/stub_code_arm.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698