Chromium Code Reviews| 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 Array; |
| 15 class Code; | 15 class Code; |
| 16 class ExternalLabel; | 16 class ExternalLabel; |
| 17 class Function; | 17 class Function; |
| 18 class RawArray; | 18 class RawArray; |
| 19 class String; | 19 class String; |
| 20 | 20 |
| 21 class CodePatcher : public AllStatic { | 21 class CodePatcher : public AllStatic { |
| 22 public: | 22 public: |
| 23 // Dart static calls have a distinct, machine-dependent code pattern. | 23 // Dart static calls have a distinct, machine-dependent code pattern. |
| 24 | 24 |
| 25 // Patch static call to the new target. | 25 // Patch static or instance call to the new target. |
|
srdjan
2011/11/29 22:26:00
I would use two comments instead of one.
hausner
2011/11/30 01:17:05
Done.
| |
| 26 static void PatchStaticCallAt(uword addr, uword new_target_address); | 26 static void PatchStaticCallAt(uword addr, uword new_target_address); |
| 27 static void PatchInstanceCallAt(uword addr, uword new_target_address); | |
| 27 | 28 |
| 28 // Patch entry point with a jump as specified in the code's patch region. | 29 // Patch entry point with a jump as specified in the code's patch region. |
| 29 static void PatchEntry(const Code& code); | 30 static void PatchEntry(const Code& code); |
| 30 | 31 |
| 31 // Restore entry point with original code (i.e., before patching). | 32 // Restore entry point with original code (i.e., before patching). |
| 32 static void RestoreEntry(const Code& code); | 33 static void RestoreEntry(const Code& code); |
| 33 | 34 |
| 34 // Returns true if the code can be patched with a jump at beginnning (checks | 35 // Returns true if the code can be patched with a jump at beginnning (checks |
| 35 // that there are no conflicts with object pointers). | 36 // that there are no conflicts with object pointers). |
| 36 static bool CodeIsPatchable(const Code& code); | 37 static bool CodeIsPatchable(const Code& code); |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 55 | 56 |
| 56 static void SetInstanceCallIcDataAt(uword return_address, | 57 static void SetInstanceCallIcDataAt(uword return_address, |
| 57 const Array& ic_data); | 58 const Array& ic_data); |
| 58 | 59 |
| 59 static intptr_t InstanceCallSizeInBytes(); | 60 static intptr_t InstanceCallSizeInBytes(); |
| 60 }; | 61 }; |
| 61 | 62 |
| 62 } // namespace dart | 63 } // namespace dart |
| 63 | 64 |
| 64 #endif // VM_CODE_PATCHER_H_ | 65 #endif // VM_CODE_PATCHER_H_ |
| OLD | NEW |