| 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 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 static void PatchInstanceCallAt(uword return_address, | 35 static void PatchInstanceCallAt(uword return_address, |
| 36 const Code& code, | 36 const Code& code, |
| 37 uword new_target_address); | 37 uword new_target_address); |
| 38 | 38 |
| 39 // Patch entry point with a jump as specified in the code's patch region. | 39 // Patch entry point with a jump as specified in the code's patch region. |
| 40 static void PatchEntry(const Code& code); | 40 static void PatchEntry(const Code& code); |
| 41 | 41 |
| 42 // Restore entry point with original code (i.e., before patching). | 42 // Restore entry point with original code (i.e., before patching). |
| 43 static void RestoreEntry(const Code& code); | 43 static void RestoreEntry(const Code& code); |
| 44 | 44 |
| 45 // Has the entry been patched? |
| 46 static bool IsEntryPatched(const Code& code); |
| 47 |
| 45 // Returns true if the code can be patched with a jump at beginning (checks | 48 // Returns true if the code can be patched with a jump at beginning (checks |
| 46 // that there are no conflicts with object pointers). Used in ASSERTs. | 49 // that there are no conflicts with object pointers). Used in ASSERTs. |
| 47 static bool CodeIsPatchable(const Code& code); | 50 static bool CodeIsPatchable(const Code& code); |
| 48 | 51 |
| 49 // Return the target address of the static call before return_address | 52 // Return the target address of the static call before return_address |
| 50 // in given code. | 53 // in given code. |
| 51 static uword GetStaticCallTargetAt(uword return_address, const Code& code); | 54 static uword GetStaticCallTargetAt(uword return_address, const Code& code); |
| 52 | 55 |
| 53 // Get instance call information. Returns the call target and sets each | 56 // Get instance call information. Returns the call target and sets each |
| 54 // 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 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 71 static intptr_t InstanceCallSizeInBytes(); | 74 static intptr_t InstanceCallSizeInBytes(); |
| 72 | 75 |
| 73 static void InsertCallAt(uword start, uword target); | 76 static void InsertCallAt(uword start, uword target); |
| 74 | 77 |
| 75 static RawObject* GetEdgeCounterAt(uword pc, const Code& code); | 78 static RawObject* GetEdgeCounterAt(uword pc, const Code& code); |
| 76 }; | 79 }; |
| 77 | 80 |
| 78 } // namespace dart | 81 } // namespace dart |
| 79 | 82 |
| 80 #endif // VM_CODE_PATCHER_H_ | 83 #endif // VM_CODE_PATCHER_H_ |
| OLD | NEW |