Chromium Code Reviews| 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 |
| 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 ICData; | 18 class ICData; |
| 19 class RawArray; | 19 class RawArray; |
| 20 class RawFunction; | 20 class RawFunction; |
| 21 class RawICData; | 21 class RawICData; |
| 22 class RawObject; | 22 class RawObject; |
| 23 class String; | 23 class String; |
| 24 | 24 |
| 25 class WritableInstructionsScope : public ValueObject { | |
| 26 public: | |
| 27 WritableInstructionsScope(uword address, intptr_t size); | |
| 28 ~WritableInstructionsScope(); | |
| 29 | |
| 30 private: | |
| 31 uword address_; | |
| 32 intptr_t size_; | |
|
srdjan
2014/01/16 17:38:12
Both can be const. Please add a brief comment abou
Florian Schneider
2014/01/17 10:46:59
Done.
| |
| 33 }; | |
| 34 | |
| 35 | |
| 25 class CodePatcher : public AllStatic { | 36 class CodePatcher : public AllStatic { |
| 26 public: | 37 public: |
| 27 // Dart static calls have a distinct, machine-dependent code pattern. | 38 // Dart static calls have a distinct, machine-dependent code pattern. |
| 28 | 39 |
| 29 // Patch static call before return_address in given code to the new target. | 40 // Patch static call before return_address in given code to the new target. |
| 30 static void PatchStaticCallAt(uword return_address, | 41 static void PatchStaticCallAt(uword return_address, |
| 31 const Code& code, | 42 const Code& code, |
| 32 uword new_target_address); | 43 uword new_target_address); |
| 33 | 44 |
| 34 // Patch instance call before return_address in given code to the new target. | 45 // Patch instance call before return_address in given code to the new target. |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 77 | 88 |
| 78 static RawObject* GetEdgeCounterAt(uword pc, const Code& code); | 89 static RawObject* GetEdgeCounterAt(uword pc, const Code& code); |
| 79 | 90 |
| 80 static int32_t GetPoolOffsetAt(uword return_address); | 91 static int32_t GetPoolOffsetAt(uword return_address); |
| 81 static void SetPoolOffsetAt(uword return_address, int32_t offset); | 92 static void SetPoolOffsetAt(uword return_address, int32_t offset); |
| 82 }; | 93 }; |
| 83 | 94 |
| 84 } // namespace dart | 95 } // namespace dart |
| 85 | 96 |
| 86 #endif // VM_CODE_PATCHER_H_ | 97 #endif // VM_CODE_PATCHER_H_ |
| OLD | NEW |