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