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

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
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 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,
srdjan 2013/02/15 21:24:27 Please modify comment/variable name 'code' to expl
regis 2013/02/15 22:51:31 Done.
30 uword new_target_address);
29 31
30 // Patch instance call to the new target. 32 // Patch instance call 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,
srdjan 2013/02/15 21:24:27 ditto here and below.
regis 2013/02/15 22:51:31 Done.
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 static uword GetStaticCallTargetAt(uword return_address, const Code& code);
44 // or dynamic Dart call.
45 static bool IsDartCall(uword return_address);
46
47 static uword GetStaticCallTargetAt(uword return_address);
48 48
49 // Get instance call information. Returns the call target and sets each 49 // Get instance call information. Returns the call target and sets each
50 // of the output parameters ic_data and arguments_descriptor if they are 50 // of the output parameters ic_data and arguments_descriptor if they are
51 // non-NULL. 51 // non-NULL.
52 static uword GetInstanceCallAt(uword return_address, 52 static uword GetInstanceCallAt(uword return_address,
53 const Code& code,
53 ICData* ic_data, 54 ICData* ic_data,
54 Array* arguments_descriptor); 55 Array* arguments_descriptor);
55 56
56 static intptr_t InstanceCallSizeInBytes(); 57 static intptr_t InstanceCallSizeInBytes();
57 58
58 static void InsertCallAt(uword start, uword target); 59 static void InsertCallAt(uword start, uword target);
59 }; 60 };
60 61
61 } // namespace dart 62 } // namespace dart
62 63
63 #endif // VM_CODE_PATCHER_H_ 64 #endif // VM_CODE_PATCHER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698