OLD | NEW |
1 // Copyright (c) 1994-2006 Sun Microsystems Inc. | 1 // Copyright (c) 1994-2006 Sun Microsystems Inc. |
2 // All Rights Reserved. | 2 // All Rights Reserved. |
3 // | 3 // |
4 // Redistribution and use in source and binary forms, with or without | 4 // Redistribution and use in source and binary forms, with or without |
5 // modification, are permitted provided that the following conditions are | 5 // modification, are permitted provided that the following conditions are |
6 // met: | 6 // met: |
7 // | 7 // |
8 // - Redistributions of source code must retain the above copyright notice, | 8 // - Redistributions of source code must retain the above copyright notice, |
9 // this list of conditions and the following disclaimer. | 9 // this list of conditions and the following disclaimer. |
10 // | 10 // |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 } | 86 } |
87 | 87 |
88 | 88 |
89 Address RelocInfo::target_address() { | 89 Address RelocInfo::target_address() { |
90 DCHECK(IsCodeTarget(rmode_) || IsRuntimeEntry(rmode_)); | 90 DCHECK(IsCodeTarget(rmode_) || IsRuntimeEntry(rmode_)); |
91 return Assembler::target_address_at(pc_, host_); | 91 return Assembler::target_address_at(pc_, host_); |
92 } | 92 } |
93 | 93 |
94 | 94 |
95 Address RelocInfo::target_address_address() { | 95 Address RelocInfo::target_address_address() { |
96 DCHECK(IsCodeTarget(rmode_) || IsRuntimeEntry(rmode_) | 96 DCHECK(IsCodeTarget(rmode_) || IsRuntimeEntry(rmode_) || |
97 || rmode_ == EMBEDDED_OBJECT | 97 rmode_ == EMBEDDED_OBJECT || rmode_ == EXTERNAL_REFERENCE || |
98 || rmode_ == EXTERNAL_REFERENCE); | 98 rmode_ == INTERNAL_REFERENCE); |
99 return reinterpret_cast<Address>(pc_); | 99 return reinterpret_cast<Address>(pc_); |
100 } | 100 } |
101 | 101 |
102 | 102 |
103 Address RelocInfo::constant_pool_entry_address() { | 103 Address RelocInfo::constant_pool_entry_address() { |
104 UNREACHABLE(); | 104 UNREACHABLE(); |
105 return NULL; | 105 return NULL; |
106 } | 106 } |
107 | 107 |
108 | 108 |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 return Memory::Address_at(pc_); | 159 return Memory::Address_at(pc_); |
160 } | 160 } |
161 | 161 |
162 | 162 |
163 Address RelocInfo::target_internal_reference() { | 163 Address RelocInfo::target_internal_reference() { |
164 DCHECK(rmode_ == INTERNAL_REFERENCE); | 164 DCHECK(rmode_ == INTERNAL_REFERENCE); |
165 return Memory::Address_at(pc_); | 165 return Memory::Address_at(pc_); |
166 } | 166 } |
167 | 167 |
168 | 168 |
169 void RelocInfo::set_target_internal_reference(Address target) { | 169 void Assembler::deserialization_set_target_internal_reference_at( |
170 DCHECK(rmode_ == INTERNAL_REFERENCE); | 170 Address instruction, Address target) { |
171 Memory::Address_at(pc_) = target; | 171 Memory::Address_at(instruction) = target; |
172 } | 172 } |
173 | 173 |
174 | 174 |
175 Address RelocInfo::target_runtime_entry(Assembler* origin) { | 175 Address RelocInfo::target_runtime_entry(Assembler* origin) { |
176 DCHECK(IsRuntimeEntry(rmode_)); | 176 DCHECK(IsRuntimeEntry(rmode_)); |
177 return reinterpret_cast<Address>(*reinterpret_cast<int32_t*>(pc_)); | 177 return reinterpret_cast<Address>(*reinterpret_cast<int32_t*>(pc_)); |
178 } | 178 } |
179 | 179 |
180 | 180 |
181 void RelocInfo::set_target_runtime_entry(Address target, | 181 void RelocInfo::set_target_runtime_entry(Address target, |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
273 | 273 |
274 | 274 |
275 Object** RelocInfo::call_object_address() { | 275 Object** RelocInfo::call_object_address() { |
276 DCHECK((IsJSReturn(rmode()) && IsPatchedReturnSequence()) || | 276 DCHECK((IsJSReturn(rmode()) && IsPatchedReturnSequence()) || |
277 (IsDebugBreakSlot(rmode()) && IsPatchedDebugBreakSlotSequence())); | 277 (IsDebugBreakSlot(rmode()) && IsPatchedDebugBreakSlotSequence())); |
278 return reinterpret_cast<Object**>(pc_ + 1); | 278 return reinterpret_cast<Object**>(pc_ + 1); |
279 } | 279 } |
280 | 280 |
281 | 281 |
282 void RelocInfo::WipeOut() { | 282 void RelocInfo::WipeOut() { |
283 if (IsEmbeddedObject(rmode_) || IsExternalReference(rmode_)) { | 283 if (IsEmbeddedObject(rmode_) || IsExternalReference(rmode_) || |
| 284 IsInternalReference(rmode_)) { |
284 Memory::Address_at(pc_) = NULL; | 285 Memory::Address_at(pc_) = NULL; |
285 } else if (IsCodeTarget(rmode_) || IsRuntimeEntry(rmode_)) { | 286 } else if (IsCodeTarget(rmode_) || IsRuntimeEntry(rmode_)) { |
286 // Effectively write zero into the relocation. | 287 // Effectively write zero into the relocation. |
287 Assembler::set_target_address_at(pc_, host_, pc_ + sizeof(int32_t)); | 288 Assembler::set_target_address_at(pc_, host_, pc_ + sizeof(int32_t)); |
288 } else { | 289 } else { |
289 UNREACHABLE(); | 290 UNREACHABLE(); |
290 } | 291 } |
291 } | 292 } |
292 | 293 |
293 | 294 |
(...skipping 11 matching lines...) Expand all Loading... |
305 RelocInfo::Mode mode = rmode(); | 306 RelocInfo::Mode mode = rmode(); |
306 if (mode == RelocInfo::EMBEDDED_OBJECT) { | 307 if (mode == RelocInfo::EMBEDDED_OBJECT) { |
307 visitor->VisitEmbeddedPointer(this); | 308 visitor->VisitEmbeddedPointer(this); |
308 CpuFeatures::FlushICache(pc_, sizeof(Address)); | 309 CpuFeatures::FlushICache(pc_, sizeof(Address)); |
309 } else if (RelocInfo::IsCodeTarget(mode)) { | 310 } else if (RelocInfo::IsCodeTarget(mode)) { |
310 visitor->VisitCodeTarget(this); | 311 visitor->VisitCodeTarget(this); |
311 } else if (mode == RelocInfo::CELL) { | 312 } else if (mode == RelocInfo::CELL) { |
312 visitor->VisitCell(this); | 313 visitor->VisitCell(this); |
313 } else if (mode == RelocInfo::EXTERNAL_REFERENCE) { | 314 } else if (mode == RelocInfo::EXTERNAL_REFERENCE) { |
314 visitor->VisitExternalReference(this); | 315 visitor->VisitExternalReference(this); |
315 CpuFeatures::FlushICache(pc_, sizeof(Address)); | 316 } else if (mode == RelocInfo::INTERNAL_REFERENCE) { |
| 317 visitor->VisitInternalReference(this); |
316 } else if (RelocInfo::IsCodeAgeSequence(mode)) { | 318 } else if (RelocInfo::IsCodeAgeSequence(mode)) { |
317 visitor->VisitCodeAgeSequence(this); | 319 visitor->VisitCodeAgeSequence(this); |
318 } else if (((RelocInfo::IsJSReturn(mode) && | 320 } else if (((RelocInfo::IsJSReturn(mode) && |
319 IsPatchedReturnSequence()) || | 321 IsPatchedReturnSequence()) || |
320 (RelocInfo::IsDebugBreakSlot(mode) && | 322 (RelocInfo::IsDebugBreakSlot(mode) && |
321 IsPatchedDebugBreakSlotSequence())) && | 323 IsPatchedDebugBreakSlotSequence())) && |
322 isolate->debug()->has_break_points()) { | 324 isolate->debug()->has_break_points()) { |
323 visitor->VisitDebugTarget(this); | 325 visitor->VisitDebugTarget(this); |
324 } else if (IsRuntimeEntry(mode)) { | 326 } else if (IsRuntimeEntry(mode)) { |
325 visitor->VisitRuntimeEntry(this); | 327 visitor->VisitRuntimeEntry(this); |
326 } | 328 } |
327 } | 329 } |
328 | 330 |
329 | 331 |
330 template<typename StaticVisitor> | 332 template<typename StaticVisitor> |
331 void RelocInfo::Visit(Heap* heap) { | 333 void RelocInfo::Visit(Heap* heap) { |
332 RelocInfo::Mode mode = rmode(); | 334 RelocInfo::Mode mode = rmode(); |
333 if (mode == RelocInfo::EMBEDDED_OBJECT) { | 335 if (mode == RelocInfo::EMBEDDED_OBJECT) { |
334 StaticVisitor::VisitEmbeddedPointer(heap, this); | 336 StaticVisitor::VisitEmbeddedPointer(heap, this); |
335 CpuFeatures::FlushICache(pc_, sizeof(Address)); | 337 CpuFeatures::FlushICache(pc_, sizeof(Address)); |
336 } else if (RelocInfo::IsCodeTarget(mode)) { | 338 } else if (RelocInfo::IsCodeTarget(mode)) { |
337 StaticVisitor::VisitCodeTarget(heap, this); | 339 StaticVisitor::VisitCodeTarget(heap, this); |
338 } else if (mode == RelocInfo::CELL) { | 340 } else if (mode == RelocInfo::CELL) { |
339 StaticVisitor::VisitCell(heap, this); | 341 StaticVisitor::VisitCell(heap, this); |
340 } else if (mode == RelocInfo::EXTERNAL_REFERENCE) { | 342 } else if (mode == RelocInfo::EXTERNAL_REFERENCE) { |
341 StaticVisitor::VisitExternalReference(this); | 343 StaticVisitor::VisitExternalReference(this); |
342 CpuFeatures::FlushICache(pc_, sizeof(Address)); | 344 } else if (mode == RelocInfo::INTERNAL_REFERENCE) { |
| 345 StaticVisitor::VisitInternalReference(this); |
343 } else if (RelocInfo::IsCodeAgeSequence(mode)) { | 346 } else if (RelocInfo::IsCodeAgeSequence(mode)) { |
344 StaticVisitor::VisitCodeAgeSequence(heap, this); | 347 StaticVisitor::VisitCodeAgeSequence(heap, this); |
345 } else if (heap->isolate()->debug()->has_break_points() && | 348 } else if (heap->isolate()->debug()->has_break_points() && |
346 ((RelocInfo::IsJSReturn(mode) && | 349 ((RelocInfo::IsJSReturn(mode) && |
347 IsPatchedReturnSequence()) || | 350 IsPatchedReturnSequence()) || |
348 (RelocInfo::IsDebugBreakSlot(mode) && | 351 (RelocInfo::IsDebugBreakSlot(mode) && |
349 IsPatchedDebugBreakSlotSequence()))) { | 352 IsPatchedDebugBreakSlotSequence()))) { |
350 StaticVisitor::VisitDebugTarget(heap, this); | 353 StaticVisitor::VisitDebugTarget(heap, this); |
351 } else if (IsRuntimeEntry(mode)) { | 354 } else if (IsRuntimeEntry(mode)) { |
352 StaticVisitor::VisitRuntimeEntry(this); | 355 StaticVisitor::VisitRuntimeEntry(this); |
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
579 | 582 |
580 | 583 |
581 Operand::Operand(Immediate imm) { | 584 Operand::Operand(Immediate imm) { |
582 // [disp/r] | 585 // [disp/r] |
583 set_modrm(0, ebp); | 586 set_modrm(0, ebp); |
584 set_dispr(imm.x_, imm.rmode_); | 587 set_dispr(imm.x_, imm.rmode_); |
585 } | 588 } |
586 } } // namespace v8::internal | 589 } } // namespace v8::internal |
587 | 590 |
588 #endif // V8_IA32_ASSEMBLER_IA32_INL_H_ | 591 #endif // V8_IA32_ASSEMBLER_IA32_INL_H_ |
OLD | NEW |