OLD | NEW |
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 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 | 135 |
136 int RelocInfo::target_address_size() { | 136 int RelocInfo::target_address_size() { |
137 return Assembler::kSpecialTargetSize; | 137 return Assembler::kSpecialTargetSize; |
138 } | 138 } |
139 | 139 |
140 | 140 |
141 void RelocInfo::set_target_address(Address target, | 141 void RelocInfo::set_target_address(Address target, |
142 WriteBarrierMode write_barrier_mode, | 142 WriteBarrierMode write_barrier_mode, |
143 ICacheFlushMode icache_flush_mode) { | 143 ICacheFlushMode icache_flush_mode) { |
144 DCHECK(IsCodeTarget(rmode_) || IsRuntimeEntry(rmode_)); | 144 DCHECK(IsCodeTarget(rmode_) || IsRuntimeEntry(rmode_)); |
145 Assembler::set_target_address_at(pc_, host_, target, icache_flush_mode); | 145 Assembler::set_target_address_at(isolate_, pc_, host_, target, |
| 146 icache_flush_mode); |
146 if (write_barrier_mode == UPDATE_WRITE_BARRIER && | 147 if (write_barrier_mode == UPDATE_WRITE_BARRIER && |
147 host() != NULL && IsCodeTarget(rmode_)) { | 148 host() != NULL && IsCodeTarget(rmode_)) { |
148 Object* target_code = Code::GetCodeFromTargetAddress(target); | 149 Object* target_code = Code::GetCodeFromTargetAddress(target); |
149 host()->GetHeap()->incremental_marking()->RecordWriteIntoCode( | 150 host()->GetHeap()->incremental_marking()->RecordWriteIntoCode( |
150 host(), this, HeapObject::cast(target_code)); | 151 host(), this, HeapObject::cast(target_code)); |
151 } | 152 } |
152 } | 153 } |
153 | 154 |
154 | 155 |
155 Address Assembler::target_address_from_return_address(Address pc) { | 156 Address Assembler::target_address_from_return_address(Address pc) { |
(...skipping 16 matching lines...) Expand all Loading... |
172 instr_lui | ((imm >> kLuiShift) & kImm16Mask)); | 173 instr_lui | ((imm >> kLuiShift) & kImm16Mask)); |
173 Assembler::instr_at_put(pc + 1 * Assembler::kInstrSize, | 174 Assembler::instr_at_put(pc + 1 * Assembler::kInstrSize, |
174 instr_ori | (imm & kImm16Mask)); | 175 instr_ori | (imm & kImm16Mask)); |
175 | 176 |
176 // Currently used only by deserializer, and all code will be flushed | 177 // Currently used only by deserializer, and all code will be flushed |
177 // after complete deserialization, no need to flush on each reference. | 178 // after complete deserialization, no need to flush on each reference. |
178 } | 179 } |
179 | 180 |
180 | 181 |
181 void Assembler::deserialization_set_target_internal_reference_at( | 182 void Assembler::deserialization_set_target_internal_reference_at( |
182 Address pc, Address target, RelocInfo::Mode mode) { | 183 Isolate* isolate, Address pc, Address target, RelocInfo::Mode mode) { |
183 if (mode == RelocInfo::INTERNAL_REFERENCE_ENCODED) { | 184 if (mode == RelocInfo::INTERNAL_REFERENCE_ENCODED) { |
184 DCHECK(IsLui(instr_at(pc))); | 185 DCHECK(IsLui(instr_at(pc))); |
185 set_target_internal_reference_encoded_at(pc, target); | 186 set_target_internal_reference_encoded_at(pc, target); |
186 } else { | 187 } else { |
187 DCHECK(mode == RelocInfo::INTERNAL_REFERENCE); | 188 DCHECK(mode == RelocInfo::INTERNAL_REFERENCE); |
188 Memory::Address_at(pc) = target; | 189 Memory::Address_at(pc) = target; |
189 } | 190 } |
190 } | 191 } |
191 | 192 |
192 | 193 |
193 Object* RelocInfo::target_object() { | 194 Object* RelocInfo::target_object() { |
194 DCHECK(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT); | 195 DCHECK(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT); |
195 return reinterpret_cast<Object*>(Assembler::target_address_at(pc_, host_)); | 196 return reinterpret_cast<Object*>(Assembler::target_address_at(pc_, host_)); |
196 } | 197 } |
197 | 198 |
198 | 199 |
199 Handle<Object> RelocInfo::target_object_handle(Assembler* origin) { | 200 Handle<Object> RelocInfo::target_object_handle(Assembler* origin) { |
200 DCHECK(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT); | 201 DCHECK(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT); |
201 return Handle<Object>(reinterpret_cast<Object**>( | 202 return Handle<Object>(reinterpret_cast<Object**>( |
202 Assembler::target_address_at(pc_, host_))); | 203 Assembler::target_address_at(pc_, host_))); |
203 } | 204 } |
204 | 205 |
205 | 206 |
206 void RelocInfo::set_target_object(Object* target, | 207 void RelocInfo::set_target_object(Object* target, |
207 WriteBarrierMode write_barrier_mode, | 208 WriteBarrierMode write_barrier_mode, |
208 ICacheFlushMode icache_flush_mode) { | 209 ICacheFlushMode icache_flush_mode) { |
209 DCHECK(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT); | 210 DCHECK(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT); |
210 Assembler::set_target_address_at(pc_, host_, | 211 Assembler::set_target_address_at(isolate_, pc_, host_, |
211 reinterpret_cast<Address>(target), | 212 reinterpret_cast<Address>(target), |
212 icache_flush_mode); | 213 icache_flush_mode); |
213 if (write_barrier_mode == UPDATE_WRITE_BARRIER && | 214 if (write_barrier_mode == UPDATE_WRITE_BARRIER && |
214 host() != NULL && | 215 host() != NULL && |
215 target->IsHeapObject()) { | 216 target->IsHeapObject()) { |
216 host()->GetHeap()->incremental_marking()->RecordWrite( | 217 host()->GetHeap()->incremental_marking()->RecordWrite( |
217 host(), &Memory::Object_at(pc_), HeapObject::cast(target)); | 218 host(), &Memory::Object_at(pc_), HeapObject::cast(target)); |
218 } | 219 } |
219 } | 220 } |
220 | 221 |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
303 Code* RelocInfo::code_age_stub() { | 304 Code* RelocInfo::code_age_stub() { |
304 DCHECK(rmode_ == RelocInfo::CODE_AGE_SEQUENCE); | 305 DCHECK(rmode_ == RelocInfo::CODE_AGE_SEQUENCE); |
305 return Code::GetCodeFromTargetAddress( | 306 return Code::GetCodeFromTargetAddress( |
306 Assembler::target_address_at(pc_ + Assembler::kInstrSize, host_)); | 307 Assembler::target_address_at(pc_ + Assembler::kInstrSize, host_)); |
307 } | 308 } |
308 | 309 |
309 | 310 |
310 void RelocInfo::set_code_age_stub(Code* stub, | 311 void RelocInfo::set_code_age_stub(Code* stub, |
311 ICacheFlushMode icache_flush_mode) { | 312 ICacheFlushMode icache_flush_mode) { |
312 DCHECK(rmode_ == RelocInfo::CODE_AGE_SEQUENCE); | 313 DCHECK(rmode_ == RelocInfo::CODE_AGE_SEQUENCE); |
313 Assembler::set_target_address_at(pc_ + Assembler::kInstrSize, | 314 Assembler::set_target_address_at(isolate_, pc_ + Assembler::kInstrSize, host_, |
314 host_, | |
315 stub->instruction_start()); | 315 stub->instruction_start()); |
316 } | 316 } |
317 | 317 |
318 | 318 |
319 Address RelocInfo::debug_call_address() { | 319 Address RelocInfo::debug_call_address() { |
320 // The pc_ offset of 0 assumes patched debug break slot or return | 320 // The pc_ offset of 0 assumes patched debug break slot or return |
321 // sequence. | 321 // sequence. |
322 DCHECK(IsDebugBreakSlot(rmode()) && IsPatchedDebugBreakSlotSequence()); | 322 DCHECK(IsDebugBreakSlot(rmode()) && IsPatchedDebugBreakSlotSequence()); |
323 return Assembler::target_address_at(pc_, host_); | 323 return Assembler::target_address_at(pc_, host_); |
324 } | 324 } |
325 | 325 |
326 | 326 |
327 void RelocInfo::set_debug_call_address(Address target) { | 327 void RelocInfo::set_debug_call_address(Address target) { |
328 DCHECK(IsDebugBreakSlot(rmode()) && IsPatchedDebugBreakSlotSequence()); | 328 DCHECK(IsDebugBreakSlot(rmode()) && IsPatchedDebugBreakSlotSequence()); |
329 // The pc_ offset of 0 assumes patched debug break slot or return | 329 // The pc_ offset of 0 assumes patched debug break slot or return |
330 // sequence. | 330 // sequence. |
331 Assembler::set_target_address_at(pc_, host_, target); | 331 Assembler::set_target_address_at(isolate_, pc_, host_, target); |
332 if (host() != NULL) { | 332 if (host() != NULL) { |
333 Object* target_code = Code::GetCodeFromTargetAddress(target); | 333 Object* target_code = Code::GetCodeFromTargetAddress(target); |
334 host()->GetHeap()->incremental_marking()->RecordWriteIntoCode( | 334 host()->GetHeap()->incremental_marking()->RecordWriteIntoCode( |
335 host(), this, HeapObject::cast(target_code)); | 335 host(), this, HeapObject::cast(target_code)); |
336 } | 336 } |
337 } | 337 } |
338 | 338 |
339 | 339 |
340 void RelocInfo::WipeOut() { | 340 void RelocInfo::WipeOut() { |
341 DCHECK(IsEmbeddedObject(rmode_) || IsCodeTarget(rmode_) || | 341 DCHECK(IsEmbeddedObject(rmode_) || IsCodeTarget(rmode_) || |
342 IsRuntimeEntry(rmode_) || IsExternalReference(rmode_) || | 342 IsRuntimeEntry(rmode_) || IsExternalReference(rmode_) || |
343 IsInternalReference(rmode_) || IsInternalReferenceEncoded(rmode_)); | 343 IsInternalReference(rmode_) || IsInternalReferenceEncoded(rmode_)); |
344 if (IsInternalReference(rmode_)) { | 344 if (IsInternalReference(rmode_)) { |
345 Memory::Address_at(pc_) = NULL; | 345 Memory::Address_at(pc_) = NULL; |
346 } else if (IsInternalReferenceEncoded(rmode_)) { | 346 } else if (IsInternalReferenceEncoded(rmode_)) { |
347 Assembler::set_target_internal_reference_encoded_at(pc_, nullptr); | 347 Assembler::set_target_internal_reference_encoded_at(pc_, nullptr); |
348 } else { | 348 } else { |
349 Assembler::set_target_address_at(pc_, host_, NULL); | 349 Assembler::set_target_address_at(isolate_, pc_, host_, NULL); |
350 } | 350 } |
351 } | 351 } |
352 | 352 |
353 | 353 |
354 bool RelocInfo::IsPatchedReturnSequence() { | 354 bool RelocInfo::IsPatchedReturnSequence() { |
355 Instr instr0 = Assembler::instr_at(pc_); | 355 Instr instr0 = Assembler::instr_at(pc_); |
356 Instr instr1 = Assembler::instr_at(pc_ + 1 * Assembler::kInstrSize); | 356 Instr instr1 = Assembler::instr_at(pc_ + 1 * Assembler::kInstrSize); |
357 Instr instr2 = Assembler::instr_at(pc_ + 2 * Assembler::kInstrSize); | 357 Instr instr2 = Assembler::instr_at(pc_ + 2 * Assembler::kInstrSize); |
358 bool patched_return = ((instr0 & kOpcodeMask) == LUI && | 358 bool patched_return = ((instr0 & kOpcodeMask) == LUI && |
359 (instr1 & kOpcodeMask) == ORI && | 359 (instr1 & kOpcodeMask) == ORI && |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
456 EmittedCompactBranchInstruction(); | 456 EmittedCompactBranchInstruction(); |
457 } | 457 } |
458 CheckTrampolinePoolQuick(); | 458 CheckTrampolinePoolQuick(); |
459 } | 459 } |
460 | 460 |
461 | 461 |
462 } // namespace internal | 462 } // namespace internal |
463 } // namespace v8 | 463 } // namespace v8 |
464 | 464 |
465 #endif // V8_MIPS_ASSEMBLER_MIPS_INL_H_ | 465 #endif // V8_MIPS_ASSEMBLER_MIPS_INL_H_ |
OLD | NEW |