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

Side by Side Diff: src/ppc/assembler-ppc-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/ppc/assembler-ppc.cc ('k') | src/ppc/codegen-ppc.cc » ('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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 void RelocInfo::apply(intptr_t delta) { 54 void RelocInfo::apply(intptr_t delta) {
55 // absolute code pointer inside code object moves with the code object. 55 // absolute code pointer inside code object moves with the code object.
56 if (IsInternalReference(rmode_)) { 56 if (IsInternalReference(rmode_)) {
57 // Jump table entry 57 // Jump table entry
58 Address target = Memory::Address_at(pc_); 58 Address target = Memory::Address_at(pc_);
59 Memory::Address_at(pc_) = target + delta; 59 Memory::Address_at(pc_) = target + delta;
60 } else { 60 } else {
61 // mov sequence 61 // mov sequence
62 DCHECK(IsInternalReferenceEncoded(rmode_)); 62 DCHECK(IsInternalReferenceEncoded(rmode_));
63 Address target = Assembler::target_address_at(pc_, host_); 63 Address target = Assembler::target_address_at(pc_, host_);
64 Assembler::set_target_address_at(isolate_, pc_, host_, target + delta, 64 Assembler::set_target_address_at(nullptr, pc_, host_, target + delta,
65 SKIP_ICACHE_FLUSH); 65 SKIP_ICACHE_FLUSH);
66 } 66 }
67 } 67 }
68 68
69 69
70 Address RelocInfo::target_internal_reference() { 70 Address RelocInfo::target_internal_reference() {
71 if (IsInternalReference(rmode_)) { 71 if (IsInternalReference(rmode_)) {
72 // Jump table entry 72 // Jump table entry
73 return Memory::Address_at(pc_); 73 return Memory::Address_at(pc_);
74 } else { 74 } else {
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 Handle<HeapObject> RelocInfo::target_object_handle(Assembler* origin) { 184 Handle<HeapObject> RelocInfo::target_object_handle(Assembler* origin) {
185 DCHECK(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT); 185 DCHECK(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT);
186 return Handle<HeapObject>( 186 return Handle<HeapObject>(
187 reinterpret_cast<HeapObject**>(Assembler::target_address_at(pc_, host_))); 187 reinterpret_cast<HeapObject**>(Assembler::target_address_at(pc_, host_)));
188 } 188 }
189 189
190 void RelocInfo::set_target_object(HeapObject* target, 190 void RelocInfo::set_target_object(HeapObject* target,
191 WriteBarrierMode write_barrier_mode, 191 WriteBarrierMode write_barrier_mode,
192 ICacheFlushMode icache_flush_mode) { 192 ICacheFlushMode icache_flush_mode) {
193 DCHECK(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT); 193 DCHECK(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT);
194 Assembler::set_target_address_at(isolate_, pc_, host_, 194 Assembler::set_target_address_at(target->GetIsolate(), pc_, host_,
195 reinterpret_cast<Address>(target), 195 reinterpret_cast<Address>(target),
196 icache_flush_mode); 196 icache_flush_mode);
197 if (write_barrier_mode == UPDATE_WRITE_BARRIER && host() != NULL && 197 if (write_barrier_mode == UPDATE_WRITE_BARRIER && host() != NULL) {
198 target->IsHeapObject()) { 198 host()->GetHeap()->incremental_marking()->RecordWriteIntoCode(host(), this,
199 host()->GetHeap()->incremental_marking()->RecordWriteIntoCode( 199 target);
200 host(), this, HeapObject::cast(target));
201 host()->GetHeap()->RecordWriteIntoCode(host(), this, target); 200 host()->GetHeap()->RecordWriteIntoCode(host(), this, target);
202 } 201 }
203 } 202 }
204 203
205 204
206 Address RelocInfo::target_external_reference() { 205 Address RelocInfo::target_external_reference() {
207 DCHECK(rmode_ == EXTERNAL_REFERENCE); 206 DCHECK(rmode_ == EXTERNAL_REFERENCE);
208 return Assembler::target_address_at(pc_, host_); 207 return Assembler::target_address_at(pc_, host_);
209 } 208 }
210 209
211 210
212 Address RelocInfo::target_runtime_entry(Assembler* origin) { 211 Address RelocInfo::target_runtime_entry(Assembler* origin) {
213 DCHECK(IsRuntimeEntry(rmode_)); 212 DCHECK(IsRuntimeEntry(rmode_));
214 return target_address(); 213 return target_address();
215 } 214 }
216 215
217 216 void RelocInfo::set_target_runtime_entry(Isolate* isolate, Address target,
218 void RelocInfo::set_target_runtime_entry(Address target,
219 WriteBarrierMode write_barrier_mode, 217 WriteBarrierMode write_barrier_mode,
220 ICacheFlushMode icache_flush_mode) { 218 ICacheFlushMode icache_flush_mode) {
221 DCHECK(IsRuntimeEntry(rmode_)); 219 DCHECK(IsRuntimeEntry(rmode_));
222 if (target_address() != target) 220 if (target_address() != target)
223 set_target_address(target, write_barrier_mode, icache_flush_mode); 221 set_target_address(isolate, target, write_barrier_mode, icache_flush_mode);
224 } 222 }
225 223
226 224
227 Handle<Cell> RelocInfo::target_cell_handle() { 225 Handle<Cell> RelocInfo::target_cell_handle() {
228 DCHECK(rmode_ == RelocInfo::CELL); 226 DCHECK(rmode_ == RelocInfo::CELL);
229 Address address = Memory::Address_at(pc_); 227 Address address = Memory::Address_at(pc_);
230 return Handle<Cell>(reinterpret_cast<Cell**>(address)); 228 return Handle<Cell>(reinterpret_cast<Cell**>(address));
231 } 229 }
232 230
233 231
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 Code* RelocInfo::code_age_stub() { 272 Code* RelocInfo::code_age_stub() {
275 DCHECK(rmode_ == RelocInfo::CODE_AGE_SEQUENCE); 273 DCHECK(rmode_ == RelocInfo::CODE_AGE_SEQUENCE);
276 return Code::GetCodeFromTargetAddress( 274 return Code::GetCodeFromTargetAddress(
277 Assembler::target_address_at(pc_ + kCodeAgingTargetDelta, host_)); 275 Assembler::target_address_at(pc_ + kCodeAgingTargetDelta, host_));
278 } 276 }
279 277
280 278
281 void RelocInfo::set_code_age_stub(Code* stub, 279 void RelocInfo::set_code_age_stub(Code* stub,
282 ICacheFlushMode icache_flush_mode) { 280 ICacheFlushMode icache_flush_mode) {
283 DCHECK(rmode_ == RelocInfo::CODE_AGE_SEQUENCE); 281 DCHECK(rmode_ == RelocInfo::CODE_AGE_SEQUENCE);
284 Assembler::set_target_address_at(isolate_, pc_ + kCodeAgingTargetDelta, host_, 282 Assembler::set_target_address_at(
285 stub->instruction_start(), 283 stub->GetIsolate(), pc_ + kCodeAgingTargetDelta, host_,
286 icache_flush_mode); 284 stub->instruction_start(), icache_flush_mode);
287 } 285 }
288 286
289 287
290 Address RelocInfo::debug_call_address() { 288 Address RelocInfo::debug_call_address() {
291 DCHECK(IsDebugBreakSlot(rmode()) && IsPatchedDebugBreakSlotSequence()); 289 DCHECK(IsDebugBreakSlot(rmode()) && IsPatchedDebugBreakSlotSequence());
292 return Assembler::target_address_at(pc_, host_); 290 return Assembler::target_address_at(pc_, host_);
293 } 291 }
294 292
295 293 void RelocInfo::set_debug_call_address(Isolate* isolate, Address target) {
296 void RelocInfo::set_debug_call_address(Address target) {
297 DCHECK(IsDebugBreakSlot(rmode()) && IsPatchedDebugBreakSlotSequence()); 294 DCHECK(IsDebugBreakSlot(rmode()) && IsPatchedDebugBreakSlotSequence());
298 Assembler::set_target_address_at(isolate_, pc_, host_, target); 295 Assembler::set_target_address_at(isolate, pc_, host_, target);
299 if (host() != NULL) { 296 if (host() != NULL) {
300 Code* target_code = Code::GetCodeFromTargetAddress(target); 297 Code* target_code = Code::GetCodeFromTargetAddress(target);
301 host()->GetHeap()->incremental_marking()->RecordWriteIntoCode(host(), this, 298 host()->GetHeap()->incremental_marking()->RecordWriteIntoCode(host(), this,
302 target_code); 299 target_code);
303 } 300 }
304 } 301 }
305 302
306 303 void RelocInfo::WipeOut(Isolate* isolate) {
307 void RelocInfo::WipeOut() {
308 DCHECK(IsEmbeddedObject(rmode_) || IsCodeTarget(rmode_) || 304 DCHECK(IsEmbeddedObject(rmode_) || IsCodeTarget(rmode_) ||
309 IsRuntimeEntry(rmode_) || IsExternalReference(rmode_) || 305 IsRuntimeEntry(rmode_) || IsExternalReference(rmode_) ||
310 IsInternalReference(rmode_) || IsInternalReferenceEncoded(rmode_)); 306 IsInternalReference(rmode_) || IsInternalReferenceEncoded(rmode_));
311 if (IsInternalReference(rmode_)) { 307 if (IsInternalReference(rmode_)) {
312 // Jump table entry 308 // Jump table entry
313 Memory::Address_at(pc_) = NULL; 309 Memory::Address_at(pc_) = NULL;
314 } else if (IsInternalReferenceEncoded(rmode_)) { 310 } else if (IsInternalReferenceEncoded(rmode_)) {
315 // mov sequence 311 // mov sequence
316 // Currently used only by deserializer, no need to flush. 312 // Currently used only by deserializer, no need to flush.
317 Assembler::set_target_address_at(isolate_, pc_, host_, NULL, 313 Assembler::set_target_address_at(isolate, pc_, host_, NULL,
318 SKIP_ICACHE_FLUSH); 314 SKIP_ICACHE_FLUSH);
319 } else { 315 } else {
320 Assembler::set_target_address_at(isolate_, pc_, host_, NULL); 316 Assembler::set_target_address_at(isolate, pc_, host_, NULL);
321 } 317 }
322 } 318 }
323 319
324 template <typename ObjectVisitor> 320 template <typename ObjectVisitor>
325 void RelocInfo::Visit(Isolate* isolate, ObjectVisitor* visitor) { 321 void RelocInfo::Visit(Isolate* isolate, ObjectVisitor* visitor) {
326 RelocInfo::Mode mode = rmode(); 322 RelocInfo::Mode mode = rmode();
327 if (mode == RelocInfo::EMBEDDED_OBJECT) { 323 if (mode == RelocInfo::EMBEDDED_OBJECT) {
328 visitor->VisitEmbeddedPointer(this); 324 visitor->VisitEmbeddedPointer(this);
329 } else if (RelocInfo::IsCodeTarget(mode)) { 325 } else if (RelocInfo::IsCodeTarget(mode)) {
330 visitor->VisitCodeTarget(this); 326 visitor->VisitCodeTarget(this);
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after
613 } else { 609 } else {
614 Memory::Address_at(pc) = target; 610 Memory::Address_at(pc) = target;
615 } 611 }
616 } 612 }
617 613
618 614
619 // This code assumes the FIXED_SEQUENCE of lis/ori 615 // This code assumes the FIXED_SEQUENCE of lis/ori
620 void Assembler::set_target_address_at(Isolate* isolate, Address pc, 616 void Assembler::set_target_address_at(Isolate* isolate, Address pc,
621 Address constant_pool, Address target, 617 Address constant_pool, Address target,
622 ICacheFlushMode icache_flush_mode) { 618 ICacheFlushMode icache_flush_mode) {
619 DCHECK_IMPLIES(isolate == nullptr, icache_flush_mode == SKIP_ICACHE_FLUSH);
620
623 if (FLAG_enable_embedded_constant_pool && constant_pool) { 621 if (FLAG_enable_embedded_constant_pool && constant_pool) {
624 ConstantPoolEntry::Access access; 622 ConstantPoolEntry::Access access;
625 if (IsConstantPoolLoadStart(pc, &access)) { 623 if (IsConstantPoolLoadStart(pc, &access)) {
626 Memory::Address_at(target_constant_pool_address_at( 624 Memory::Address_at(target_constant_pool_address_at(
627 pc, constant_pool, access, ConstantPoolEntry::INTPTR)) = target; 625 pc, constant_pool, access, ConstantPoolEntry::INTPTR)) = target;
628 return; 626 return;
629 } 627 }
630 } 628 }
631 629
632 Instr instr1 = instr_at(pc); 630 Instr instr1 = instr_at(pc);
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
680 } 678 }
681 #endif 679 #endif
682 return; 680 return;
683 } 681 }
684 UNREACHABLE(); 682 UNREACHABLE();
685 } 683 }
686 } // namespace internal 684 } // namespace internal
687 } // namespace v8 685 } // namespace v8
688 686
689 #endif // V8_PPC_ASSEMBLER_PPC_INL_H_ 687 #endif // V8_PPC_ASSEMBLER_PPC_INL_H_
OLDNEW
« no previous file with comments | « src/ppc/assembler-ppc.cc ('k') | src/ppc/codegen-ppc.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698