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

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

Issue 1376963002: Cleanup: we are not patching entries any longer (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Address review comments Created 5 years, 2 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
« no previous file with comments | « runtime/vm/compiler.cc ('k') | runtime/vm/object.h » ('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 // Classes that describe assembly patterns as used by inline caches. 4 // Classes that describe assembly patterns as used by inline caches.
5 5
6 #ifndef VM_INSTRUCTIONS_IA32_H_ 6 #ifndef VM_INSTRUCTIONS_IA32_H_
7 #define VM_INSTRUCTIONS_IA32_H_ 7 #define VM_INSTRUCTIONS_IA32_H_
8 8
9 #ifndef VM_INSTRUCTIONS_H_ 9 #ifndef VM_INSTRUCTIONS_H_
10 #error Do not include instructions_ia32.h directly; use instructions.h instead. 10 #error Do not include instructions_ia32.h directly; use instructions.h instead.
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 } 55 }
56 return true; 56 return true;
57 } 57 }
58 58
59 const uword start_; 59 const uword start_;
60 60
61 DISALLOW_COPY_AND_ASSIGN(InstructionPattern); 61 DISALLOW_COPY_AND_ASSIGN(InstructionPattern);
62 }; 62 };
63 63
64 64
65 template<class P> 65 class CallPattern : public InstructionPattern<CallPattern> {
66 class CallOrJumpPattern : public InstructionPattern<P> {
67 public: 66 public:
67 explicit CallPattern(uword pc) : InstructionPattern(pc) {}
68 uword TargetAddress() const { 68 uword TargetAddress() const {
69 ASSERT(this->IsValid()); 69 ASSERT(this->IsValid());
70 return this->start() + 70 return this->start() +
71 P::pattern_length_in_bytes() + 71 CallPattern::pattern_length_in_bytes() +
72 *reinterpret_cast<uword*>(this->start() + 1); 72 *reinterpret_cast<uword*>(this->start() + 1);
73 } 73 }
74 74
75 void SetTargetAddress(uword new_target) const { 75 void SetTargetAddress(uword new_target) const {
76 ASSERT(this->IsValid()); 76 ASSERT(this->IsValid());
77 *reinterpret_cast<uword*>(this->start() + 1) = 77 *reinterpret_cast<uword*>(this->start() + 1) =
78 new_target - this->start() - P::pattern_length_in_bytes(); 78 new_target - this->start() - CallPattern::pattern_length_in_bytes();
79 CPU::FlushICache(this->start() + 1, kWordSize); 79 CPU::FlushICache(this->start() + 1, kWordSize);
80 } 80 }
81 81
82 protected:
83 explicit CallOrJumpPattern(uword pc) : InstructionPattern<P>(pc) {}
84
85 private:
86 DISALLOW_COPY_AND_ASSIGN(CallOrJumpPattern);
87 };
88
89
90 class CallPattern : public CallOrJumpPattern<CallPattern> {
91 public:
92 explicit CallPattern(uword pc) : CallOrJumpPattern(pc) {}
93
94 static int pattern_length_in_bytes() { return kLengthInBytes; } 82 static int pattern_length_in_bytes() { return kLengthInBytes; }
95 static const int* pattern() { 83 static const int* pattern() {
96 static const int kCallPattern[kLengthInBytes] = {0xE8, -1, -1, -1, -1}; 84 static const int kCallPattern[kLengthInBytes] = {0xE8, -1, -1, -1, -1};
97 return kCallPattern; 85 return kCallPattern;
98 } 86 }
99 87
88
100 private: 89 private:
101 static const int kLengthInBytes = 5; 90 static const int kLengthInBytes = 5;
102
103 DISALLOW_COPY_AND_ASSIGN(CallPattern); 91 DISALLOW_COPY_AND_ASSIGN(CallPattern);
104 }; 92 };
105 93
106 94
107 class ReturnPattern : public InstructionPattern<ReturnPattern> { 95 class ReturnPattern : public InstructionPattern<ReturnPattern> {
108 public: 96 public:
109 explicit ReturnPattern(uword pc) : InstructionPattern(pc) {} 97 explicit ReturnPattern(uword pc) : InstructionPattern(pc) {}
110 98
111 static const int* pattern() { 99 static const int* pattern() {
112 static const int kReturnPattern[kLengthInBytes] = { 0xC3 }; 100 static const int kReturnPattern[kLengthInBytes] = { 0xC3 };
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 138
151 static int pattern_length_in_bytes() { return kLengthInBytes; } 139 static int pattern_length_in_bytes() { return kLengthInBytes; }
152 140
153 private: 141 private:
154 static const int kLengthInBytes = 2; 142 static const int kLengthInBytes = 2;
155 }; 143 };
156 144
157 } // namespace dart 145 } // namespace dart
158 146
159 #endif // VM_INSTRUCTIONS_IA32_H_ 147 #endif // VM_INSTRUCTIONS_IA32_H_
OLDNEW
« no previous file with comments | « runtime/vm/compiler.cc ('k') | runtime/vm/object.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698