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

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

Issue 2974233002: VM: Re-format to use at most one newline between functions (Closed)
Patch Set: Rebase and merge Created 3 years, 5 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/instructions_dbc.cc ('k') | runtime/vm/instructions_ia32_test.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 // 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 RUNTIME_VM_INSTRUCTIONS_IA32_H_ 6 #ifndef RUNTIME_VM_INSTRUCTIONS_IA32_H_
7 #define RUNTIME_VM_INSTRUCTIONS_IA32_H_ 7 #define RUNTIME_VM_INSTRUCTIONS_IA32_H_
8 8
9 #ifndef RUNTIME_VM_INSTRUCTIONS_H_ 9 #ifndef RUNTIME_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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 } 53 }
54 } 54 }
55 return true; 55 return true;
56 } 56 }
57 57
58 const uword start_; 58 const uword start_;
59 59
60 DISALLOW_COPY_AND_ASSIGN(InstructionPattern); 60 DISALLOW_COPY_AND_ASSIGN(InstructionPattern);
61 }; 61 };
62 62
63
64 class CallPattern : public InstructionPattern<CallPattern> { 63 class CallPattern : public InstructionPattern<CallPattern> {
65 public: 64 public:
66 explicit CallPattern(uword pc) : InstructionPattern(pc) {} 65 explicit CallPattern(uword pc) : InstructionPattern(pc) {}
67 uword TargetAddress() const { 66 uword TargetAddress() const {
68 ASSERT(this->IsValid()); 67 ASSERT(this->IsValid());
69 return this->start() + CallPattern::pattern_length_in_bytes() + 68 return this->start() + CallPattern::pattern_length_in_bytes() +
70 *reinterpret_cast<uword*>(this->start() + 1); 69 *reinterpret_cast<uword*>(this->start() + 1);
71 } 70 }
72 71
73 void SetTargetAddress(uword new_target) const { 72 void SetTargetAddress(uword new_target) const {
74 ASSERT(this->IsValid()); 73 ASSERT(this->IsValid());
75 *reinterpret_cast<uword*>(this->start() + 1) = 74 *reinterpret_cast<uword*>(this->start() + 1) =
76 new_target - this->start() - CallPattern::pattern_length_in_bytes(); 75 new_target - this->start() - CallPattern::pattern_length_in_bytes();
77 CPU::FlushICache(this->start() + 1, kWordSize); 76 CPU::FlushICache(this->start() + 1, kWordSize);
78 } 77 }
79 78
80 static int pattern_length_in_bytes() { return kLengthInBytes; } 79 static int pattern_length_in_bytes() { return kLengthInBytes; }
81 static const int* pattern() { 80 static const int* pattern() {
82 static const int kCallPattern[kLengthInBytes] = {0xE8, -1, -1, -1, -1}; 81 static const int kCallPattern[kLengthInBytes] = {0xE8, -1, -1, -1, -1};
83 return kCallPattern; 82 return kCallPattern;
84 } 83 }
85 84
86
87 private: 85 private:
88 static const int kLengthInBytes = 5; 86 static const int kLengthInBytes = 5;
89 DISALLOW_COPY_AND_ASSIGN(CallPattern); 87 DISALLOW_COPY_AND_ASSIGN(CallPattern);
90 }; 88 };
91 89
92
93 class ReturnPattern : public InstructionPattern<ReturnPattern> { 90 class ReturnPattern : public InstructionPattern<ReturnPattern> {
94 public: 91 public:
95 explicit ReturnPattern(uword pc) : InstructionPattern(pc) {} 92 explicit ReturnPattern(uword pc) : InstructionPattern(pc) {}
96 93
97 static const int* pattern() { 94 static const int* pattern() {
98 static const int kReturnPattern[kLengthInBytes] = {0xC3}; 95 static const int kReturnPattern[kLengthInBytes] = {0xC3};
99 return kReturnPattern; 96 return kReturnPattern;
100 } 97 }
101 static int pattern_length_in_bytes() { return kLengthInBytes; } 98 static int pattern_length_in_bytes() { return kLengthInBytes; }
102 99
103 private: 100 private:
104 static const int kLengthInBytes = 1; 101 static const int kLengthInBytes = 1;
105 }; 102 };
106 103
107
108 // push ebp 104 // push ebp
109 // mov ebp, esp 105 // mov ebp, esp
110 class ProloguePattern : public InstructionPattern<ProloguePattern> { 106 class ProloguePattern : public InstructionPattern<ProloguePattern> {
111 public: 107 public:
112 explicit ProloguePattern(uword pc) : InstructionPattern(pc) {} 108 explicit ProloguePattern(uword pc) : InstructionPattern(pc) {}
113 109
114 static const int* pattern() { 110 static const int* pattern() {
115 static const int kProloguePattern[kLengthInBytes] = {0x55, 0x89, 0xe5}; 111 static const int kProloguePattern[kLengthInBytes] = {0x55, 0x89, 0xe5};
116 return kProloguePattern; 112 return kProloguePattern;
117 } 113 }
118 114
119 static int pattern_length_in_bytes() { return kLengthInBytes; } 115 static int pattern_length_in_bytes() { return kLengthInBytes; }
120 116
121 private: 117 private:
122 static const int kLengthInBytes = 3; 118 static const int kLengthInBytes = 3;
123 }; 119 };
124 120
125
126 // mov ebp, esp 121 // mov ebp, esp
127 class SetFramePointerPattern 122 class SetFramePointerPattern
128 : public InstructionPattern<SetFramePointerPattern> { 123 : public InstructionPattern<SetFramePointerPattern> {
129 public: 124 public:
130 explicit SetFramePointerPattern(uword pc) : InstructionPattern(pc) {} 125 explicit SetFramePointerPattern(uword pc) : InstructionPattern(pc) {}
131 126
132 static const int* pattern() { 127 static const int* pattern() {
133 static const int kFramePointerPattern[kLengthInBytes] = {0x89, 0xe5}; 128 static const int kFramePointerPattern[kLengthInBytes] = {0x89, 0xe5};
134 return kFramePointerPattern; 129 return kFramePointerPattern;
135 } 130 }
136 131
137 static int pattern_length_in_bytes() { return kLengthInBytes; } 132 static int pattern_length_in_bytes() { return kLengthInBytes; }
138 133
139 private: 134 private:
140 static const int kLengthInBytes = 2; 135 static const int kLengthInBytes = 2;
141 }; 136 };
142 137
143 } // namespace dart 138 } // namespace dart
144 139
145 #endif // RUNTIME_VM_INSTRUCTIONS_IA32_H_ 140 #endif // RUNTIME_VM_INSTRUCTIONS_IA32_H_
OLDNEW
« no previous file with comments | « runtime/vm/instructions_dbc.cc ('k') | runtime/vm/instructions_ia32_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698