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

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

Issue 2974233002: VM: Re-format to use at most one newline between functions (Closed)
Patch Set: Rebase and merge Created 3 years, 5 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.cc ('k') | runtime/vm/code_patcher_arm64.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_ARM. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_ARM.
6 #if defined(TARGET_ARCH_ARM) 6 #if defined(TARGET_ARCH_ARM)
7 7
8 #include "vm/code_patcher.h" 8 #include "vm/code_patcher.h"
9 9
10 #include "vm/flow_graph_compiler.h" 10 #include "vm/flow_graph_compiler.h"
11 #include "vm/instructions.h" 11 #include "vm/instructions.h"
12 #include "vm/object.h" 12 #include "vm/object.h"
13 13
14 namespace dart { 14 namespace dart {
15 15
16 RawCode* CodePatcher::GetStaticCallTargetAt(uword return_address, 16 RawCode* CodePatcher::GetStaticCallTargetAt(uword return_address,
17 const Code& code) { 17 const Code& code) {
18 ASSERT(code.ContainsInstructionAt(return_address)); 18 ASSERT(code.ContainsInstructionAt(return_address));
19 CallPattern call(return_address, code); 19 CallPattern call(return_address, code);
20 return call.TargetCode(); 20 return call.TargetCode();
21 } 21 }
22 22
23
24 void CodePatcher::PatchStaticCallAt(uword return_address, 23 void CodePatcher::PatchStaticCallAt(uword return_address,
25 const Code& code, 24 const Code& code,
26 const Code& new_target) { 25 const Code& new_target) {
27 ASSERT(code.ContainsInstructionAt(return_address)); 26 ASSERT(code.ContainsInstructionAt(return_address));
28 CallPattern call(return_address, code); 27 CallPattern call(return_address, code);
29 call.SetTargetCode(new_target); 28 call.SetTargetCode(new_target);
30 } 29 }
31 30
32
33 void CodePatcher::InsertDeoptimizationCallAt(uword start) { 31 void CodePatcher::InsertDeoptimizationCallAt(uword start) {
34 UNREACHABLE(); 32 UNREACHABLE();
35 } 33 }
36 34
37
38 RawCode* CodePatcher::GetInstanceCallAt(uword return_address, 35 RawCode* CodePatcher::GetInstanceCallAt(uword return_address,
39 const Code& code, 36 const Code& code,
40 ICData* ic_data) { 37 ICData* ic_data) {
41 ASSERT(code.ContainsInstructionAt(return_address)); 38 ASSERT(code.ContainsInstructionAt(return_address));
42 CallPattern call(return_address, code); 39 CallPattern call(return_address, code);
43 if (ic_data != NULL) { 40 if (ic_data != NULL) {
44 *ic_data = call.IcData(); 41 *ic_data = call.IcData();
45 } 42 }
46 return call.TargetCode(); 43 return call.TargetCode();
47 } 44 }
48 45
49
50 intptr_t CodePatcher::InstanceCallSizeInBytes() { 46 intptr_t CodePatcher::InstanceCallSizeInBytes() {
51 // The instance call instruction sequence has a variable size on ARM. 47 // The instance call instruction sequence has a variable size on ARM.
52 UNREACHABLE(); 48 UNREACHABLE();
53 return 0; 49 return 0;
54 } 50 }
55 51
56
57 RawFunction* CodePatcher::GetUnoptimizedStaticCallAt(uword return_address, 52 RawFunction* CodePatcher::GetUnoptimizedStaticCallAt(uword return_address,
58 const Code& code, 53 const Code& code,
59 ICData* ic_data_result) { 54 ICData* ic_data_result) {
60 ASSERT(code.ContainsInstructionAt(return_address)); 55 ASSERT(code.ContainsInstructionAt(return_address));
61 CallPattern static_call(return_address, code); 56 CallPattern static_call(return_address, code);
62 ICData& ic_data = ICData::Handle(); 57 ICData& ic_data = ICData::Handle();
63 ic_data ^= static_call.IcData(); 58 ic_data ^= static_call.IcData();
64 if (ic_data_result != NULL) { 59 if (ic_data_result != NULL) {
65 *ic_data_result = ic_data.raw(); 60 *ic_data_result = ic_data.raw();
66 } 61 }
67 return ic_data.GetTargetAt(0); 62 return ic_data.GetTargetAt(0);
68 } 63 }
69 64
70
71 void CodePatcher::PatchSwitchableCallAt(uword return_address, 65 void CodePatcher::PatchSwitchableCallAt(uword return_address,
72 const Code& caller_code, 66 const Code& caller_code,
73 const Object& data, 67 const Object& data,
74 const Code& target) { 68 const Code& target) {
75 ASSERT(caller_code.ContainsInstructionAt(return_address)); 69 ASSERT(caller_code.ContainsInstructionAt(return_address));
76 SwitchableCallPattern call(return_address, caller_code); 70 SwitchableCallPattern call(return_address, caller_code);
77 call.SetData(data); 71 call.SetData(data);
78 call.SetTarget(target); 72 call.SetTarget(target);
79 } 73 }
80 74
81
82 RawCode* CodePatcher::GetSwitchableCallTargetAt(uword return_address, 75 RawCode* CodePatcher::GetSwitchableCallTargetAt(uword return_address,
83 const Code& caller_code) { 76 const Code& caller_code) {
84 ASSERT(caller_code.ContainsInstructionAt(return_address)); 77 ASSERT(caller_code.ContainsInstructionAt(return_address));
85 SwitchableCallPattern call(return_address, caller_code); 78 SwitchableCallPattern call(return_address, caller_code);
86 return call.target(); 79 return call.target();
87 } 80 }
88 81
89
90 RawObject* CodePatcher::GetSwitchableCallDataAt(uword return_address, 82 RawObject* CodePatcher::GetSwitchableCallDataAt(uword return_address,
91 const Code& caller_code) { 83 const Code& caller_code) {
92 ASSERT(caller_code.ContainsInstructionAt(return_address)); 84 ASSERT(caller_code.ContainsInstructionAt(return_address));
93 SwitchableCallPattern call(return_address, caller_code); 85 SwitchableCallPattern call(return_address, caller_code);
94 return call.data(); 86 return call.data();
95 } 87 }
96 88
97
98 void CodePatcher::PatchNativeCallAt(uword return_address, 89 void CodePatcher::PatchNativeCallAt(uword return_address,
99 const Code& code, 90 const Code& code,
100 NativeFunction target, 91 NativeFunction target,
101 const Code& trampoline) { 92 const Code& trampoline) {
102 ASSERT(code.ContainsInstructionAt(return_address)); 93 ASSERT(code.ContainsInstructionAt(return_address));
103 NativeCallPattern call(return_address, code); 94 NativeCallPattern call(return_address, code);
104 call.set_target(trampoline); 95 call.set_target(trampoline);
105 call.set_native_function(target); 96 call.set_native_function(target);
106 } 97 }
107 98
108
109 RawCode* CodePatcher::GetNativeCallAt(uword return_address, 99 RawCode* CodePatcher::GetNativeCallAt(uword return_address,
110 const Code& code, 100 const Code& code,
111 NativeFunction* target) { 101 NativeFunction* target) {
112 ASSERT(code.ContainsInstructionAt(return_address)); 102 ASSERT(code.ContainsInstructionAt(return_address));
113 NativeCallPattern call(return_address, code); 103 NativeCallPattern call(return_address, code);
114 *target = call.native_function(); 104 *target = call.native_function();
115 return call.target(); 105 return call.target();
116 } 106 }
117 107
118 } // namespace dart 108 } // namespace dart
119 109
120 #endif // defined TARGET_ARCH_ARM 110 #endif // defined TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « runtime/vm/code_patcher.cc ('k') | runtime/vm/code_patcher_arm64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698