OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 // Class for patching compiled code. | 4 // Class for patching compiled code. |
5 | 5 |
6 #ifndef VM_CODE_PATCHER_H_ | 6 #ifndef VM_CODE_PATCHER_H_ |
7 #define VM_CODE_PATCHER_H_ | 7 #define VM_CODE_PATCHER_H_ |
8 | 8 |
9 #include "vm/allocation.h" | 9 #include "vm/allocation.h" |
10 | 10 |
11 namespace dart { | 11 namespace dart { |
12 | 12 |
13 // Forward declaration. | 13 // Forward declaration. |
14 class Array; | 14 class Array; |
15 class Code; | 15 class Code; |
16 class ExternalLabel; | 16 class ExternalLabel; |
17 class Function; | 17 class Function; |
18 class ICData; | 18 class ICData; |
19 class RawArray; | 19 class RawArray; |
20 class RawFunction; | 20 class RawFunction; |
21 class RawICData; | 21 class RawICData; |
22 class RawObject; | 22 class RawObject; |
23 class String; | 23 class String; |
24 | 24 |
| 25 class WritableInstructionsScope : public ValueObject { |
| 26 public: |
| 27 WritableInstructionsScope(uword address, intptr_t size); |
| 28 ~WritableInstructionsScope(); |
| 29 |
| 30 private: |
| 31 uword address_; |
| 32 intptr_t size_; |
| 33 }; |
| 34 |
| 35 |
25 class CodePatcher : public AllStatic { | 36 class CodePatcher : public AllStatic { |
26 public: | 37 public: |
27 // Dart static calls have a distinct, machine-dependent code pattern. | 38 // Dart static calls have a distinct, machine-dependent code pattern. |
28 | 39 |
29 // Patch static call before return_address in given code to the new target. | 40 // Patch static call before return_address in given code to the new target. |
30 static void PatchStaticCallAt(uword return_address, | 41 static void PatchStaticCallAt(uword return_address, |
31 const Code& code, | 42 const Code& code, |
32 uword new_target_address); | 43 uword new_target_address); |
33 | 44 |
34 // Patch instance call before return_address in given code to the new target. | 45 // Patch instance call before return_address in given code to the new target. |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 static intptr_t InstanceCallSizeInBytes(); | 82 static intptr_t InstanceCallSizeInBytes(); |
72 | 83 |
73 static void InsertCallAt(uword start, uword target); | 84 static void InsertCallAt(uword start, uword target); |
74 | 85 |
75 static RawObject* GetEdgeCounterAt(uword pc, const Code& code); | 86 static RawObject* GetEdgeCounterAt(uword pc, const Code& code); |
76 }; | 87 }; |
77 | 88 |
78 } // namespace dart | 89 } // namespace dart |
79 | 90 |
80 #endif // VM_CODE_PATCHER_H_ | 91 #endif // VM_CODE_PATCHER_H_ |
OLD | NEW |