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

Side by Side Diff: runtime/vm/stub_code_arm.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 | « no previous file | runtime/vm/stub_code_mips.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 22 matching lines...) Expand all
33 // SP + 4*R4 - 4 : address of first argument in argument array. 33 // SP + 4*R4 - 4 : address of first argument in argument array.
34 // SP + 4*R4 : address of return value. 34 // SP + 4*R4 : address of return value.
35 // R5 : address of the runtime function to call. 35 // R5 : address of the runtime function to call.
36 // R4 : number of arguments to the call. 36 // R4 : 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 __ EnterFrame((1 << FP) | (1 << LR), 0); 43 __ EnterStubFrame();
44 44
45 // Load current Isolate pointer from Context structure into R0. 45 // Load current Isolate pointer from Context structure into R0.
46 __ ldr(R0, FieldAddress(CTX, Context::isolate_offset())); 46 __ ldr(R0, FieldAddress(CTX, Context::isolate_offset()));
47 47
48 // Save exit frame information to enable stack walking as we are about 48 // Save exit frame information to enable stack walking as we are about
49 // to transition to Dart VM C++ code. 49 // to transition to Dart VM C++ code.
50 __ StoreToOffset(kWord, SP, R0, Isolate::top_exit_frame_info_offset()); 50 __ StoreToOffset(kWord, SP, R0, Isolate::top_exit_frame_info_offset());
51 51
52 // Save current Context pointer into Isolate structure. 52 // Save current Context pointer into Isolate structure.
53 __ StoreToOffset(kWord, CTX, R0, Isolate::top_context_offset()); 53 __ StoreToOffset(kWord, CTX, R0, Isolate::top_context_offset());
(...skipping 12 matching lines...) Expand all
66 ASSERT(isolate_offset == 0 * kWordSize); 66 ASSERT(isolate_offset == 0 * kWordSize);
67 // Set isolate in NativeArgs: R0 already contains CTX. 67 // Set isolate in NativeArgs: R0 already contains CTX.
68 68
69 // There are no runtime calls to closures, so we do not need to set the tag 69 // There are no runtime calls to closures, so we do not need to set the tag
70 // bits kClosureFunctionBit and kInstanceFunctionBit in argc_tag_. 70 // bits kClosureFunctionBit and kInstanceFunctionBit in argc_tag_.
71 ASSERT(argc_tag_offset == 1 * kWordSize); 71 ASSERT(argc_tag_offset == 1 * kWordSize);
72 __ mov(R1, ShifterOperand(R4)); // Set argc in NativeArguments. 72 __ mov(R1, ShifterOperand(R4)); // Set argc in NativeArguments.
73 73
74 ASSERT(argv_offset == 2 * kWordSize); 74 ASSERT(argv_offset == 2 * kWordSize);
75 __ add(R2, FP, ShifterOperand(R4, LSL, 2)); // Compute argv. 75 __ add(R2, FP, ShifterOperand(R4, LSL, 2)); // Compute argv.
76 __ AddImmediate(R2, kWordSize); // Set argv in NativeArguments. 76 // Set argv in NativeArguments.
77 __ AddImmediate(R2, kParamEndSlotFromFp * kWordSize);
77 78
78 ASSERT(retval_offset == 3 * kWordSize); 79 ASSERT(retval_offset == 3 * kWordSize);
79 __ add(R3, R2, ShifterOperand(kWordSize)); // Retval is next to 1st argument. 80 __ add(R3, R2, ShifterOperand(kWordSize)); // Retval is next to 1st argument.
80 81
81 // Call runtime or redirection via simulator. 82 // Call runtime or redirection via simulator.
82 __ blx(R5); 83 __ blx(R5);
83 84
84 // Reset exit frame information in Isolate structure. 85 // Reset exit frame information in Isolate structure.
85 __ LoadImmediate(R2, 0); 86 __ LoadImmediate(R2, 0);
86 __ StoreToOffset(kWord, R2, CTX, Isolate::top_exit_frame_info_offset()); 87 __ StoreToOffset(kWord, R2, CTX, Isolate::top_exit_frame_info_offset());
87 88
88 // Load Context pointer from Isolate structure into R2. 89 // Load Context pointer from Isolate structure into R2.
89 __ LoadFromOffset(kWord, R2, CTX, Isolate::top_context_offset()); 90 __ LoadFromOffset(kWord, R2, CTX, Isolate::top_context_offset());
90 91
91 // Reset Context pointer in Isolate structure. 92 // Reset Context pointer in Isolate structure.
92 __ LoadImmediate(R3, reinterpret_cast<intptr_t>(Object::null())); 93 __ LoadImmediate(R3, reinterpret_cast<intptr_t>(Object::null()));
93 __ StoreToOffset(kWord, R3, CTX, Isolate::top_context_offset()); 94 __ StoreToOffset(kWord, R3, CTX, Isolate::top_context_offset());
94 95
95 // Cache Context pointer into CTX while executing Dart code. 96 // Cache Context pointer into CTX while executing Dart code.
96 __ mov(CTX, ShifterOperand(R2)); 97 __ mov(CTX, ShifterOperand(R2));
97 98
98 __ LeaveFrame((1 << FP) | (1 << LR)); 99 __ LeaveStubFrame();
99 __ Ret(); 100 __ Ret();
100 } 101 }
101 102
102 103
103 // Print the stop message. 104 // Print the stop message.
104 DEFINE_LEAF_RUNTIME_ENTRY(void, PrintStopMessage, 1, const char* message) { 105 DEFINE_LEAF_RUNTIME_ENTRY(void, PrintStopMessage, 1, const char* message) {
105 OS::Print("Stop message: %s\n", message); 106 OS::Print("Stop message: %s\n", message);
106 } 107 }
107 END_LEAF_RUNTIME_ENTRY 108 END_LEAF_RUNTIME_ENTRY
108 109
(...skipping 1996 matching lines...) Expand 10 before | Expand all | Expand 10 after
2105 __ ldr(left, Address(SP, 4 * kWordSize)); 2106 __ ldr(left, Address(SP, 4 * kWordSize));
2106 __ ldr(right, Address(SP, 3 * kWordSize)); 2107 __ ldr(right, Address(SP, 3 * kWordSize));
2107 GenerateIdenticalWithNumberCheckStub(assembler, left, right, temp); 2108 GenerateIdenticalWithNumberCheckStub(assembler, left, right, temp);
2108 __ PopList((1 << R0) | (1 << R1) | (1 << R2)); 2109 __ PopList((1 << R0) | (1 << R1) | (1 << R2));
2109 __ Ret(); 2110 __ Ret();
2110 } 2111 }
2111 2112
2112 } // namespace dart 2113 } // namespace dart
2113 2114
2114 #endif // defined TARGET_ARCH_ARM 2115 #endif // defined TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/stub_code_mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698