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

Side by Side Diff: vm/code_patcher.h

Issue 8379013: Implement new inline cache. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: '' Created 9 years, 1 month 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) 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 call to the new target.
26 static void PatchStaticCallAt(uword addr, uword new_target_address); 26 static void PatchStaticCallAt(uword addr, uword new_target_address);
27 27
28 // Overwrites code at 'at_addr' with a call to 'label'.
29 static void InsertCall(uword at_addr, const ExternalLabel* label);
30
31 // Overwrites code at 'at_addr' with a jump to 'label'.
32 static void InsertJump(uword at_addr, const ExternalLabel* label);
33
34 // Patch entry point with a jump as specified in the code's patch region. 28 // Patch entry point with a jump as specified in the code's patch region.
35 static void PatchEntry(const Code& code); 29 static void PatchEntry(const Code& code);
36 30
37 // Restore entry point with original code (i.e., before patching). 31 // Restore entry point with original code (i.e., before patching).
38 static void RestoreEntry(const Code& code); 32 static void RestoreEntry(const Code& code);
39 33
40 // Returns true if the code can be patched with a jump at beginnning (checks 34 // Returns true if the code can be patched with a jump at beginnning (checks
41 // that there are no conflicts with object pointers). 35 // that there are no conflicts with object pointers).
42 static bool CodeIsPatchable(const Code& code); 36 static bool CodeIsPatchable(const Code& code);
43 37
44 // Get static call information. 38 // Get static call information.
45 static void GetStaticCallAt(uword return_address, 39 static void GetStaticCallAt(uword return_address,
46 Function* function, 40 Function* function,
47 uword* target); 41 uword* target);
48 42
49 // Patch instance call to the new target.
50 static void PatchInstanceCallAt(uword addr, uword new_target_address);
51
52 // Get instance call information. 43 // Get instance call information.
53 static void GetInstanceCallAt(uword return_address, 44 static void GetInstanceCallAt(uword return_address,
54 String* function_name, 45 String* function_name,
55 int* num_arguments, 46 int* num_arguments,
56 int* num_named_arguments, 47 int* num_named_arguments,
57 uword* target); 48 uword* target);
58 49
59 static RawArray* GetInstanceCallIcDataAt(uword return_address); 50 static RawArray* GetInstanceCallIcDataAt(uword return_address);
60 51
61 static void SetInstanceCallIcDataAt(uword return_address, 52 static void SetInstanceCallIcDataAt(uword return_address,
62 const Array& ic_data); 53 const Array& ic_data);
63 54
64 static intptr_t InstanceCallSizeInBytes(); 55 static intptr_t InstanceCallSizeInBytes();
65 }; 56 };
66 57
67 } // namespace dart 58 } // namespace dart
68 59
69 #endif // VM_CODE_PATCHER_H_ 60 #endif // VM_CODE_PATCHER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698