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

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

Issue 1294113004: VM: Link native calls lazily. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: addressed comments Created 5 years, 4 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"
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 CallPattern static_call(return_address, code); 70 CallPattern static_call(return_address, code);
71 ICData& ic_data = ICData::Handle(); 71 ICData& ic_data = ICData::Handle();
72 ic_data ^= static_call.IcData(); 72 ic_data ^= static_call.IcData();
73 if (ic_data_result != NULL) { 73 if (ic_data_result != NULL) {
74 *ic_data_result = ic_data.raw(); 74 *ic_data_result = ic_data.raw();
75 } 75 }
76 return ic_data.GetTargetAt(0); 76 return ic_data.GetTargetAt(0);
77 } 77 }
78 78
79 79
80 void CodePatcher::PatchNativeCallAt(uword return_address,
81 const Code& code,
82 NativeFunction target,
83 const Code& trampoline) {
84 ASSERT(code.ContainsInstructionAt(return_address));
85 NativeCallPattern call(return_address, code);
86 call.set_target(trampoline.EntryPoint());
87 call.set_native_function(target);
88 }
89
90
91 uword CodePatcher::GetNativeCallAt(uword return_address,
92 const Code& code,
93 NativeFunction* target) {
94 ASSERT(code.ContainsInstructionAt(return_address));
95 NativeCallPattern call(return_address, code);
96 *target = call.native_function();
97 return call.target();
98 }
99
100
80 // 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
81 // MIPS is complicated because it can take four possible different forms. 102 // MIPS is complicated because it can take four possible different forms.
82 // 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
83 // for matching object pool loads at calls. 104 // for matching object pool loads at calls.
84 class EdgeCounter : public ValueObject { 105 class EdgeCounter : public ValueObject {
85 public: 106 public:
86 EdgeCounter(uword pc, const Code& code) 107 EdgeCounter(uword pc, const Code& code)
87 : end_(pc - kAdjust), 108 : end_(pc - kAdjust),
88 object_pool_(ObjectPool::Handle(code.GetObjectPool())) { 109 object_pool_(ObjectPool::Handle(code.GetObjectPool())) {
89 // An IsValid predicate is complicated and duplicates the code in the 110 // An IsValid predicate is complicated and duplicates the code in the
(...skipping 24 matching lines...) Expand all
114 135
115 RawObject* CodePatcher::GetEdgeCounterAt(uword pc, const Code& code) { 136 RawObject* CodePatcher::GetEdgeCounterAt(uword pc, const Code& code) {
116 ASSERT(code.ContainsInstructionAt(pc)); 137 ASSERT(code.ContainsInstructionAt(pc));
117 EdgeCounter counter(pc, code); 138 EdgeCounter counter(pc, code);
118 return counter.edge_counter(); 139 return counter.edge_counter();
119 } 140 }
120 141
121 } // namespace dart 142 } // namespace dart
122 143
123 #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