| 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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 return reinterpret_cast<Address>(pc_); | 82 return reinterpret_cast<Address>(pc_); |
| 83 } | 83 } |
| 84 | 84 |
| 85 | 85 |
| 86 int RelocInfo::target_address_size() { | 86 int RelocInfo::target_address_size() { |
| 87 return Assembler::kExternalTargetSize; | 87 return Assembler::kExternalTargetSize; |
| 88 } | 88 } |
| 89 | 89 |
| 90 | 90 |
| 91 void RelocInfo::set_target_address(Address target) { | 91 void RelocInfo::set_target_address(Address target) { |
| 92 Assembler::set_target_address_at(pc_, target); |
| 92 ASSERT(IsCodeTarget(rmode_) || rmode_ == RUNTIME_ENTRY); | 93 ASSERT(IsCodeTarget(rmode_) || rmode_ == RUNTIME_ENTRY); |
| 93 Assembler::set_target_address_at(pc_, target); | 94 if (host() != NULL && IsCodeTarget(rmode_)) { |
| 95 Object* target_code = Code::GetCodeFromTargetAddress(target); |
| 96 host()->GetHeap()->incremental_marking()->RecordWriteIntoCode( |
| 97 host(), this, HeapObject::cast(target_code)); |
| 98 } |
| 94 } | 99 } |
| 95 | 100 |
| 96 | 101 |
| 97 Object* RelocInfo::target_object() { | 102 Object* RelocInfo::target_object() { |
| 98 ASSERT(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT); | 103 ASSERT(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT); |
| 99 return Memory::Object_at(pc_); | 104 return Memory::Object_at(pc_); |
| 100 } | 105 } |
| 101 | 106 |
| 102 | 107 |
| 103 Handle<Object> RelocInfo::target_object_handle(Assembler* origin) { | 108 Handle<Object> RelocInfo::target_object_handle(Assembler* origin) { |
| 104 ASSERT(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT); | 109 ASSERT(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT); |
| 105 return Memory::Object_Handle_at(pc_); | 110 return Memory::Object_Handle_at(pc_); |
| 106 } | 111 } |
| 107 | 112 |
| 108 | 113 |
| 109 Object** RelocInfo::target_object_address() { | 114 Object** RelocInfo::target_object_address() { |
| 110 ASSERT(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT); | 115 ASSERT(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT); |
| 111 return &Memory::Object_at(pc_); | 116 return &Memory::Object_at(pc_); |
| 112 } | 117 } |
| 113 | 118 |
| 114 | 119 |
| 115 void RelocInfo::set_target_object(Object* target) { | 120 void RelocInfo::set_target_object(Object* target) { |
| 116 ASSERT(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT); | 121 ASSERT(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT); |
| 117 Memory::Object_at(pc_) = target; | 122 Memory::Object_at(pc_) = target; |
| 118 CPU::FlushICache(pc_, sizeof(Address)); | 123 CPU::FlushICache(pc_, sizeof(Address)); |
| 124 if (host() != NULL && target->IsHeapObject()) { |
| 125 host()->GetHeap()->incremental_marking()->RecordWrite( |
| 126 host(), &Memory::Object_at(pc_), HeapObject::cast(target)); |
| 127 } |
| 119 } | 128 } |
| 120 | 129 |
| 121 | 130 |
| 122 Address* RelocInfo::target_reference_address() { | 131 Address* RelocInfo::target_reference_address() { |
| 123 ASSERT(rmode_ == RelocInfo::EXTERNAL_REFERENCE); | 132 ASSERT(rmode_ == RelocInfo::EXTERNAL_REFERENCE); |
| 124 return reinterpret_cast<Address*>(pc_); | 133 return reinterpret_cast<Address*>(pc_); |
| 125 } | 134 } |
| 126 | 135 |
| 127 | 136 |
| 128 Handle<JSGlobalPropertyCell> RelocInfo::target_cell_handle() { | 137 Handle<JSGlobalPropertyCell> RelocInfo::target_cell_handle() { |
| (...skipping 11 matching lines...) Expand all Loading... |
| 140 address - JSGlobalPropertyCell::kValueOffset); | 149 address - JSGlobalPropertyCell::kValueOffset); |
| 141 return reinterpret_cast<JSGlobalPropertyCell*>(object); | 150 return reinterpret_cast<JSGlobalPropertyCell*>(object); |
| 142 } | 151 } |
| 143 | 152 |
| 144 | 153 |
| 145 void RelocInfo::set_target_cell(JSGlobalPropertyCell* cell) { | 154 void RelocInfo::set_target_cell(JSGlobalPropertyCell* cell) { |
| 146 ASSERT(rmode_ == RelocInfo::GLOBAL_PROPERTY_CELL); | 155 ASSERT(rmode_ == RelocInfo::GLOBAL_PROPERTY_CELL); |
| 147 Address address = cell->address() + JSGlobalPropertyCell::kValueOffset; | 156 Address address = cell->address() + JSGlobalPropertyCell::kValueOffset; |
| 148 Memory::Address_at(pc_) = address; | 157 Memory::Address_at(pc_) = address; |
| 149 CPU::FlushICache(pc_, sizeof(Address)); | 158 CPU::FlushICache(pc_, sizeof(Address)); |
| 159 if (host() != NULL) { |
| 160 // TODO(1550) We are passing NULL as a slot because cell can never be on |
| 161 // evacuation candidate. |
| 162 host()->GetHeap()->incremental_marking()->RecordWrite( |
| 163 host(), NULL, cell); |
| 164 } |
| 150 } | 165 } |
| 151 | 166 |
| 152 | 167 |
| 153 Address RelocInfo::call_address() { | 168 Address RelocInfo::call_address() { |
| 154 ASSERT((IsJSReturn(rmode()) && IsPatchedReturnSequence()) || | 169 ASSERT((IsJSReturn(rmode()) && IsPatchedReturnSequence()) || |
| 155 (IsDebugBreakSlot(rmode()) && IsPatchedDebugBreakSlotSequence())); | 170 (IsDebugBreakSlot(rmode()) && IsPatchedDebugBreakSlotSequence())); |
| 156 return Assembler::target_address_at(pc_ + 1); | 171 return Assembler::target_address_at(pc_ + 1); |
| 157 } | 172 } |
| 158 | 173 |
| 159 | 174 |
| 160 void RelocInfo::set_call_address(Address target) { | 175 void RelocInfo::set_call_address(Address target) { |
| 161 ASSERT((IsJSReturn(rmode()) && IsPatchedReturnSequence()) || | 176 ASSERT((IsJSReturn(rmode()) && IsPatchedReturnSequence()) || |
| 162 (IsDebugBreakSlot(rmode()) && IsPatchedDebugBreakSlotSequence())); | 177 (IsDebugBreakSlot(rmode()) && IsPatchedDebugBreakSlotSequence())); |
| 163 Assembler::set_target_address_at(pc_ + 1, target); | 178 Assembler::set_target_address_at(pc_ + 1, target); |
| 179 if (host() != NULL) { |
| 180 Object* target_code = Code::GetCodeFromTargetAddress(target); |
| 181 host()->GetHeap()->incremental_marking()->RecordWriteIntoCode( |
| 182 host(), this, HeapObject::cast(target_code)); |
| 183 } |
| 164 } | 184 } |
| 165 | 185 |
| 166 | 186 |
| 167 Object* RelocInfo::call_object() { | 187 Object* RelocInfo::call_object() { |
| 168 return *call_object_address(); | 188 return *call_object_address(); |
| 169 } | 189 } |
| 170 | 190 |
| 171 | 191 |
| 172 void RelocInfo::set_call_object(Object* target) { | 192 void RelocInfo::set_call_object(Object* target) { |
| 173 *call_object_address() = target; | 193 *call_object_address() = target; |
| (...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 437 | 457 |
| 438 Operand::Operand(int32_t disp, RelocInfo::Mode rmode) { | 458 Operand::Operand(int32_t disp, RelocInfo::Mode rmode) { |
| 439 // [disp/r] | 459 // [disp/r] |
| 440 set_modrm(0, ebp); | 460 set_modrm(0, ebp); |
| 441 set_dispr(disp, rmode); | 461 set_dispr(disp, rmode); |
| 442 } | 462 } |
| 443 | 463 |
| 444 } } // namespace v8::internal | 464 } } // namespace v8::internal |
| 445 | 465 |
| 446 #endif // V8_IA32_ASSEMBLER_IA32_INL_H_ | 466 #endif // V8_IA32_ASSEMBLER_IA32_INL_H_ |
| OLD | NEW |