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

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

Issue 1343373003: Revert "VM: New calling convention for generated code." (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 3 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
« no previous file with comments | « runtime/vm/code_patcher_ia32.cc ('k') | runtime/vm/code_patcher_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" // Needed here to get TARGET_ARCH_MIPS. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_MIPS.
6 #if defined(TARGET_ARCH_MIPS) 6 #if defined(TARGET_ARCH_MIPS)
7 7
8 #include "vm/code_patcher.h" 8 #include "vm/code_patcher.h"
9 9
10 #include "vm/instructions.h" 10 #include "vm/instructions.h"
11 #include "vm/object.h" 11 #include "vm/object.h"
12 12
13 namespace dart { 13 namespace dart {
14 14
15 RawCode* CodePatcher::GetStaticCallTargetAt(uword return_address, 15 uword CodePatcher::GetStaticCallTargetAt(uword return_address,
16 const Code& code) { 16 const Code& code) {
17 ASSERT(code.ContainsInstructionAt(return_address)); 17 ASSERT(code.ContainsInstructionAt(return_address));
18 CallPattern call(return_address, code); 18 CallPattern call(return_address, code);
19 return call.TargetCode(); 19 return call.TargetAddress();
20 } 20 }
21 21
22 22
23 void CodePatcher::PatchStaticCallAt(uword return_address, 23 void CodePatcher::PatchStaticCallAt(uword return_address,
24 const Code& code, 24 const Code& code,
25 const Code& new_target) { 25 uword new_target) {
26 ASSERT(code.ContainsInstructionAt(return_address)); 26 ASSERT(code.ContainsInstructionAt(return_address));
27 CallPattern call(return_address, code); 27 CallPattern call(return_address, code);
28 call.SetTargetCode(new_target); 28 call.SetTargetAddress(new_target);
29 } 29 }
30 30
31 31
32 void CodePatcher::InsertDeoptimizationCallAt(uword start, uword target) { 32 void CodePatcher::PatchInstanceCallAt(uword return_address,
33 // The inserted call should not overlap the lazy deopt jump code. 33 const Code& code,
34 ASSERT(start + CallPattern::kDeoptCallLengthInBytes <= target); 34 uword new_target) {
35 CallPattern::InsertDeoptCallAt(start, target); 35 ASSERT(code.ContainsInstructionAt(return_address));
36 CallPattern call(return_address, code);
37 call.SetTargetAddress(new_target);
36 } 38 }
37 39
38 40
39 RawCode* CodePatcher::GetInstanceCallAt(uword return_address, 41 void CodePatcher::InsertCallAt(uword start, uword target) {
40 const Code& code, 42 // The inserted call should not overlap the lazy deopt jump code.
41 ICData* ic_data) { 43 ASSERT(start + CallPattern::kFixedLengthInBytes <= target);
44 CallPattern::InsertAt(start, target);
45 }
46
47
48 uword CodePatcher::GetInstanceCallAt(uword return_address,
49 const Code& code,
50 ICData* ic_data) {
42 ASSERT(code.ContainsInstructionAt(return_address)); 51 ASSERT(code.ContainsInstructionAt(return_address));
43 CallPattern call(return_address, code); 52 CallPattern call(return_address, code);
44 if (ic_data != NULL) { 53 if (ic_data != NULL) {
45 *ic_data = call.IcData(); 54 *ic_data = call.IcData();
46 } 55 }
47 return call.TargetCode(); 56 return call.TargetAddress();
48 } 57 }
49 58
50 59
51 intptr_t CodePatcher::InstanceCallSizeInBytes() { 60 intptr_t CodePatcher::InstanceCallSizeInBytes() {
52 // The instance call instruction sequence has a variable size on MIPS. 61 // The instance call instruction sequence has a variable size on MIPS.
53 UNREACHABLE(); 62 UNREACHABLE();
54 return 0; 63 return 0;
55 } 64 }
56 65
57 66
58 RawFunction* CodePatcher::GetUnoptimizedStaticCallAt( 67 RawFunction* CodePatcher::GetUnoptimizedStaticCallAt(
59 uword return_address, const Code& code, ICData* ic_data_result) { 68 uword return_address, const Code& code, ICData* ic_data_result) {
60 ASSERT(code.ContainsInstructionAt(return_address)); 69 ASSERT(code.ContainsInstructionAt(return_address));
61 CallPattern static_call(return_address, code); 70 CallPattern static_call(return_address, code);
62 ICData& ic_data = ICData::Handle(); 71 ICData& ic_data = ICData::Handle();
63 ic_data ^= static_call.IcData(); 72 ic_data ^= static_call.IcData();
64 if (ic_data_result != NULL) { 73 if (ic_data_result != NULL) {
65 *ic_data_result = ic_data.raw(); 74 *ic_data_result = ic_data.raw();
66 } 75 }
67 return ic_data.GetTargetAt(0); 76 return ic_data.GetTargetAt(0);
68 } 77 }
69 78
70 79
71 void CodePatcher::PatchNativeCallAt(uword return_address, 80 void CodePatcher::PatchNativeCallAt(uword return_address,
72 const Code& code, 81 const Code& code,
73 NativeFunction target, 82 NativeFunction target,
74 const Code& trampoline) { 83 const Code& trampoline) {
75 ASSERT(code.ContainsInstructionAt(return_address)); 84 ASSERT(code.ContainsInstructionAt(return_address));
76 NativeCallPattern call(return_address, code); 85 NativeCallPattern call(return_address, code);
77 call.set_target(trampoline); 86 call.set_target(trampoline.EntryPoint());
78 call.set_native_function(target); 87 call.set_native_function(target);
79 } 88 }
80 89
81 90
82 RawCode* CodePatcher::GetNativeCallAt(uword return_address, 91 uword CodePatcher::GetNativeCallAt(uword return_address,
83 const Code& code, 92 const Code& code,
84 NativeFunction* target) { 93 NativeFunction* target) {
85 ASSERT(code.ContainsInstructionAt(return_address)); 94 ASSERT(code.ContainsInstructionAt(return_address));
86 NativeCallPattern call(return_address, code); 95 NativeCallPattern call(return_address, code);
87 *target = call.native_function(); 96 *target = call.native_function();
88 return call.target(); 97 return call.target();
89 } 98 }
90 99
91 100
92 // This class pattern matches on a load from the object pool. Loading on 101 // This class pattern matches on a load from the object pool. Loading on
93 // MIPS is complicated because it can take four possible different forms. 102 // MIPS is complicated because it can take four possible different forms.
94 // We match backwards from the end of the sequence so we can reuse the code 103 // We match backwards from the end of the sequence so we can reuse the code
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 135
127 RawObject* CodePatcher::GetEdgeCounterAt(uword pc, const Code& code) { 136 RawObject* CodePatcher::GetEdgeCounterAt(uword pc, const Code& code) {
128 ASSERT(code.ContainsInstructionAt(pc)); 137 ASSERT(code.ContainsInstructionAt(pc));
129 EdgeCounter counter(pc, code); 138 EdgeCounter counter(pc, code);
130 return counter.edge_counter(); 139 return counter.edge_counter();
131 } 140 }
132 141
133 } // namespace dart 142 } // namespace dart
134 143
135 #endif // defined TARGET_ARCH_MIPS 144 #endif // defined TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « runtime/vm/code_patcher_ia32.cc ('k') | runtime/vm/code_patcher_x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698