| 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 |
| 11 namespace dart { | 11 namespace dart { |
| 12 | 12 |
| 13 // Forward declaration. | 13 // Forward declaration. |
| 14 class Array; |
| 14 class Code; | 15 class Code; |
| 15 class ExternalLabel; | 16 class ExternalLabel; |
| 16 class Function; | 17 class Function; |
| 18 class RawArray; |
| 17 class String; | 19 class String; |
| 18 | 20 |
| 19 class CodePatcher : public AllStatic { | 21 class CodePatcher : public AllStatic { |
| 20 public: | 22 public: |
| 21 // Dart static calls have a distinct, machine-dependent code pattern. | 23 // Dart static calls have a distinct, machine-dependent code pattern. |
| 22 | 24 |
| 23 // Patch static call to the new target. | 25 // Patch static call to the new target. |
| 24 static void PatchStaticCallAt(uword addr, uword new_target_address); | 26 static void PatchStaticCallAt(uword addr, uword new_target_address); |
| 25 | 27 |
| 26 // Overwrites code at 'at_addr' with a call to 'label'. | 28 // Overwrites code at 'at_addr' with a call to 'label'. |
| (...skipping 19 matching lines...) Expand all Loading... |
| 46 | 48 |
| 47 // Patch instance call to the new target. | 49 // Patch instance call to the new target. |
| 48 static void PatchInstanceCallAt(uword addr, uword new_target_address); | 50 static void PatchInstanceCallAt(uword addr, uword new_target_address); |
| 49 | 51 |
| 50 // Get instance call information. | 52 // Get instance call information. |
| 51 static void GetInstanceCallAt(uword return_address, | 53 static void GetInstanceCallAt(uword return_address, |
| 52 String* function_name, | 54 String* function_name, |
| 53 int* num_arguments, | 55 int* num_arguments, |
| 54 int* num_named_arguments, | 56 int* num_named_arguments, |
| 55 uword* target); | 57 uword* target); |
| 58 |
| 59 static RawArray* GetInstanceCallIcDataAt(uword return_address); |
| 60 |
| 61 static void SetInstanceCallIcDataAt(uword return_address, |
| 62 const Array& ic_data); |
| 63 |
| 64 static intptr_t InstanceCallSizeInBytes(); |
| 56 }; | 65 }; |
| 57 | 66 |
| 58 } // namespace dart | 67 } // namespace dart |
| 59 | 68 |
| 60 #endif // VM_CODE_PATCHER_H_ | 69 #endif // VM_CODE_PATCHER_H_ |
| OLD | NEW |