Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(270)

Side by Side Diff: runtime/vm/code_patcher.h

Issue 12260026: Add support for object pool (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/vm/code_generator.cc ('k') | runtime/vm/code_patcher_arm.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 RawICData; 20 class RawICData;
21 class String; 21 class String;
22 22
23 class CodePatcher : public AllStatic { 23 class CodePatcher : public AllStatic {
24 public: 24 public:
25 // Dart static calls have a distinct, machine-dependent code pattern. 25 // Dart static calls have a distinct, machine-dependent code pattern.
26 26
27 // Patch static call to the new target. 27 // Patch static call before return_address in given code to the new target.
28 static void PatchStaticCallAt(uword addr, uword new_target_address); 28 static void PatchStaticCallAt(uword return_address,
29 const Code& code,
30 uword new_target_address);
29 31
30 // Patch instance call to the new target. 32 // Patch instance call before return_address in given code to the new target.
31 static void PatchInstanceCallAt(uword addr, uword new_target_address); 33 static void PatchInstanceCallAt(uword return_address,
34 const Code& code,
35 uword new_target_address);
32 36
33 // Patch entry point with a jump as specified in the code's patch region. 37 // Patch entry point with a jump as specified in the code's patch region.
34 static void PatchEntry(const Code& code); 38 static void PatchEntry(const Code& code);
35 39
36 // Restore entry point with original code (i.e., before patching). 40 // Restore entry point with original code (i.e., before patching).
37 static void RestoreEntry(const Code& code); 41 static void RestoreEntry(const Code& code);
38 42
39 // Returns true if the code can be patched with a jump at beginnning (checks 43 // Returns true if the code can be patched with a jump at beginnning (checks
40 // that there are no conflicts with object pointers). Used in ASSERTs. 44 // that there are no conflicts with object pointers). Used in ASSERTs.
41 static bool CodeIsPatchable(const Code& code); 45 static bool CodeIsPatchable(const Code& code);
42 46
43 // Returns true if the code before return_address is a static 47 // Return the target address of the static call before return_address
44 // or dynamic Dart call. 48 // in given code.
45 static bool IsDartCall(uword return_address); 49 static uword GetStaticCallTargetAt(uword return_address, const Code& code);
46
47 static uword GetStaticCallTargetAt(uword return_address);
48 50
49 // Get instance call information. Returns the call target and sets each 51 // Get instance call information. Returns the call target and sets each
50 // of the output parameters ic_data and arguments_descriptor if they are 52 // of the output parameters ic_data and arguments_descriptor if they are
51 // non-NULL. 53 // non-NULL.
52 static uword GetInstanceCallAt(uword return_address, 54 static uword GetInstanceCallAt(uword return_address,
55 const Code& code,
53 ICData* ic_data, 56 ICData* ic_data,
54 Array* arguments_descriptor); 57 Array* arguments_descriptor);
55 58
56 static intptr_t InstanceCallSizeInBytes(); 59 static intptr_t InstanceCallSizeInBytes();
57 60
58 static void InsertCallAt(uword start, uword target); 61 static void InsertCallAt(uword start, uword target);
59 }; 62 };
60 63
61 } // namespace dart 64 } // namespace dart
62 65
63 #endif // VM_CODE_PATCHER_H_ 66 #endif // VM_CODE_PATCHER_H_
OLDNEW
« no previous file with comments | « runtime/vm/code_generator.cc ('k') | runtime/vm/code_patcher_arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698