| 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 #include "vm/native_entry.h" | 10 #include "vm/native_entry.h" |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 | 42 |
| 43 class CodePatcher : public AllStatic { | 43 class CodePatcher : public AllStatic { |
| 44 public: | 44 public: |
| 45 // Dart static calls have a distinct, machine-dependent code pattern. | 45 // Dart static calls have a distinct, machine-dependent code pattern. |
| 46 | 46 |
| 47 // Patch static call before return_address in given code to the new target. | 47 // Patch static call before return_address in given code to the new target. |
| 48 static void PatchStaticCallAt(uword return_address, | 48 static void PatchStaticCallAt(uword return_address, |
| 49 const Code& code, | 49 const Code& code, |
| 50 const Code& new_target); | 50 const Code& new_target); |
| 51 | 51 |
| 52 // Patch entry point with a jump as specified in the code's patch region. | |
| 53 static void PatchEntry(const Code& code, const Code& new_code); | |
| 54 | |
| 55 // Restore entry point with original code (i.e., before patching). | |
| 56 static void RestoreEntry(const Code& code); | |
| 57 | |
| 58 // Has the entry been patched? | |
| 59 static bool IsEntryPatched(const Code& code); | |
| 60 | |
| 61 // Return the target address of the static call before return_address | 52 // Return the target address of the static call before return_address |
| 62 // in given code. | 53 // in given code. |
| 63 static RawCode* GetStaticCallTargetAt(uword return_address, const Code& code); | 54 static RawCode* GetStaticCallTargetAt(uword return_address, const Code& code); |
| 64 | 55 |
| 65 // Get instance call information. Returns the call target and sets each | 56 // Get instance call information. Returns the call target and sets each |
| 66 // of the output parameters ic_data and arguments_descriptor if they are | 57 // of the output parameters ic_data and arguments_descriptor if they are |
| 67 // non-NULL. | 58 // non-NULL. |
| 68 static RawCode* GetInstanceCallAt(uword return_address, | 59 static RawCode* GetInstanceCallAt(uword return_address, |
| 69 const Code& code, | 60 const Code& code, |
| 70 ICData* ic_data); | 61 ICData* ic_data); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 89 | 80 |
| 90 static void PatchNativeCallAt(uword return_address, | 81 static void PatchNativeCallAt(uword return_address, |
| 91 const Code& code, | 82 const Code& code, |
| 92 NativeFunction target, | 83 NativeFunction target, |
| 93 const Code& trampoline); | 84 const Code& trampoline); |
| 94 }; | 85 }; |
| 95 | 86 |
| 96 } // namespace dart | 87 } // namespace dart |
| 97 | 88 |
| 98 #endif // VM_CODE_PATCHER_H_ | 89 #endif // VM_CODE_PATCHER_H_ |
| OLD | NEW |