| 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 RawICData; | 21 class RawICData; |
| 21 class String; | 22 class String; |
| 22 | 23 |
| 23 class CodePatcher : public AllStatic { | 24 class CodePatcher : public AllStatic { |
| 24 public: | 25 public: |
| 25 // Dart static calls have a distinct, machine-dependent code pattern. | 26 // Dart static calls have a distinct, machine-dependent code pattern. |
| 26 | 27 |
| 27 // Patch static call before return_address in given code to the new target. | 28 // Patch static call before return_address in given code to the new target. |
| 28 static void PatchStaticCallAt(uword return_address, | 29 static void PatchStaticCallAt(uword return_address, |
| 29 const Code& code, | 30 const Code& code, |
| (...skipping 18 matching lines...) Expand all Loading... |
| 48 // in given code. | 49 // in given code. |
| 49 static uword GetStaticCallTargetAt(uword return_address, const Code& code); | 50 static uword GetStaticCallTargetAt(uword return_address, const Code& code); |
| 50 | 51 |
| 51 // Get instance call information. Returns the call target and sets each | 52 // Get instance call information. Returns the call target and sets each |
| 52 // of the output parameters ic_data and arguments_descriptor if they are | 53 // of the output parameters ic_data and arguments_descriptor if they are |
| 53 // non-NULL. | 54 // non-NULL. |
| 54 static uword GetInstanceCallAt(uword return_address, | 55 static uword GetInstanceCallAt(uword return_address, |
| 55 const Code& code, | 56 const Code& code, |
| 56 ICData* ic_data); | 57 ICData* ic_data); |
| 57 | 58 |
| 59 // Return target of an unoptimized static call (calls target via a stub). |
| 60 static RawFunction* GetUnoptimizedStaticCallTargetAt(uword return_address, |
| 61 const Code& code); |
| 62 |
| 58 // Return the arguments descriptor array of the closure call | 63 // Return the arguments descriptor array of the closure call |
| 59 // before the given return address. | 64 // before the given return address. |
| 60 static RawArray* GetClosureArgDescAt(uword return_address, | 65 static RawArray* GetClosureArgDescAt(uword return_address, |
| 61 const Code& code); | 66 const Code& code); |
| 62 | 67 |
| 63 static intptr_t InstanceCallSizeInBytes(); | 68 static intptr_t InstanceCallSizeInBytes(); |
| 64 | 69 |
| 65 static void InsertCallAt(uword start, uword target); | 70 static void InsertCallAt(uword start, uword target); |
| 66 }; | 71 }; |
| 67 | 72 |
| 68 } // namespace dart | 73 } // namespace dart |
| 69 | 74 |
| 70 #endif // VM_CODE_PATCHER_H_ | 75 #endif // VM_CODE_PATCHER_H_ |
| OLD | NEW |