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

Side by Side Diff: src/arm/assembler-arm-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/arm/assembler-arm.cc ('k') | src/arm/codegen-arm.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 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 Handle<HeapObject> RelocInfo::target_object_handle(Assembler* origin) { 107 Handle<HeapObject> RelocInfo::target_object_handle(Assembler* origin) {
108 DCHECK(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT); 108 DCHECK(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT);
109 return Handle<HeapObject>( 109 return Handle<HeapObject>(
110 reinterpret_cast<HeapObject**>(Assembler::target_address_at(pc_, host_))); 110 reinterpret_cast<HeapObject**>(Assembler::target_address_at(pc_, host_)));
111 } 111 }
112 112
113 void RelocInfo::set_target_object(HeapObject* target, 113 void RelocInfo::set_target_object(HeapObject* target,
114 WriteBarrierMode write_barrier_mode, 114 WriteBarrierMode write_barrier_mode,
115 ICacheFlushMode icache_flush_mode) { 115 ICacheFlushMode icache_flush_mode) {
116 DCHECK(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT); 116 DCHECK(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT);
117 Assembler::set_target_address_at(isolate_, pc_, host_, 117 Assembler::set_target_address_at(target->GetIsolate(), pc_, host_,
118 reinterpret_cast<Address>(target), 118 reinterpret_cast<Address>(target),
119 icache_flush_mode); 119 icache_flush_mode);
120 if (write_barrier_mode == UPDATE_WRITE_BARRIER && host() != NULL) { 120 if (write_barrier_mode == UPDATE_WRITE_BARRIER && host() != NULL) {
121 host()->GetHeap()->incremental_marking()->RecordWriteIntoCode(host(), this, 121 host()->GetHeap()->incremental_marking()->RecordWriteIntoCode(host(), this,
122 target); 122 target);
123 host()->GetHeap()->RecordWriteIntoCode(host(), this, target); 123 host()->GetHeap()->RecordWriteIntoCode(host(), this, target);
124 } 124 }
125 } 125 }
126 126
127 127
(...skipping 13 matching lines...) Expand all
141 DCHECK(rmode_ == INTERNAL_REFERENCE); 141 DCHECK(rmode_ == INTERNAL_REFERENCE);
142 return reinterpret_cast<Address>(pc_); 142 return reinterpret_cast<Address>(pc_);
143 } 143 }
144 144
145 145
146 Address RelocInfo::target_runtime_entry(Assembler* origin) { 146 Address RelocInfo::target_runtime_entry(Assembler* origin) {
147 DCHECK(IsRuntimeEntry(rmode_)); 147 DCHECK(IsRuntimeEntry(rmode_));
148 return target_address(); 148 return target_address();
149 } 149 }
150 150
151 151 void RelocInfo::set_target_runtime_entry(Isolate* isolate, Address target,
152 void RelocInfo::set_target_runtime_entry(Address target,
153 WriteBarrierMode write_barrier_mode, 152 WriteBarrierMode write_barrier_mode,
154 ICacheFlushMode icache_flush_mode) { 153 ICacheFlushMode icache_flush_mode) {
155 DCHECK(IsRuntimeEntry(rmode_)); 154 DCHECK(IsRuntimeEntry(rmode_));
156 if (target_address() != target) 155 if (target_address() != target)
157 set_target_address(target, write_barrier_mode, icache_flush_mode); 156 set_target_address(isolate, target, write_barrier_mode, icache_flush_mode);
158 } 157 }
159 158
160 159
161 Handle<Cell> RelocInfo::target_cell_handle() { 160 Handle<Cell> RelocInfo::target_cell_handle() {
162 DCHECK(rmode_ == RelocInfo::CELL); 161 DCHECK(rmode_ == RelocInfo::CELL);
163 Address address = Memory::Address_at(pc_); 162 Address address = Memory::Address_at(pc_);
164 return Handle<Cell>(reinterpret_cast<Cell**>(address)); 163 return Handle<Cell>(reinterpret_cast<Cell**>(address));
165 } 164 }
166 165
167 166
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 } 205 }
207 206
208 207
209 Address RelocInfo::debug_call_address() { 208 Address RelocInfo::debug_call_address() {
210 // The 2 instructions offset assumes patched debug break slot or return 209 // The 2 instructions offset assumes patched debug break slot or return
211 // sequence. 210 // sequence.
212 DCHECK(IsDebugBreakSlot(rmode()) && IsPatchedDebugBreakSlotSequence()); 211 DCHECK(IsDebugBreakSlot(rmode()) && IsPatchedDebugBreakSlotSequence());
213 return Memory::Address_at(pc_ + Assembler::kPatchDebugBreakSlotAddressOffset); 212 return Memory::Address_at(pc_ + Assembler::kPatchDebugBreakSlotAddressOffset);
214 } 213 }
215 214
216 215 void RelocInfo::set_debug_call_address(Isolate* isolate, Address target) {
217 void RelocInfo::set_debug_call_address(Address target) {
218 DCHECK(IsDebugBreakSlot(rmode()) && IsPatchedDebugBreakSlotSequence()); 216 DCHECK(IsDebugBreakSlot(rmode()) && IsPatchedDebugBreakSlotSequence());
219 Memory::Address_at(pc_ + Assembler::kPatchDebugBreakSlotAddressOffset) = 217 Memory::Address_at(pc_ + Assembler::kPatchDebugBreakSlotAddressOffset) =
220 target; 218 target;
221 if (host() != NULL) { 219 if (host() != NULL) {
222 Code* target_code = Code::GetCodeFromTargetAddress(target); 220 Code* target_code = Code::GetCodeFromTargetAddress(target);
223 host()->GetHeap()->incremental_marking()->RecordWriteIntoCode(host(), this, 221 host()->GetHeap()->incremental_marking()->RecordWriteIntoCode(host(), this,
224 target_code); 222 target_code);
225 } 223 }
226 } 224 }
227 225
228 226 void RelocInfo::WipeOut(Isolate* isolate) {
229 void RelocInfo::WipeOut() {
230 DCHECK(IsEmbeddedObject(rmode_) || IsCodeTarget(rmode_) || 227 DCHECK(IsEmbeddedObject(rmode_) || IsCodeTarget(rmode_) ||
231 IsRuntimeEntry(rmode_) || IsExternalReference(rmode_) || 228 IsRuntimeEntry(rmode_) || IsExternalReference(rmode_) ||
232 IsInternalReference(rmode_)); 229 IsInternalReference(rmode_));
233 if (IsInternalReference(rmode_)) { 230 if (IsInternalReference(rmode_)) {
234 Memory::Address_at(pc_) = NULL; 231 Memory::Address_at(pc_) = NULL;
235 } else { 232 } else {
236 Assembler::set_target_address_at(isolate_, pc_, host_, NULL); 233 Assembler::set_target_address_at(isolate, pc_, host_, NULL);
237 } 234 }
238 } 235 }
239 236
240 template <typename ObjectVisitor> 237 template <typename ObjectVisitor>
241 void RelocInfo::Visit(Isolate* isolate, ObjectVisitor* visitor) { 238 void RelocInfo::Visit(Isolate* isolate, ObjectVisitor* visitor) {
242 RelocInfo::Mode mode = rmode(); 239 RelocInfo::Mode mode = rmode();
243 if (mode == RelocInfo::EMBEDDED_OBJECT) { 240 if (mode == RelocInfo::EMBEDDED_OBJECT) {
244 visitor->VisitEmbeddedPointer(this); 241 visitor->VisitEmbeddedPointer(this);
245 } else if (RelocInfo::IsCodeTarget(mode)) { 242 } else if (RelocInfo::IsCodeTarget(mode)) {
246 visitor->VisitCodeTarget(this); 243 visitor->VisitCodeTarget(this);
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after
520 DecodeShiftImm(mov_instr) | DecodeShiftImm(orr_instr_1) | 517 DecodeShiftImm(mov_instr) | DecodeShiftImm(orr_instr_1) |
521 DecodeShiftImm(orr_instr_2) | DecodeShiftImm(orr_instr_3)); 518 DecodeShiftImm(orr_instr_2) | DecodeShiftImm(orr_instr_3));
522 return ret; 519 return ret;
523 } 520 }
524 } 521 }
525 522
526 523
527 void Assembler::set_target_address_at(Isolate* isolate, Address pc, 524 void Assembler::set_target_address_at(Isolate* isolate, Address pc,
528 Address constant_pool, Address target, 525 Address constant_pool, Address target,
529 ICacheFlushMode icache_flush_mode) { 526 ICacheFlushMode icache_flush_mode) {
527 DCHECK_IMPLIES(isolate == nullptr, icache_flush_mode == SKIP_ICACHE_FLUSH);
530 if (is_constant_pool_load(pc)) { 528 if (is_constant_pool_load(pc)) {
531 // This is a constant pool lookup. Update the entry in the constant pool. 529 // This is a constant pool lookup. Update the entry in the constant pool.
532 Memory::Address_at(constant_pool_entry_address(pc, constant_pool)) = target; 530 Memory::Address_at(constant_pool_entry_address(pc, constant_pool)) = target;
533 // Intuitively, we would think it is necessary to always flush the 531 // Intuitively, we would think it is necessary to always flush the
534 // instruction cache after patching a target address in the code as follows: 532 // instruction cache after patching a target address in the code as follows:
535 // Assembler::FlushICache(isolate, pc, sizeof(target)); 533 // Assembler::FlushICache(isolate, pc, sizeof(target));
536 // However, on ARM, no instruction is actually patched in the case 534 // However, on ARM, no instruction is actually patched in the case
537 // of embedded constants of the form: 535 // of embedded constants of the form:
538 // ldr ip, [pp, #...] 536 // ldr ip, [pp, #...]
539 // since the instruction accessing this address in the constant pool remains 537 // since the instruction accessing this address in the constant pool remains
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
586 Address constant_pool = code ? code->constant_pool() : NULL; 584 Address constant_pool = code ? code->constant_pool() : NULL;
587 set_target_address_at(isolate, pc, constant_pool, target, icache_flush_mode); 585 set_target_address_at(isolate, pc, constant_pool, target, icache_flush_mode);
588 } 586 }
589 587
590 EnsureSpace::EnsureSpace(Assembler* assembler) { assembler->CheckBuffer(); } 588 EnsureSpace::EnsureSpace(Assembler* assembler) { assembler->CheckBuffer(); }
591 589
592 } // namespace internal 590 } // namespace internal
593 } // namespace v8 591 } // namespace v8
594 592
595 #endif // V8_ARM_ASSEMBLER_ARM_INL_H_ 593 #endif // V8_ARM_ASSEMBLER_ARM_INL_H_
OLDNEW
« no previous file with comments | « src/arm/assembler-arm.cc ('k') | src/arm/codegen-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698