| 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 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 return Memory::Object_at(pc_); | 118 return Memory::Object_at(pc_); |
| 119 } | 119 } |
| 120 | 120 |
| 121 | 121 |
| 122 Handle<Object> RelocInfo::target_object_handle(Assembler* origin) { | 122 Handle<Object> RelocInfo::target_object_handle(Assembler* origin) { |
| 123 ASSERT(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT); | 123 ASSERT(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT); |
| 124 return Memory::Object_Handle_at(pc_); | 124 return Memory::Object_Handle_at(pc_); |
| 125 } | 125 } |
| 126 | 126 |
| 127 | 127 |
| 128 Object** RelocInfo::target_object_address() { | |
| 129 ASSERT(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT); | |
| 130 return &Memory::Object_at(pc_); | |
| 131 } | |
| 132 | |
| 133 | |
| 134 void RelocInfo::set_target_object(Object* target, WriteBarrierMode mode) { | 128 void RelocInfo::set_target_object(Object* target, WriteBarrierMode mode) { |
| 135 ASSERT(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT); | 129 ASSERT(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT); |
| 136 ASSERT(!target->IsConsString()); | 130 ASSERT(!target->IsConsString()); |
| 137 Memory::Object_at(pc_) = target; | 131 Memory::Object_at(pc_) = target; |
| 138 CPU::FlushICache(pc_, sizeof(Address)); | 132 CPU::FlushICache(pc_, sizeof(Address)); |
| 139 if (mode == UPDATE_WRITE_BARRIER && | 133 if (mode == UPDATE_WRITE_BARRIER && |
| 140 host() != NULL && | 134 host() != NULL && |
| 141 target->IsHeapObject()) { | 135 target->IsHeapObject()) { |
| 142 host()->GetHeap()->incremental_marking()->RecordWrite( | 136 host()->GetHeap()->incremental_marking()->RecordWrite( |
| 143 host(), &Memory::Object_at(pc_), HeapObject::cast(target)); | 137 host(), &Memory::Object_at(pc_), HeapObject::cast(target)); |
| 144 } | 138 } |
| 145 } | 139 } |
| 146 | 140 |
| 147 | 141 |
| 148 Address* RelocInfo::target_reference_address() { | 142 Address RelocInfo::target_reference() { |
| 149 ASSERT(rmode_ == RelocInfo::EXTERNAL_REFERENCE); | 143 ASSERT(rmode_ == RelocInfo::EXTERNAL_REFERENCE); |
| 150 return reinterpret_cast<Address*>(pc_); | 144 return Memory::Address_at(pc_); |
| 151 } | 145 } |
| 152 | 146 |
| 153 | 147 |
| 154 Address RelocInfo::target_runtime_entry(Assembler* origin) { | 148 Address RelocInfo::target_runtime_entry(Assembler* origin) { |
| 155 ASSERT(IsRuntimeEntry(rmode_)); | 149 ASSERT(IsRuntimeEntry(rmode_)); |
| 156 return reinterpret_cast<Address>(*reinterpret_cast<int32_t*>(pc_)); | 150 return reinterpret_cast<Address>(*reinterpret_cast<int32_t*>(pc_)); |
| 157 } | 151 } |
| 158 | 152 |
| 159 | 153 |
| 160 void RelocInfo::set_target_runtime_entry(Address target, | 154 void RelocInfo::set_target_runtime_entry(Address target, |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 242 } | 236 } |
| 243 | 237 |
| 244 | 238 |
| 245 Object** RelocInfo::call_object_address() { | 239 Object** RelocInfo::call_object_address() { |
| 246 ASSERT((IsJSReturn(rmode()) && IsPatchedReturnSequence()) || | 240 ASSERT((IsJSReturn(rmode()) && IsPatchedReturnSequence()) || |
| 247 (IsDebugBreakSlot(rmode()) && IsPatchedDebugBreakSlotSequence())); | 241 (IsDebugBreakSlot(rmode()) && IsPatchedDebugBreakSlotSequence())); |
| 248 return reinterpret_cast<Object**>(pc_ + 1); | 242 return reinterpret_cast<Object**>(pc_ + 1); |
| 249 } | 243 } |
| 250 | 244 |
| 251 | 245 |
| 246 void RelocInfo::WipeOut() { |
| 247 if (IsEmbeddedObject(rmode_) || IsExternalReference(rmode_)) { |
| 248 Memory::Address_at(pc_) = NULL; |
| 249 } else if (IsCodeTarget(rmode_) || IsRuntimeEntry(rmode_)) { |
| 250 // Effectively write zero into the relocation. |
| 251 Assembler::set_target_address_at(pc_, pc_ + sizeof(int32_t)); |
| 252 } else { |
| 253 UNREACHABLE(); |
| 254 } |
| 255 } |
| 256 |
| 257 |
| 252 bool RelocInfo::IsPatchedReturnSequence() { | 258 bool RelocInfo::IsPatchedReturnSequence() { |
| 253 return *pc_ == kCallOpcode; | 259 return *pc_ == kCallOpcode; |
| 254 } | 260 } |
| 255 | 261 |
| 256 | 262 |
| 257 bool RelocInfo::IsPatchedDebugBreakSlotSequence() { | 263 bool RelocInfo::IsPatchedDebugBreakSlotSequence() { |
| 258 return !Assembler::IsNop(pc()); | 264 return !Assembler::IsNop(pc()); |
| 259 } | 265 } |
| 260 | 266 |
| 261 | 267 |
| (...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 524 | 530 |
| 525 Operand::Operand(int32_t disp, RelocInfo::Mode rmode) { | 531 Operand::Operand(int32_t disp, RelocInfo::Mode rmode) { |
| 526 // [disp/r] | 532 // [disp/r] |
| 527 set_modrm(0, ebp); | 533 set_modrm(0, ebp); |
| 528 set_dispr(disp, rmode); | 534 set_dispr(disp, rmode); |
| 529 } | 535 } |
| 530 | 536 |
| 531 } } // namespace v8::internal | 537 } } // namespace v8::internal |
| 532 | 538 |
| 533 #endif // V8_IA32_ASSEMBLER_IA32_INL_H_ | 539 #endif // V8_IA32_ASSEMBLER_IA32_INL_H_ |
| OLD | NEW |