| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 17 matching lines...) Expand all Loading... |
| 28 // Patch entry point with a jump as specified in the code's patch region. | 28 // Patch entry point with a jump as specified in the code's patch region. |
| 29 static void PatchEntry(const Code& code); | 29 static void PatchEntry(const Code& code); |
| 30 | 30 |
| 31 // Restore entry point with original code (i.e., before patching). | 31 // Restore entry point with original code (i.e., before patching). |
| 32 static void RestoreEntry(const Code& code); | 32 static void RestoreEntry(const Code& code); |
| 33 | 33 |
| 34 // Returns true if the code can be patched with a jump at beginnning (checks | 34 // Returns true if the code can be patched with a jump at beginnning (checks |
| 35 // that there are no conflicts with object pointers). | 35 // that there are no conflicts with object pointers). |
| 36 static bool CodeIsPatchable(const Code& code); | 36 static bool CodeIsPatchable(const Code& code); |
| 37 | 37 |
| 38 // Returns true if the code before return_address is a static |
| 39 // or dynamic Dart call. |
| 40 static bool IsDartCall(uword return_address); |
| 41 |
| 38 // Get static call information. | 42 // Get static call information. |
| 39 static void GetStaticCallAt(uword return_address, | 43 static void GetStaticCallAt(uword return_address, |
| 40 Function* function, | 44 Function* function, |
| 41 uword* target); | 45 uword* target); |
| 42 | 46 |
| 43 // Get instance call information. | 47 // Get instance call information. |
| 44 static void GetInstanceCallAt(uword return_address, | 48 static void GetInstanceCallAt(uword return_address, |
| 45 String* function_name, | 49 String* function_name, |
| 46 int* num_arguments, | 50 int* num_arguments, |
| 47 int* num_named_arguments, | 51 int* num_named_arguments, |
| 48 uword* target); | 52 uword* target); |
| 49 | 53 |
| 50 static RawArray* GetInstanceCallIcDataAt(uword return_address); | 54 static RawArray* GetInstanceCallIcDataAt(uword return_address); |
| 51 | 55 |
| 52 static void SetInstanceCallIcDataAt(uword return_address, | 56 static void SetInstanceCallIcDataAt(uword return_address, |
| 53 const Array& ic_data); | 57 const Array& ic_data); |
| 54 | 58 |
| 55 static intptr_t InstanceCallSizeInBytes(); | 59 static intptr_t InstanceCallSizeInBytes(); |
| 56 }; | 60 }; |
| 57 | 61 |
| 58 } // namespace dart | 62 } // namespace dart |
| 59 | 63 |
| 60 #endif // VM_CODE_PATCHER_H_ | 64 #endif // VM_CODE_PATCHER_H_ |
| OLD | NEW |