| 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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 ASSERT(reg.is_valid()); | 105 ASSERT(reg.is_valid()); |
| 106 ASSERT(!reg.is(kDoubleRegZero)); | 106 ASSERT(!reg.is(kDoubleRegZero)); |
| 107 ASSERT(!reg.is(kLithiumScratchDouble)); | 107 ASSERT(!reg.is(kLithiumScratchDouble)); |
| 108 return (reg.code() / 2); | 108 return (reg.code() / 2); |
| 109 } | 109 } |
| 110 | 110 |
| 111 | 111 |
| 112 // ----------------------------------------------------------------------------- | 112 // ----------------------------------------------------------------------------- |
| 113 // RelocInfo. | 113 // RelocInfo. |
| 114 | 114 |
| 115 void RelocInfo::apply(intptr_t delta) { | 115 void RelocInfo::apply(intptr_t delta, ICacheFlushMode icache_flush_mode) { |
| 116 if (IsCodeTarget(rmode_)) { | 116 if (IsCodeTarget(rmode_)) { |
| 117 uint32_t scope1 = (uint32_t) target_address() & ~kImm28Mask; | 117 uint32_t scope1 = (uint32_t) target_address() & ~kImm28Mask; |
| 118 uint32_t scope2 = reinterpret_cast<uint32_t>(pc_) & ~kImm28Mask; | 118 uint32_t scope2 = reinterpret_cast<uint32_t>(pc_) & ~kImm28Mask; |
| 119 | 119 |
| 120 if (scope1 != scope2) { | 120 if (scope1 != scope2) { |
| 121 Assembler::JumpLabelToJumpRegister(pc_); | 121 Assembler::JumpLabelToJumpRegister(pc_); |
| 122 } | 122 } |
| 123 } | 123 } |
| 124 if (IsInternalReference(rmode_)) { | 124 if (IsInternalReference(rmode_)) { |
| 125 // Absolute code pointer inside code object moves with the code object. | 125 // Absolute code pointer inside code object moves with the code object. |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 UNREACHABLE(); | 164 UNREACHABLE(); |
| 165 return NULL; | 165 return NULL; |
| 166 } | 166 } |
| 167 | 167 |
| 168 | 168 |
| 169 int RelocInfo::target_address_size() { | 169 int RelocInfo::target_address_size() { |
| 170 return Assembler::kSpecialTargetSize; | 170 return Assembler::kSpecialTargetSize; |
| 171 } | 171 } |
| 172 | 172 |
| 173 | 173 |
| 174 void RelocInfo::set_target_address(Address target, WriteBarrierMode mode) { | 174 void RelocInfo::set_target_address(Address target, |
| 175 WriteBarrierMode write_barrier_mode, |
| 176 ICacheFlushMode icache_flush_mode) { |
| 175 ASSERT(IsCodeTarget(rmode_) || IsRuntimeEntry(rmode_)); | 177 ASSERT(IsCodeTarget(rmode_) || IsRuntimeEntry(rmode_)); |
| 176 Assembler::set_target_address_at(pc_, host_, target); | 178 Assembler::set_target_address_at(pc_, host_, target, icache_flush_mode); |
| 177 if (mode == UPDATE_WRITE_BARRIER && host() != NULL && IsCodeTarget(rmode_)) { | 179 if (write_barrier_mode == UPDATE_WRITE_BARRIER && |
| 180 host() != NULL && IsCodeTarget(rmode_)) { |
| 178 Object* target_code = Code::GetCodeFromTargetAddress(target); | 181 Object* target_code = Code::GetCodeFromTargetAddress(target); |
| 179 host()->GetHeap()->incremental_marking()->RecordWriteIntoCode( | 182 host()->GetHeap()->incremental_marking()->RecordWriteIntoCode( |
| 180 host(), this, HeapObject::cast(target_code)); | 183 host(), this, HeapObject::cast(target_code)); |
| 181 } | 184 } |
| 182 } | 185 } |
| 183 | 186 |
| 184 | 187 |
| 185 Address Assembler::target_address_from_return_address(Address pc) { | 188 Address Assembler::target_address_from_return_address(Address pc) { |
| 186 return pc - kCallTargetAddressOffset; | 189 return pc - kCallTargetAddressOffset; |
| 187 } | 190 } |
| 188 | 191 |
| 189 | 192 |
| 190 Object* RelocInfo::target_object() { | 193 Object* RelocInfo::target_object() { |
| 191 ASSERT(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT); | 194 ASSERT(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT); |
| 192 return reinterpret_cast<Object*>(Assembler::target_address_at(pc_, host_)); | 195 return reinterpret_cast<Object*>(Assembler::target_address_at(pc_, host_)); |
| 193 } | 196 } |
| 194 | 197 |
| 195 | 198 |
| 196 Handle<Object> RelocInfo::target_object_handle(Assembler* origin) { | 199 Handle<Object> RelocInfo::target_object_handle(Assembler* origin) { |
| 197 ASSERT(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT); | 200 ASSERT(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT); |
| 198 return Handle<Object>(reinterpret_cast<Object**>( | 201 return Handle<Object>(reinterpret_cast<Object**>( |
| 199 Assembler::target_address_at(pc_, host_))); | 202 Assembler::target_address_at(pc_, host_))); |
| 200 } | 203 } |
| 201 | 204 |
| 202 | 205 |
| 203 void RelocInfo::set_target_object(Object* target, WriteBarrierMode mode) { | 206 void RelocInfo::set_target_object(Object* target, |
| 207 WriteBarrierMode write_barrier_mode, |
| 208 ICacheFlushMode icache_flush_mode) { |
| 204 ASSERT(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT); | 209 ASSERT(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT); |
| 205 ASSERT(!target->IsConsString()); | 210 ASSERT(!target->IsConsString()); |
| 206 Assembler::set_target_address_at(pc_, host_, | 211 Assembler::set_target_address_at(pc_, host_, |
| 207 reinterpret_cast<Address>(target)); | 212 reinterpret_cast<Address>(target), |
| 208 if (mode == UPDATE_WRITE_BARRIER && | 213 icache_flush_mode); |
| 214 if (write_barrier_mode == UPDATE_WRITE_BARRIER && |
| 209 host() != NULL && | 215 host() != NULL && |
| 210 target->IsHeapObject()) { | 216 target->IsHeapObject()) { |
| 211 host()->GetHeap()->incremental_marking()->RecordWrite( | 217 host()->GetHeap()->incremental_marking()->RecordWrite( |
| 212 host(), &Memory::Object_at(pc_), HeapObject::cast(target)); | 218 host(), &Memory::Object_at(pc_), HeapObject::cast(target)); |
| 213 } | 219 } |
| 214 } | 220 } |
| 215 | 221 |
| 216 | 222 |
| 217 Address RelocInfo::target_reference() { | 223 Address RelocInfo::target_reference() { |
| 218 ASSERT(rmode_ == EXTERNAL_REFERENCE); | 224 ASSERT(rmode_ == EXTERNAL_REFERENCE); |
| 219 return Assembler::target_address_at(pc_, host_); | 225 return Assembler::target_address_at(pc_, host_); |
| 220 } | 226 } |
| 221 | 227 |
| 222 | 228 |
| 223 Address RelocInfo::target_runtime_entry(Assembler* origin) { | 229 Address RelocInfo::target_runtime_entry(Assembler* origin) { |
| 224 ASSERT(IsRuntimeEntry(rmode_)); | 230 ASSERT(IsRuntimeEntry(rmode_)); |
| 225 return target_address(); | 231 return target_address(); |
| 226 } | 232 } |
| 227 | 233 |
| 228 | 234 |
| 229 void RelocInfo::set_target_runtime_entry(Address target, | 235 void RelocInfo::set_target_runtime_entry(Address target, |
| 230 WriteBarrierMode mode) { | 236 WriteBarrierMode write_barrier_mode, |
| 237 ICacheFlushMode icache_flush_mode) { |
| 231 ASSERT(IsRuntimeEntry(rmode_)); | 238 ASSERT(IsRuntimeEntry(rmode_)); |
| 232 if (target_address() != target) set_target_address(target, mode); | 239 if (target_address() != target) |
| 240 set_target_address(target, write_barrier_mode, icache_flush_mode); |
| 233 } | 241 } |
| 234 | 242 |
| 235 | 243 |
| 236 Handle<Cell> RelocInfo::target_cell_handle() { | 244 Handle<Cell> RelocInfo::target_cell_handle() { |
| 237 ASSERT(rmode_ == RelocInfo::CELL); | 245 ASSERT(rmode_ == RelocInfo::CELL); |
| 238 Address address = Memory::Address_at(pc_); | 246 Address address = Memory::Address_at(pc_); |
| 239 return Handle<Cell>(reinterpret_cast<Cell**>(address)); | 247 return Handle<Cell>(reinterpret_cast<Cell**>(address)); |
| 240 } | 248 } |
| 241 | 249 |
| 242 | 250 |
| 243 Cell* RelocInfo::target_cell() { | 251 Cell* RelocInfo::target_cell() { |
| 244 ASSERT(rmode_ == RelocInfo::CELL); | 252 ASSERT(rmode_ == RelocInfo::CELL); |
| 245 return Cell::FromValueAddress(Memory::Address_at(pc_)); | 253 return Cell::FromValueAddress(Memory::Address_at(pc_)); |
| 246 } | 254 } |
| 247 | 255 |
| 248 | 256 |
| 249 void RelocInfo::set_target_cell(Cell* cell, WriteBarrierMode mode) { | 257 void RelocInfo::set_target_cell(Cell* cell, |
| 258 WriteBarrierMode write_barrier_mode, |
| 259 ICacheFlushMode icache_flush_mode) { |
| 250 ASSERT(rmode_ == RelocInfo::CELL); | 260 ASSERT(rmode_ == RelocInfo::CELL); |
| 251 Address address = cell->address() + Cell::kValueOffset; | 261 Address address = cell->address() + Cell::kValueOffset; |
| 252 Memory::Address_at(pc_) = address; | 262 Memory::Address_at(pc_) = address; |
| 253 if (mode == UPDATE_WRITE_BARRIER && host() != NULL) { | 263 if (write_barrier_mode == UPDATE_WRITE_BARRIER && host() != NULL) { |
| 254 // TODO(1550) We are passing NULL as a slot because cell can never be on | 264 // TODO(1550) We are passing NULL as a slot because cell can never be on |
| 255 // evacuation candidate. | 265 // evacuation candidate. |
| 256 host()->GetHeap()->incremental_marking()->RecordWrite( | 266 host()->GetHeap()->incremental_marking()->RecordWrite( |
| 257 host(), NULL, cell); | 267 host(), NULL, cell); |
| 258 } | 268 } |
| 259 } | 269 } |
| 260 | 270 |
| 261 | 271 |
| 262 static const int kNoCodeAgeSequenceLength = 7 * Assembler::kInstrSize; | 272 static const int kNoCodeAgeSequenceLength = 7 * Assembler::kInstrSize; |
| 263 | 273 |
| 264 | 274 |
| 265 Handle<Object> RelocInfo::code_age_stub_handle(Assembler* origin) { | 275 Handle<Object> RelocInfo::code_age_stub_handle(Assembler* origin) { |
| 266 UNREACHABLE(); // This should never be reached on Arm. | 276 UNREACHABLE(); // This should never be reached on Arm. |
| 267 return Handle<Object>(); | 277 return Handle<Object>(); |
| 268 } | 278 } |
| 269 | 279 |
| 270 | 280 |
| 271 Code* RelocInfo::code_age_stub() { | 281 Code* RelocInfo::code_age_stub() { |
| 272 ASSERT(rmode_ == RelocInfo::CODE_AGE_SEQUENCE); | 282 ASSERT(rmode_ == RelocInfo::CODE_AGE_SEQUENCE); |
| 273 return Code::GetCodeFromTargetAddress( | 283 return Code::GetCodeFromTargetAddress( |
| 274 Assembler::target_address_at(pc_ + Assembler::kInstrSize, host_)); | 284 Assembler::target_address_at(pc_ + Assembler::kInstrSize, host_)); |
| 275 } | 285 } |
| 276 | 286 |
| 277 | 287 |
| 278 void RelocInfo::set_code_age_stub(Code* stub) { | 288 void RelocInfo::set_code_age_stub(Code* stub, |
| 289 ICacheFlushMode icache_flush_mode) { |
| 279 ASSERT(rmode_ == RelocInfo::CODE_AGE_SEQUENCE); | 290 ASSERT(rmode_ == RelocInfo::CODE_AGE_SEQUENCE); |
| 280 Assembler::set_target_address_at(pc_ + Assembler::kInstrSize, | 291 Assembler::set_target_address_at(pc_ + Assembler::kInstrSize, |
| 281 host_, | 292 host_, |
| 282 stub->instruction_start()); | 293 stub->instruction_start()); |
| 283 } | 294 } |
| 284 | 295 |
| 285 | 296 |
| 286 Address RelocInfo::call_address() { | 297 Address RelocInfo::call_address() { |
| 287 ASSERT((IsJSReturn(rmode()) && IsPatchedReturnSequence()) || | 298 ASSERT((IsJSReturn(rmode()) && IsPatchedReturnSequence()) || |
| 288 (IsDebugBreakSlot(rmode()) && IsPatchedDebugBreakSlotSequence())); | 299 (IsDebugBreakSlot(rmode()) && IsPatchedDebugBreakSlotSequence())); |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 426 } | 437 } |
| 427 *reinterpret_cast<Instr*>(pc_) = x; | 438 *reinterpret_cast<Instr*>(pc_) = x; |
| 428 pc_ += kInstrSize; | 439 pc_ += kInstrSize; |
| 429 CheckTrampolinePoolQuick(); | 440 CheckTrampolinePoolQuick(); |
| 430 } | 441 } |
| 431 | 442 |
| 432 | 443 |
| 433 } } // namespace v8::internal | 444 } } // namespace v8::internal |
| 434 | 445 |
| 435 #endif // V8_MIPS_ASSEMBLER_MIPS_INL_H_ | 446 #endif // V8_MIPS_ASSEMBLER_MIPS_INL_H_ |
| OLD | NEW |