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

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

Issue 198163002: MIPS: Reland "Pass a Code object to Assembler::(set_)target_address_at for use by ool constant pool… (Closed) Base URL: https://github.com/v8/v8.git@gbl
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
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.
(...skipping 20 matching lines...) Expand all
162 } 162 }
163 163
164 164
165 int RelocInfo::target_address_size() { 165 int RelocInfo::target_address_size() {
166 return Assembler::kSpecialTargetSize; 166 return Assembler::kSpecialTargetSize;
167 } 167 }
168 168
169 169
170 void RelocInfo::set_target_address(Address target, WriteBarrierMode mode) { 170 void RelocInfo::set_target_address(Address target, WriteBarrierMode mode) {
171 ASSERT(IsCodeTarget(rmode_) || IsRuntimeEntry(rmode_)); 171 ASSERT(IsCodeTarget(rmode_) || IsRuntimeEntry(rmode_));
172 Assembler::set_target_address_at(pc_, target); 172 Assembler::set_target_address_at(pc_, host_, target);
173 if (mode == UPDATE_WRITE_BARRIER && host() != NULL && IsCodeTarget(rmode_)) { 173 if (mode == UPDATE_WRITE_BARRIER && host() != NULL && IsCodeTarget(rmode_)) {
174 Object* target_code = Code::GetCodeFromTargetAddress(target); 174 Object* target_code = Code::GetCodeFromTargetAddress(target);
175 host()->GetHeap()->incremental_marking()->RecordWriteIntoCode( 175 host()->GetHeap()->incremental_marking()->RecordWriteIntoCode(
176 host(), this, HeapObject::cast(target_code)); 176 host(), this, HeapObject::cast(target_code));
177 } 177 }
178 } 178 }
179 179
180 180
181 Address Assembler::target_address_from_return_address(Address pc) { 181 Address Assembler::target_address_from_return_address(Address pc) {
182 return pc - kCallTargetAddressOffset; 182 return pc - kCallTargetAddressOffset;
183 } 183 }
184 184
185 185
186 Object* RelocInfo::target_object() { 186 Object* RelocInfo::target_object() {
187 ASSERT(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT); 187 ASSERT(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT);
188 return reinterpret_cast<Object*>(Assembler::target_address_at(pc_)); 188 return reinterpret_cast<Object*>(Assembler::target_address_at(pc_, host_));
189 } 189 }
190 190
191 191
192 Handle<Object> RelocInfo::target_object_handle(Assembler* origin) { 192 Handle<Object> RelocInfo::target_object_handle(Assembler* origin) {
193 ASSERT(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT); 193 ASSERT(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT);
194 return Handle<Object>(reinterpret_cast<Object**>( 194 return Handle<Object>(reinterpret_cast<Object**>(
195 Assembler::target_address_at(pc_))); 195 Assembler::target_address_at(pc_, host_)));
196 } 196 }
197 197
198 198
199 void RelocInfo::set_target_object(Object* target, WriteBarrierMode mode) { 199 void RelocInfo::set_target_object(Object* target, WriteBarrierMode mode) {
200 ASSERT(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT); 200 ASSERT(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT);
201 ASSERT(!target->IsConsString()); 201 ASSERT(!target->IsConsString());
202 Assembler::set_target_address_at(pc_, reinterpret_cast<Address>(target)); 202 Assembler::set_target_address_at(pc_, host_,
203 reinterpret_cast<Address>(target));
203 if (mode == UPDATE_WRITE_BARRIER && 204 if (mode == UPDATE_WRITE_BARRIER &&
204 host() != NULL && 205 host() != NULL &&
205 target->IsHeapObject()) { 206 target->IsHeapObject()) {
206 host()->GetHeap()->incremental_marking()->RecordWrite( 207 host()->GetHeap()->incremental_marking()->RecordWrite(
207 host(), &Memory::Object_at(pc_), HeapObject::cast(target)); 208 host(), &Memory::Object_at(pc_), HeapObject::cast(target));
208 } 209 }
209 } 210 }
210 211
211 212
212 Address RelocInfo::target_reference() { 213 Address RelocInfo::target_reference() {
213 ASSERT(rmode_ == EXTERNAL_REFERENCE); 214 ASSERT(rmode_ == EXTERNAL_REFERENCE);
214 return Assembler::target_address_at(pc_); 215 return Assembler::target_address_at(pc_, host_);
215 } 216 }
216 217
217 218
218 Address RelocInfo::target_runtime_entry(Assembler* origin) { 219 Address RelocInfo::target_runtime_entry(Assembler* origin) {
219 ASSERT(IsRuntimeEntry(rmode_)); 220 ASSERT(IsRuntimeEntry(rmode_));
220 return target_address(); 221 return target_address();
221 } 222 }
222 223
223 224
224 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
259 260
260 Handle<Object> RelocInfo::code_age_stub_handle(Assembler* origin) { 261 Handle<Object> RelocInfo::code_age_stub_handle(Assembler* origin) {
261 UNREACHABLE(); // This should never be reached on Arm. 262 UNREACHABLE(); // This should never be reached on Arm.
262 return Handle<Object>(); 263 return Handle<Object>();
263 } 264 }
264 265
265 266
266 Code* RelocInfo::code_age_stub() { 267 Code* RelocInfo::code_age_stub() {
267 ASSERT(rmode_ == RelocInfo::CODE_AGE_SEQUENCE); 268 ASSERT(rmode_ == RelocInfo::CODE_AGE_SEQUENCE);
268 return Code::GetCodeFromTargetAddress( 269 return Code::GetCodeFromTargetAddress(
269 Assembler::target_address_at(pc_ + Assembler::kInstrSize)); 270 Assembler::target_address_at(pc_ + Assembler::kInstrSize, host_));
270 } 271 }
271 272
272 273
273 void RelocInfo::set_code_age_stub(Code* stub) { 274 void RelocInfo::set_code_age_stub(Code* stub) {
274 ASSERT(rmode_ == RelocInfo::CODE_AGE_SEQUENCE); 275 ASSERT(rmode_ == RelocInfo::CODE_AGE_SEQUENCE);
275 Assembler::set_target_address_at(pc_ + Assembler::kInstrSize, 276 Assembler::set_target_address_at(pc_ + Assembler::kInstrSize,
277 host_,
276 stub->instruction_start()); 278 stub->instruction_start());
277 } 279 }
278 280
279 281
280 Address RelocInfo::call_address() { 282 Address RelocInfo::call_address() {
281 ASSERT((IsJSReturn(rmode()) && IsPatchedReturnSequence()) || 283 ASSERT((IsJSReturn(rmode()) && IsPatchedReturnSequence()) ||
282 (IsDebugBreakSlot(rmode()) && IsPatchedDebugBreakSlotSequence())); 284 (IsDebugBreakSlot(rmode()) && IsPatchedDebugBreakSlotSequence()));
283 // The pc_ offset of 0 assumes mips patched return sequence per 285 // The pc_ offset of 0 assumes mips patched return sequence per
284 // debug-mips.cc BreakLocationIterator::SetDebugBreakAtReturn(), or 286 // debug-mips.cc BreakLocationIterator::SetDebugBreakAtReturn(), or
285 // debug break slot per BreakLocationIterator::SetDebugBreakAtSlot(). 287 // debug break slot per BreakLocationIterator::SetDebugBreakAtSlot().
286 return Assembler::target_address_at(pc_); 288 return Assembler::target_address_at(pc_, host_);
287 } 289 }
288 290
289 291
290 void RelocInfo::set_call_address(Address target) { 292 void RelocInfo::set_call_address(Address target) {
291 ASSERT((IsJSReturn(rmode()) && IsPatchedReturnSequence()) || 293 ASSERT((IsJSReturn(rmode()) && IsPatchedReturnSequence()) ||
292 (IsDebugBreakSlot(rmode()) && IsPatchedDebugBreakSlotSequence())); 294 (IsDebugBreakSlot(rmode()) && IsPatchedDebugBreakSlotSequence()));
293 // The pc_ offset of 0 assumes mips patched return sequence per 295 // The pc_ offset of 0 assumes mips patched return sequence per
294 // debug-mips.cc BreakLocationIterator::SetDebugBreakAtReturn(), or 296 // debug-mips.cc BreakLocationIterator::SetDebugBreakAtReturn(), or
295 // debug break slot per BreakLocationIterator::SetDebugBreakAtSlot(). 297 // debug break slot per BreakLocationIterator::SetDebugBreakAtSlot().
296 Assembler::set_target_address_at(pc_, target); 298 Assembler::set_target_address_at(pc_, host_, target);
297 if (host() != NULL) { 299 if (host() != NULL) {
298 Object* target_code = Code::GetCodeFromTargetAddress(target); 300 Object* target_code = Code::GetCodeFromTargetAddress(target);
299 host()->GetHeap()->incremental_marking()->RecordWriteIntoCode( 301 host()->GetHeap()->incremental_marking()->RecordWriteIntoCode(
300 host(), this, HeapObject::cast(target_code)); 302 host(), this, HeapObject::cast(target_code));
301 } 303 }
302 } 304 }
303 305
304 306
305 Object* RelocInfo::call_object() { 307 Object* RelocInfo::call_object() {
306 return *call_object_address(); 308 return *call_object_address();
(...skipping 10 matching lines...) Expand all
317 void RelocInfo::set_call_object(Object* target) { 319 void RelocInfo::set_call_object(Object* target) {
318 *call_object_address() = target; 320 *call_object_address() = target;
319 } 321 }
320 322
321 323
322 void RelocInfo::WipeOut() { 324 void RelocInfo::WipeOut() {
323 ASSERT(IsEmbeddedObject(rmode_) || 325 ASSERT(IsEmbeddedObject(rmode_) ||
324 IsCodeTarget(rmode_) || 326 IsCodeTarget(rmode_) ||
325 IsRuntimeEntry(rmode_) || 327 IsRuntimeEntry(rmode_) ||
326 IsExternalReference(rmode_)); 328 IsExternalReference(rmode_));
327 Assembler::set_target_address_at(pc_, NULL); 329 Assembler::set_target_address_at(pc_, host_, NULL);
328 } 330 }
329 331
330 332
331 bool RelocInfo::IsPatchedReturnSequence() { 333 bool RelocInfo::IsPatchedReturnSequence() {
332 Instr instr0 = Assembler::instr_at(pc_); 334 Instr instr0 = Assembler::instr_at(pc_);
333 Instr instr1 = Assembler::instr_at(pc_ + 1 * Assembler::kInstrSize); 335 Instr instr1 = Assembler::instr_at(pc_ + 1 * Assembler::kInstrSize);
334 Instr instr2 = Assembler::instr_at(pc_ + 2 * Assembler::kInstrSize); 336 Instr instr2 = Assembler::instr_at(pc_ + 2 * Assembler::kInstrSize);
335 bool patched_return = ((instr0 & kOpcodeMask) == LUI && 337 bool patched_return = ((instr0 & kOpcodeMask) == LUI &&
336 (instr1 & kOpcodeMask) == ORI && 338 (instr1 & kOpcodeMask) == ORI &&
337 ((instr2 & kOpcodeMask) == JAL || 339 ((instr2 & kOpcodeMask) == JAL ||
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
424 } 426 }
425 *reinterpret_cast<Instr*>(pc_) = x; 427 *reinterpret_cast<Instr*>(pc_) = x;
426 pc_ += kInstrSize; 428 pc_ += kInstrSize;
427 CheckTrampolinePoolQuick(); 429 CheckTrampolinePoolQuick();
428 } 430 }
429 431
430 432
431 } } // namespace v8::internal 433 } } // namespace v8::internal
432 434
433 #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.h ('k') | src/mips/frames-mips.h » ('j') | src/mips/frames-mips.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698