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