Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(293)

Side by Side Diff: src/s390/assembler-s390-inl.h

Issue 2732273003: Disentangle assembler from isolate. (Closed)
Patch Set: Address feedback. Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/s390/assembler-s390.cc ('k') | src/s390/macro-assembler-s390.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 5 // modification, are permitted provided that the following conditions
6 // are met: 6 // are 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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 - static_cast<int32_t>(delta); 63 - static_cast<int32_t>(delta);
64 instr >>= 32; // Clear the 4-byte displacement field. 64 instr >>= 32; // Clear the 4-byte displacement field.
65 instr <<= 32; 65 instr <<= 32;
66 instr |= static_cast<uint32_t>(dis / 2); 66 instr |= static_cast<uint32_t>(dis / 2);
67 Instruction::SetInstructionBits<SixByteInstr>(reinterpret_cast<byte*>(pc_), 67 Instruction::SetInstructionBits<SixByteInstr>(reinterpret_cast<byte*>(pc_),
68 instr); 68 instr);
69 } else { 69 } else {
70 // mov sequence 70 // mov sequence
71 DCHECK(IsInternalReferenceEncoded(rmode_)); 71 DCHECK(IsInternalReferenceEncoded(rmode_));
72 Address target = Assembler::target_address_at(pc_, host_); 72 Address target = Assembler::target_address_at(pc_, host_);
73 Assembler::set_target_address_at(isolate_, pc_, host_, target + delta, 73 Assembler::set_target_address_at(nullptr, pc_, host_, target + delta,
74 SKIP_ICACHE_FLUSH); 74 SKIP_ICACHE_FLUSH);
75 } 75 }
76 } 76 }
77 77
78 Address RelocInfo::target_internal_reference() { 78 Address RelocInfo::target_internal_reference() {
79 if (IsInternalReference(rmode_)) { 79 if (IsInternalReference(rmode_)) {
80 // Jump table entry 80 // Jump table entry
81 return Memory::Address_at(pc_); 81 return Memory::Address_at(pc_);
82 } else { 82 } else {
83 // mov sequence 83 // mov sequence
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 Assembler::target_address_at(pc_, host_))); 165 Assembler::target_address_at(pc_, host_)));
166 } else { 166 } else {
167 return Handle<HeapObject>::cast(origin->code_target_object_handle_at(pc_)); 167 return Handle<HeapObject>::cast(origin->code_target_object_handle_at(pc_));
168 } 168 }
169 } 169 }
170 170
171 void RelocInfo::set_target_object(HeapObject* target, 171 void RelocInfo::set_target_object(HeapObject* target,
172 WriteBarrierMode write_barrier_mode, 172 WriteBarrierMode write_barrier_mode,
173 ICacheFlushMode icache_flush_mode) { 173 ICacheFlushMode icache_flush_mode) {
174 DCHECK(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT); 174 DCHECK(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT);
175 Assembler::set_target_address_at(isolate_, pc_, host_, 175 Assembler::set_target_address_at(target->GetIsolate(), pc_, host_,
176 reinterpret_cast<Address>(target), 176 reinterpret_cast<Address>(target),
177 icache_flush_mode); 177 icache_flush_mode);
178 if (write_barrier_mode == UPDATE_WRITE_BARRIER && host() != NULL && 178 if (write_barrier_mode == UPDATE_WRITE_BARRIER && host() != NULL) {
179 target->IsHeapObject()) { 179 host()->GetHeap()->incremental_marking()->RecordWriteIntoCode(host(), this,
180 host()->GetHeap()->incremental_marking()->RecordWriteIntoCode( 180 target);
181 host(), this, HeapObject::cast(target));
182 host()->GetHeap()->RecordWriteIntoCode(host(), this, target); 181 host()->GetHeap()->RecordWriteIntoCode(host(), this, target);
183 } 182 }
184 } 183 }
185 184
186 Address RelocInfo::target_external_reference() { 185 Address RelocInfo::target_external_reference() {
187 DCHECK(rmode_ == EXTERNAL_REFERENCE); 186 DCHECK(rmode_ == EXTERNAL_REFERENCE);
188 return Assembler::target_address_at(pc_, host_); 187 return Assembler::target_address_at(pc_, host_);
189 } 188 }
190 189
191 Address RelocInfo::target_runtime_entry(Assembler* origin) { 190 Address RelocInfo::target_runtime_entry(Assembler* origin) {
192 DCHECK(IsRuntimeEntry(rmode_)); 191 DCHECK(IsRuntimeEntry(rmode_));
193 return target_address(); 192 return target_address();
194 } 193 }
195 194
196 void RelocInfo::set_target_runtime_entry(Address target, 195 void RelocInfo::set_target_runtime_entry(Isolate* isolate, Address target,
197 WriteBarrierMode write_barrier_mode, 196 WriteBarrierMode write_barrier_mode,
198 ICacheFlushMode icache_flush_mode) { 197 ICacheFlushMode icache_flush_mode) {
199 DCHECK(IsRuntimeEntry(rmode_)); 198 DCHECK(IsRuntimeEntry(rmode_));
200 if (target_address() != target) 199 if (target_address() != target)
201 set_target_address(target, write_barrier_mode, icache_flush_mode); 200 set_target_address(isolate, target, write_barrier_mode, icache_flush_mode);
202 } 201 }
203 202
204 Handle<Cell> RelocInfo::target_cell_handle() { 203 Handle<Cell> RelocInfo::target_cell_handle() {
205 DCHECK(rmode_ == RelocInfo::CELL); 204 DCHECK(rmode_ == RelocInfo::CELL);
206 Address address = Memory::Address_at(pc_); 205 Address address = Memory::Address_at(pc_);
207 return Handle<Cell>(reinterpret_cast<Cell**>(address)); 206 return Handle<Cell>(reinterpret_cast<Cell**>(address));
208 } 207 }
209 208
210 Cell* RelocInfo::target_cell() { 209 Cell* RelocInfo::target_cell() {
211 DCHECK(rmode_ == RelocInfo::CELL); 210 DCHECK(rmode_ == RelocInfo::CELL);
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 252
254 Code* RelocInfo::code_age_stub() { 253 Code* RelocInfo::code_age_stub() {
255 DCHECK(rmode_ == RelocInfo::CODE_AGE_SEQUENCE); 254 DCHECK(rmode_ == RelocInfo::CODE_AGE_SEQUENCE);
256 return Code::GetCodeFromTargetAddress( 255 return Code::GetCodeFromTargetAddress(
257 Assembler::target_address_at(pc_ + kCodeAgingTargetDelta, host_)); 256 Assembler::target_address_at(pc_ + kCodeAgingTargetDelta, host_));
258 } 257 }
259 258
260 void RelocInfo::set_code_age_stub(Code* stub, 259 void RelocInfo::set_code_age_stub(Code* stub,
261 ICacheFlushMode icache_flush_mode) { 260 ICacheFlushMode icache_flush_mode) {
262 DCHECK(rmode_ == RelocInfo::CODE_AGE_SEQUENCE); 261 DCHECK(rmode_ == RelocInfo::CODE_AGE_SEQUENCE);
263 Assembler::set_target_address_at(isolate_, pc_ + kCodeAgingTargetDelta, host_, 262 Assembler::set_target_address_at(
264 stub->instruction_start(), 263 stub->GetIsolate(), pc_ + kCodeAgingTargetDelta, host_,
265 icache_flush_mode); 264 stub->instruction_start(), icache_flush_mode);
266 } 265 }
267 266
268 Address RelocInfo::debug_call_address() { 267 Address RelocInfo::debug_call_address() {
269 DCHECK(IsDebugBreakSlot(rmode()) && IsPatchedDebugBreakSlotSequence()); 268 DCHECK(IsDebugBreakSlot(rmode()) && IsPatchedDebugBreakSlotSequence());
270 return Assembler::target_address_at(pc_, host_); 269 return Assembler::target_address_at(pc_, host_);
271 } 270 }
272 271
273 void RelocInfo::set_debug_call_address(Address target) { 272 void RelocInfo::set_debug_call_address(Isolate* isolate, Address target) {
274 DCHECK(IsDebugBreakSlot(rmode()) && IsPatchedDebugBreakSlotSequence()); 273 DCHECK(IsDebugBreakSlot(rmode()) && IsPatchedDebugBreakSlotSequence());
275 Assembler::set_target_address_at(isolate_, pc_, host_, target); 274 Assembler::set_target_address_at(isolate, pc_, host_, target);
276 if (host() != NULL) { 275 if (host() != NULL) {
277 Code* target_code = Code::GetCodeFromTargetAddress(target); 276 Code* target_code = Code::GetCodeFromTargetAddress(target);
278 host()->GetHeap()->incremental_marking()->RecordWriteIntoCode(host(), this, 277 host()->GetHeap()->incremental_marking()->RecordWriteIntoCode(host(), this,
279 target_code); 278 target_code);
280 } 279 }
281 } 280 }
282 281
283 void RelocInfo::WipeOut() { 282 void RelocInfo::WipeOut(Isolate* isolate) {
284 DCHECK(IsEmbeddedObject(rmode_) || IsCodeTarget(rmode_) || 283 DCHECK(IsEmbeddedObject(rmode_) || IsCodeTarget(rmode_) ||
285 IsRuntimeEntry(rmode_) || IsExternalReference(rmode_) || 284 IsRuntimeEntry(rmode_) || IsExternalReference(rmode_) ||
286 IsInternalReference(rmode_) || IsInternalReferenceEncoded(rmode_)); 285 IsInternalReference(rmode_) || IsInternalReferenceEncoded(rmode_));
287 if (IsInternalReference(rmode_)) { 286 if (IsInternalReference(rmode_)) {
288 // Jump table entry 287 // Jump table entry
289 Memory::Address_at(pc_) = NULL; 288 Memory::Address_at(pc_) = NULL;
290 } else if (IsInternalReferenceEncoded(rmode_)) { 289 } else if (IsInternalReferenceEncoded(rmode_)) {
291 // mov sequence 290 // mov sequence
292 // Currently used only by deserializer, no need to flush. 291 // Currently used only by deserializer, no need to flush.
293 Assembler::set_target_address_at(isolate_, pc_, host_, NULL, 292 Assembler::set_target_address_at(isolate, pc_, host_, NULL,
294 SKIP_ICACHE_FLUSH); 293 SKIP_ICACHE_FLUSH);
295 } else { 294 } else {
296 Assembler::set_target_address_at(isolate_, pc_, host_, NULL); 295 Assembler::set_target_address_at(isolate, pc_, host_, NULL);
297 } 296 }
298 } 297 }
299 298
300 template <typename ObjectVisitor> 299 template <typename ObjectVisitor>
301 void RelocInfo::Visit(Isolate* isolate, ObjectVisitor* visitor) { 300 void RelocInfo::Visit(Isolate* isolate, ObjectVisitor* visitor) {
302 RelocInfo::Mode mode = rmode(); 301 RelocInfo::Mode mode = rmode();
303 if (mode == RelocInfo::EMBEDDED_OBJECT) { 302 if (mode == RelocInfo::EMBEDDED_OBJECT) {
304 visitor->VisitEmbeddedPointer(this); 303 visitor->VisitEmbeddedPointer(this);
305 } else if (RelocInfo::IsCodeTarget(mode)) { 304 } else if (RelocInfo::IsCodeTarget(mode)) {
306 visitor->VisitCodeTarget(this); 305 visitor->VisitCodeTarget(this);
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
500 set_target_address_at(isolate, pc, code, target, SKIP_ICACHE_FLUSH); 499 set_target_address_at(isolate, pc, code, target, SKIP_ICACHE_FLUSH);
501 } else { 500 } else {
502 Memory::Address_at(pc) = target; 501 Memory::Address_at(pc) = target;
503 } 502 }
504 } 503 }
505 504
506 // This code assumes the FIXED_SEQUENCE of IIHF/IILF 505 // This code assumes the FIXED_SEQUENCE of IIHF/IILF
507 void Assembler::set_target_address_at(Isolate* isolate, Address pc, 506 void Assembler::set_target_address_at(Isolate* isolate, Address pc,
508 Address constant_pool, Address target, 507 Address constant_pool, Address target,
509 ICacheFlushMode icache_flush_mode) { 508 ICacheFlushMode icache_flush_mode) {
509 DCHECK_IMPLIES(isolate == nullptr, icache_flush_mode == SKIP_ICACHE_FLUSH);
510
510 // Check for instructions generated by Asm::mov() 511 // Check for instructions generated by Asm::mov()
511 Opcode op1 = Instruction::S390OpcodeValue(reinterpret_cast<const byte*>(pc)); 512 Opcode op1 = Instruction::S390OpcodeValue(reinterpret_cast<const byte*>(pc));
512 SixByteInstr instr_1 = 513 SixByteInstr instr_1 =
513 Instruction::InstructionBits(reinterpret_cast<const byte*>(pc)); 514 Instruction::InstructionBits(reinterpret_cast<const byte*>(pc));
514 bool patched = false; 515 bool patched = false;
515 516
516 if (BRASL == op1 || BRCL == op1) { 517 if (BRASL == op1 || BRCL == op1) {
517 instr_1 >>= 32; // Zero out the lower 32-bits 518 instr_1 >>= 32; // Zero out the lower 32-bits
518 instr_1 <<= 32; 519 instr_1 <<= 32;
519 int32_t halfwords = (target - pc) / 2; // number of halfwords 520 int32_t halfwords = (target - pc) / 2; // number of halfwords
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
570 } 571 }
571 #endif 572 #endif
572 } 573 }
573 if (!patched) UNREACHABLE(); 574 if (!patched) UNREACHABLE();
574 } 575 }
575 576
576 } // namespace internal 577 } // namespace internal
577 } // namespace v8 578 } // namespace v8
578 579
579 #endif // V8_S390_ASSEMBLER_S390_INL_H_ 580 #endif // V8_S390_ASSEMBLER_S390_INL_H_
OLDNEW
« no previous file with comments | « src/s390/assembler-s390.cc ('k') | src/s390/macro-assembler-s390.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698