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

Side by Side Diff: src/mips/assembler-mips-inl.h

Issue 196133017: Experimental parser: merge r19949 (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/parser
Patch Set: Created 6 years, 9 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 | « src/mips/assembler-mips.cc ('k') | src/mips/builtins-mips.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 1
2 // Copyright (c) 1994-2006 Sun Microsystems Inc. 2 // Copyright (c) 1994-2006 Sun Microsystems Inc.
3 // All Rights Reserved. 3 // All Rights Reserved.
4 // 4 //
5 // Redistribution and use in source and binary forms, with or without 5 // Redistribution and use in source and binary forms, with or without
6 // modification, are permitted provided that the following conditions are 6 // modification, are permitted provided that the following conditions are
7 // met: 7 // met:
8 // 8 //
9 // - Redistributions of source code must retain the above copyright notice, 9 // - Redistributions of source code must retain the above copyright notice,
10 // this list of conditions and the following disclaimer. 10 // this list of conditions and the following disclaimer.
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 // Absolute code pointer inside code object moves with the code object. 121 // Absolute code pointer inside code object moves with the code object.
122 byte* p = reinterpret_cast<byte*>(pc_); 122 byte* p = reinterpret_cast<byte*>(pc_);
123 int count = Assembler::RelocateInternalReference(p, delta); 123 int count = Assembler::RelocateInternalReference(p, delta);
124 CPU::FlushICache(p, count * sizeof(uint32_t)); 124 CPU::FlushICache(p, count * sizeof(uint32_t));
125 } 125 }
126 } 126 }
127 127
128 128
129 Address RelocInfo::target_address() { 129 Address RelocInfo::target_address() {
130 ASSERT(IsCodeTarget(rmode_) || IsRuntimeEntry(rmode_)); 130 ASSERT(IsCodeTarget(rmode_) || IsRuntimeEntry(rmode_));
131 return Assembler::target_address_at(pc_); 131 return Assembler::target_address_at(pc_, host_);
132 } 132 }
133 133
134 134
135 Address RelocInfo::target_address_address() { 135 Address RelocInfo::target_address_address() {
136 ASSERT(IsCodeTarget(rmode_) || 136 ASSERT(IsCodeTarget(rmode_) ||
137 IsRuntimeEntry(rmode_) || 137 IsRuntimeEntry(rmode_) ||
138 rmode_ == EMBEDDED_OBJECT || 138 rmode_ == EMBEDDED_OBJECT ||
139 rmode_ == EXTERNAL_REFERENCE); 139 rmode_ == EXTERNAL_REFERENCE);
140 // Read the address of the word containing the target_address in an 140 // Read the address of the word containing the target_address in an
141 // instruction stream. 141 // instruction stream.
142 // The only architecture-independent user of this function is the serializer. 142 // The only architecture-independent user of this function is the serializer.
143 // The serializer uses it to find out how many raw bytes of instruction to 143 // The serializer uses it to find out how many raw bytes of instruction to
144 // output before the next target. 144 // output before the next target.
145 // For an instruction like LUI/ORI where the target bits are mixed into the 145 // For an instruction like LUI/ORI where the target bits are mixed into the
146 // instruction bits, the size of the target will be zero, indicating that the 146 // instruction bits, the size of the target will be zero, indicating that the
147 // serializer should not step forward in memory after a target is resolved 147 // serializer should not step forward in memory after a target is resolved
148 // and written. In this case the target_address_address function should 148 // and written. In this case the target_address_address function should
149 // return the end of the instructions to be patched, allowing the 149 // return the end of the instructions to be patched, allowing the
150 // deserializer to deserialize the instructions as raw bytes and put them in 150 // deserializer to deserialize the instructions as raw bytes and put them in
151 // place, ready to be patched with the target. After jump optimization, 151 // place, ready to be patched with the target. After jump optimization,
152 // that is the address of the instruction that follows J/JAL/JR/JALR 152 // that is the address of the instruction that follows J/JAL/JR/JALR
153 // instruction. 153 // instruction.
154 return reinterpret_cast<Address>( 154 return reinterpret_cast<Address>(
155 pc_ + Assembler::kInstructionsFor32BitConstant * Assembler::kInstrSize); 155 pc_ + Assembler::kInstructionsFor32BitConstant * Assembler::kInstrSize);
156 } 156 }
157 157
158 158
159 Address RelocInfo::constant_pool_entry_address() {
160 UNREACHABLE();
161 return NULL;
162 }
163
164
159 int RelocInfo::target_address_size() { 165 int RelocInfo::target_address_size() {
160 return Assembler::kSpecialTargetSize; 166 return Assembler::kSpecialTargetSize;
161 } 167 }
162 168
163 169
164 void RelocInfo::set_target_address(Address target, WriteBarrierMode mode) { 170 void RelocInfo::set_target_address(Address target, WriteBarrierMode mode) {
165 ASSERT(IsCodeTarget(rmode_) || IsRuntimeEntry(rmode_)); 171 ASSERT(IsCodeTarget(rmode_) || IsRuntimeEntry(rmode_));
166 Assembler::set_target_address_at(pc_, target); 172 Assembler::set_target_address_at(pc_, host_, target);
167 if (mode == UPDATE_WRITE_BARRIER && host() != NULL && IsCodeTarget(rmode_)) { 173 if (mode == UPDATE_WRITE_BARRIER && host() != NULL && IsCodeTarget(rmode_)) {
168 Object* target_code = Code::GetCodeFromTargetAddress(target); 174 Object* target_code = Code::GetCodeFromTargetAddress(target);
169 host()->GetHeap()->incremental_marking()->RecordWriteIntoCode( 175 host()->GetHeap()->incremental_marking()->RecordWriteIntoCode(
170 host(), this, HeapObject::cast(target_code)); 176 host(), this, HeapObject::cast(target_code));
171 } 177 }
172 } 178 }
173 179
174 180
175 Address Assembler::target_address_from_return_address(Address pc) { 181 Address Assembler::target_address_from_return_address(Address pc) {
176 return pc - kCallTargetAddressOffset; 182 return pc - kCallTargetAddressOffset;
177 } 183 }
178 184
179 185
180 Object* RelocInfo::target_object() { 186 Object* RelocInfo::target_object() {
181 ASSERT(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT); 187 ASSERT(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT);
182 return reinterpret_cast<Object*>(Assembler::target_address_at(pc_)); 188 return reinterpret_cast<Object*>(Assembler::target_address_at(pc_, host_));
183 } 189 }
184 190
185 191
186 Handle<Object> RelocInfo::target_object_handle(Assembler* origin) { 192 Handle<Object> RelocInfo::target_object_handle(Assembler* origin) {
187 ASSERT(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT); 193 ASSERT(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT);
188 return Handle<Object>(reinterpret_cast<Object**>( 194 return Handle<Object>(reinterpret_cast<Object**>(
189 Assembler::target_address_at(pc_))); 195 Assembler::target_address_at(pc_, host_)));
190 } 196 }
191 197
192 198
193 void RelocInfo::set_target_object(Object* target, WriteBarrierMode mode) { 199 void RelocInfo::set_target_object(Object* target, WriteBarrierMode mode) {
194 ASSERT(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT); 200 ASSERT(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT);
195 ASSERT(!target->IsConsString()); 201 ASSERT(!target->IsConsString());
196 Assembler::set_target_address_at(pc_, reinterpret_cast<Address>(target)); 202 Assembler::set_target_address_at(pc_, host_,
203 reinterpret_cast<Address>(target));
197 if (mode == UPDATE_WRITE_BARRIER && 204 if (mode == UPDATE_WRITE_BARRIER &&
198 host() != NULL && 205 host() != NULL &&
199 target->IsHeapObject()) { 206 target->IsHeapObject()) {
200 host()->GetHeap()->incremental_marking()->RecordWrite( 207 host()->GetHeap()->incremental_marking()->RecordWrite(
201 host(), &Memory::Object_at(pc_), HeapObject::cast(target)); 208 host(), &Memory::Object_at(pc_), HeapObject::cast(target));
202 } 209 }
203 } 210 }
204 211
205 212
206 Address RelocInfo::target_reference() { 213 Address RelocInfo::target_reference() {
207 ASSERT(rmode_ == EXTERNAL_REFERENCE); 214 ASSERT(rmode_ == EXTERNAL_REFERENCE);
208 return Assembler::target_address_at(pc_); 215 return Assembler::target_address_at(pc_, host_);
209 } 216 }
210 217
211 218
212 Address RelocInfo::target_runtime_entry(Assembler* origin) { 219 Address RelocInfo::target_runtime_entry(Assembler* origin) {
213 ASSERT(IsRuntimeEntry(rmode_)); 220 ASSERT(IsRuntimeEntry(rmode_));
214 return target_address(); 221 return target_address();
215 } 222 }
216 223
217 224
218 void RelocInfo::set_target_runtime_entry(Address target, 225 void RelocInfo::set_target_runtime_entry(Address target,
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 260
254 Handle<Object> RelocInfo::code_age_stub_handle(Assembler* origin) { 261 Handle<Object> RelocInfo::code_age_stub_handle(Assembler* origin) {
255 UNREACHABLE(); // This should never be reached on Arm. 262 UNREACHABLE(); // This should never be reached on Arm.
256 return Handle<Object>(); 263 return Handle<Object>();
257 } 264 }
258 265
259 266
260 Code* RelocInfo::code_age_stub() { 267 Code* RelocInfo::code_age_stub() {
261 ASSERT(rmode_ == RelocInfo::CODE_AGE_SEQUENCE); 268 ASSERT(rmode_ == RelocInfo::CODE_AGE_SEQUENCE);
262 return Code::GetCodeFromTargetAddress( 269 return Code::GetCodeFromTargetAddress(
263 Assembler::target_address_at(pc_ + Assembler::kInstrSize)); 270 Assembler::target_address_at(pc_ + Assembler::kInstrSize, host_));
264 } 271 }
265 272
266 273
267 void RelocInfo::set_code_age_stub(Code* stub) { 274 void RelocInfo::set_code_age_stub(Code* stub) {
268 ASSERT(rmode_ == RelocInfo::CODE_AGE_SEQUENCE); 275 ASSERT(rmode_ == RelocInfo::CODE_AGE_SEQUENCE);
269 Assembler::set_target_address_at(pc_ + Assembler::kInstrSize, 276 Assembler::set_target_address_at(pc_ + Assembler::kInstrSize,
277 host_,
270 stub->instruction_start()); 278 stub->instruction_start());
271 } 279 }
272 280
273 281
274 Address RelocInfo::call_address() { 282 Address RelocInfo::call_address() {
275 ASSERT((IsJSReturn(rmode()) && IsPatchedReturnSequence()) || 283 ASSERT((IsJSReturn(rmode()) && IsPatchedReturnSequence()) ||
276 (IsDebugBreakSlot(rmode()) && IsPatchedDebugBreakSlotSequence())); 284 (IsDebugBreakSlot(rmode()) && IsPatchedDebugBreakSlotSequence()));
277 // The pc_ offset of 0 assumes mips patched return sequence per 285 // The pc_ offset of 0 assumes mips patched return sequence per
278 // debug-mips.cc BreakLocationIterator::SetDebugBreakAtReturn(), or 286 // debug-mips.cc BreakLocationIterator::SetDebugBreakAtReturn(), or
279 // debug break slot per BreakLocationIterator::SetDebugBreakAtSlot(). 287 // debug break slot per BreakLocationIterator::SetDebugBreakAtSlot().
280 return Assembler::target_address_at(pc_); 288 return Assembler::target_address_at(pc_, host_);
281 } 289 }
282 290
283 291
284 void RelocInfo::set_call_address(Address target) { 292 void RelocInfo::set_call_address(Address target) {
285 ASSERT((IsJSReturn(rmode()) && IsPatchedReturnSequence()) || 293 ASSERT((IsJSReturn(rmode()) && IsPatchedReturnSequence()) ||
286 (IsDebugBreakSlot(rmode()) && IsPatchedDebugBreakSlotSequence())); 294 (IsDebugBreakSlot(rmode()) && IsPatchedDebugBreakSlotSequence()));
287 // The pc_ offset of 0 assumes mips patched return sequence per 295 // The pc_ offset of 0 assumes mips patched return sequence per
288 // debug-mips.cc BreakLocationIterator::SetDebugBreakAtReturn(), or 296 // debug-mips.cc BreakLocationIterator::SetDebugBreakAtReturn(), or
289 // debug break slot per BreakLocationIterator::SetDebugBreakAtSlot(). 297 // debug break slot per BreakLocationIterator::SetDebugBreakAtSlot().
290 Assembler::set_target_address_at(pc_, target); 298 Assembler::set_target_address_at(pc_, host_, target);
291 if (host() != NULL) { 299 if (host() != NULL) {
292 Object* target_code = Code::GetCodeFromTargetAddress(target); 300 Object* target_code = Code::GetCodeFromTargetAddress(target);
293 host()->GetHeap()->incremental_marking()->RecordWriteIntoCode( 301 host()->GetHeap()->incremental_marking()->RecordWriteIntoCode(
294 host(), this, HeapObject::cast(target_code)); 302 host(), this, HeapObject::cast(target_code));
295 } 303 }
296 } 304 }
297 305
298 306
299 Object* RelocInfo::call_object() { 307 Object* RelocInfo::call_object() {
300 return *call_object_address(); 308 return *call_object_address();
(...skipping 10 matching lines...) Expand all
311 void RelocInfo::set_call_object(Object* target) { 319 void RelocInfo::set_call_object(Object* target) {
312 *call_object_address() = target; 320 *call_object_address() = target;
313 } 321 }
314 322
315 323
316 void RelocInfo::WipeOut() { 324 void RelocInfo::WipeOut() {
317 ASSERT(IsEmbeddedObject(rmode_) || 325 ASSERT(IsEmbeddedObject(rmode_) ||
318 IsCodeTarget(rmode_) || 326 IsCodeTarget(rmode_) ||
319 IsRuntimeEntry(rmode_) || 327 IsRuntimeEntry(rmode_) ||
320 IsExternalReference(rmode_)); 328 IsExternalReference(rmode_));
321 Assembler::set_target_address_at(pc_, NULL); 329 Assembler::set_target_address_at(pc_, host_, NULL);
322 } 330 }
323 331
324 332
325 bool RelocInfo::IsPatchedReturnSequence() { 333 bool RelocInfo::IsPatchedReturnSequence() {
326 Instr instr0 = Assembler::instr_at(pc_); 334 Instr instr0 = Assembler::instr_at(pc_);
327 Instr instr1 = Assembler::instr_at(pc_ + 1 * Assembler::kInstrSize); 335 Instr instr1 = Assembler::instr_at(pc_ + 1 * Assembler::kInstrSize);
328 Instr instr2 = Assembler::instr_at(pc_ + 2 * Assembler::kInstrSize); 336 Instr instr2 = Assembler::instr_at(pc_ + 2 * Assembler::kInstrSize);
329 bool patched_return = ((instr0 & kOpcodeMask) == LUI && 337 bool patched_return = ((instr0 & kOpcodeMask) == LUI &&
330 (instr1 & kOpcodeMask) == ORI && 338 (instr1 & kOpcodeMask) == ORI &&
331 ((instr2 & kOpcodeMask) == JAL || 339 ((instr2 & kOpcodeMask) == JAL ||
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
418 } 426 }
419 *reinterpret_cast<Instr*>(pc_) = x; 427 *reinterpret_cast<Instr*>(pc_) = x;
420 pc_ += kInstrSize; 428 pc_ += kInstrSize;
421 CheckTrampolinePoolQuick(); 429 CheckTrampolinePoolQuick();
422 } 430 }
423 431
424 432
425 } } // namespace v8::internal 433 } } // namespace v8::internal
426 434
427 #endif // V8_MIPS_ASSEMBLER_MIPS_INL_H_ 435 #endif // V8_MIPS_ASSEMBLER_MIPS_INL_H_
OLDNEW
« no previous file with comments | « src/mips/assembler-mips.cc ('k') | src/mips/builtins-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698