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

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

Issue 183803022: Pass a Code object to Assembler::(set_)target_address_at for use by ool constant pool. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 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 | Annotate | Revision Log
« no previous file with comments | « src/ia32/assembler-ia32.h ('k') | src/ia32/frames-ia32.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 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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 // absolute code pointer inside code object moves with the code object. 78 // absolute code pointer inside code object moves with the code object.
79 int32_t* p = reinterpret_cast<int32_t*>(pc_); 79 int32_t* p = reinterpret_cast<int32_t*>(pc_);
80 *p += delta; // Relocate entry. 80 *p += delta; // Relocate entry.
81 CPU::FlushICache(p, sizeof(uint32_t)); 81 CPU::FlushICache(p, sizeof(uint32_t));
82 } 82 }
83 } 83 }
84 84
85 85
86 Address RelocInfo::target_address() { 86 Address RelocInfo::target_address() {
87 ASSERT(IsCodeTarget(rmode_) || IsRuntimeEntry(rmode_)); 87 ASSERT(IsCodeTarget(rmode_) || IsRuntimeEntry(rmode_));
88 return Assembler::target_address_at(pc_); 88 return Assembler::target_address_at(pc_, host_);
89 } 89 }
90 90
91 91
92 Address RelocInfo::target_address_address() { 92 Address RelocInfo::target_address_address() {
93 ASSERT(IsCodeTarget(rmode_) || IsRuntimeEntry(rmode_) 93 ASSERT(IsCodeTarget(rmode_) || IsRuntimeEntry(rmode_)
94 || rmode_ == EMBEDDED_OBJECT 94 || rmode_ == EMBEDDED_OBJECT
95 || rmode_ == EXTERNAL_REFERENCE); 95 || rmode_ == EXTERNAL_REFERENCE);
96 return reinterpret_cast<Address>(pc_); 96 return reinterpret_cast<Address>(pc_);
97 } 97 }
98 98
99 99
100 int RelocInfo::target_address_size() { 100 int RelocInfo::target_address_size() {
101 return Assembler::kSpecialTargetSize; 101 return Assembler::kSpecialTargetSize;
102 } 102 }
103 103
104 104
105 void RelocInfo::set_target_address(Address target, WriteBarrierMode mode) { 105 void RelocInfo::set_target_address(Address target, WriteBarrierMode mode) {
106 Assembler::set_target_address_at(pc_, target); 106 Assembler::set_target_address_at(pc_, host_, target);
107 ASSERT(IsCodeTarget(rmode_) || IsRuntimeEntry(rmode_)); 107 ASSERT(IsCodeTarget(rmode_) || IsRuntimeEntry(rmode_));
108 if (mode == UPDATE_WRITE_BARRIER && host() != NULL && IsCodeTarget(rmode_)) { 108 if (mode == UPDATE_WRITE_BARRIER && host() != NULL && IsCodeTarget(rmode_)) {
109 Object* target_code = Code::GetCodeFromTargetAddress(target); 109 Object* target_code = Code::GetCodeFromTargetAddress(target);
110 host()->GetHeap()->incremental_marking()->RecordWriteIntoCode( 110 host()->GetHeap()->incremental_marking()->RecordWriteIntoCode(
111 host(), this, HeapObject::cast(target_code)); 111 host(), this, HeapObject::cast(target_code));
112 } 112 }
113 } 113 }
114 114
115 115
116 Object* RelocInfo::target_object() { 116 Object* RelocInfo::target_object() {
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 ASSERT(rmode_ == RelocInfo::CODE_AGE_SEQUENCE); 189 ASSERT(rmode_ == RelocInfo::CODE_AGE_SEQUENCE);
190 ASSERT(*pc_ == kCallOpcode); 190 ASSERT(*pc_ == kCallOpcode);
191 return Memory::Object_Handle_at(pc_ + 1); 191 return Memory::Object_Handle_at(pc_ + 1);
192 } 192 }
193 193
194 194
195 Code* RelocInfo::code_age_stub() { 195 Code* RelocInfo::code_age_stub() {
196 ASSERT(rmode_ == RelocInfo::CODE_AGE_SEQUENCE); 196 ASSERT(rmode_ == RelocInfo::CODE_AGE_SEQUENCE);
197 ASSERT(*pc_ == kCallOpcode); 197 ASSERT(*pc_ == kCallOpcode);
198 return Code::GetCodeFromTargetAddress( 198 return Code::GetCodeFromTargetAddress(
199 Assembler::target_address_at(pc_ + 1)); 199 Assembler::target_address_at(pc_ + 1, host_));
200 } 200 }
201 201
202 202
203 void RelocInfo::set_code_age_stub(Code* stub) { 203 void RelocInfo::set_code_age_stub(Code* stub) {
204 ASSERT(*pc_ == kCallOpcode); 204 ASSERT(*pc_ == kCallOpcode);
205 ASSERT(rmode_ == RelocInfo::CODE_AGE_SEQUENCE); 205 ASSERT(rmode_ == RelocInfo::CODE_AGE_SEQUENCE);
206 Assembler::set_target_address_at(pc_ + 1, stub->instruction_start()); 206 Assembler::set_target_address_at(pc_ + 1, host_, stub->instruction_start());
207 } 207 }
208 208
209 209
210 Address RelocInfo::call_address() { 210 Address RelocInfo::call_address() {
211 ASSERT((IsJSReturn(rmode()) && IsPatchedReturnSequence()) || 211 ASSERT((IsJSReturn(rmode()) && IsPatchedReturnSequence()) ||
212 (IsDebugBreakSlot(rmode()) && IsPatchedDebugBreakSlotSequence())); 212 (IsDebugBreakSlot(rmode()) && IsPatchedDebugBreakSlotSequence()));
213 return Assembler::target_address_at(pc_ + 1); 213 return Assembler::target_address_at(pc_ + 1, host_);
214 } 214 }
215 215
216 216
217 void RelocInfo::set_call_address(Address target) { 217 void RelocInfo::set_call_address(Address target) {
218 ASSERT((IsJSReturn(rmode()) && IsPatchedReturnSequence()) || 218 ASSERT((IsJSReturn(rmode()) && IsPatchedReturnSequence()) ||
219 (IsDebugBreakSlot(rmode()) && IsPatchedDebugBreakSlotSequence())); 219 (IsDebugBreakSlot(rmode()) && IsPatchedDebugBreakSlotSequence()));
220 Assembler::set_target_address_at(pc_ + 1, target); 220 Assembler::set_target_address_at(pc_ + 1, host_, target);
221 if (host() != NULL) { 221 if (host() != NULL) {
222 Object* target_code = Code::GetCodeFromTargetAddress(target); 222 Object* target_code = Code::GetCodeFromTargetAddress(target);
223 host()->GetHeap()->incremental_marking()->RecordWriteIntoCode( 223 host()->GetHeap()->incremental_marking()->RecordWriteIntoCode(
224 host(), this, HeapObject::cast(target_code)); 224 host(), this, HeapObject::cast(target_code));
225 } 225 }
226 } 226 }
227 227
228 228
229 Object* RelocInfo::call_object() { 229 Object* RelocInfo::call_object() {
230 return *call_object_address(); 230 return *call_object_address();
(...skipping 10 matching lines...) Expand all
241 (IsDebugBreakSlot(rmode()) && IsPatchedDebugBreakSlotSequence())); 241 (IsDebugBreakSlot(rmode()) && IsPatchedDebugBreakSlotSequence()));
242 return reinterpret_cast<Object**>(pc_ + 1); 242 return reinterpret_cast<Object**>(pc_ + 1);
243 } 243 }
244 244
245 245
246 void RelocInfo::WipeOut() { 246 void RelocInfo::WipeOut() {
247 if (IsEmbeddedObject(rmode_) || IsExternalReference(rmode_)) { 247 if (IsEmbeddedObject(rmode_) || IsExternalReference(rmode_)) {
248 Memory::Address_at(pc_) = NULL; 248 Memory::Address_at(pc_) = NULL;
249 } else if (IsCodeTarget(rmode_) || IsRuntimeEntry(rmode_)) { 249 } else if (IsCodeTarget(rmode_) || IsRuntimeEntry(rmode_)) {
250 // Effectively write zero into the relocation. 250 // Effectively write zero into the relocation.
251 Assembler::set_target_address_at(pc_, pc_ + sizeof(int32_t)); 251 Assembler::set_target_address_at(pc_, host_, pc_ + sizeof(int32_t));
252 } else { 252 } else {
253 UNREACHABLE(); 253 UNREACHABLE();
254 } 254 }
255 } 255 }
256 256
257 257
258 bool RelocInfo::IsPatchedReturnSequence() { 258 bool RelocInfo::IsPatchedReturnSequence() {
259 return *pc_ == kCallOpcode; 259 return *pc_ == kCallOpcode;
260 } 260 }
261 261
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
432 432
433 433
434 void Assembler::emit_w(const Immediate& x) { 434 void Assembler::emit_w(const Immediate& x) {
435 ASSERT(RelocInfo::IsNone(x.rmode_)); 435 ASSERT(RelocInfo::IsNone(x.rmode_));
436 uint16_t value = static_cast<uint16_t>(x.x_); 436 uint16_t value = static_cast<uint16_t>(x.x_);
437 reinterpret_cast<uint16_t*>(pc_)[0] = value; 437 reinterpret_cast<uint16_t*>(pc_)[0] = value;
438 pc_ += sizeof(uint16_t); 438 pc_ += sizeof(uint16_t);
439 } 439 }
440 440
441 441
442 Address Assembler::target_address_at(Address pc) { 442 Address Assembler::target_address_at(Address pc,
443 ConstantPoolArray* constant_pool) {
443 return pc + sizeof(int32_t) + *reinterpret_cast<int32_t*>(pc); 444 return pc + sizeof(int32_t) + *reinterpret_cast<int32_t*>(pc);
444 } 445 }
445 446
446 447
447 void Assembler::set_target_address_at(Address pc, Address target) { 448 void Assembler::set_target_address_at(Address pc,
449 ConstantPoolArray* constant_pool,
450 Address target) {
448 int32_t* p = reinterpret_cast<int32_t*>(pc); 451 int32_t* p = reinterpret_cast<int32_t*>(pc);
449 *p = target - (pc + sizeof(int32_t)); 452 *p = target - (pc + sizeof(int32_t));
450 CPU::FlushICache(p, sizeof(int32_t)); 453 CPU::FlushICache(p, sizeof(int32_t));
451 } 454 }
452 455
453 456
454 Address Assembler::target_address_from_return_address(Address pc) { 457 Address Assembler::target_address_from_return_address(Address pc) {
455 return pc - kCallTargetAddressOffset; 458 return pc - kCallTargetAddressOffset;
456 } 459 }
457 460
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
530 533
531 Operand::Operand(int32_t disp, RelocInfo::Mode rmode) { 534 Operand::Operand(int32_t disp, RelocInfo::Mode rmode) {
532 // [disp/r] 535 // [disp/r]
533 set_modrm(0, ebp); 536 set_modrm(0, ebp);
534 set_dispr(disp, rmode); 537 set_dispr(disp, rmode);
535 } 538 }
536 539
537 } } // namespace v8::internal 540 } } // namespace v8::internal
538 541
539 #endif // V8_IA32_ASSEMBLER_IA32_INL_H_ 542 #endif // V8_IA32_ASSEMBLER_IA32_INL_H_
OLDNEW
« no previous file with comments | « src/ia32/assembler-ia32.h ('k') | src/ia32/frames-ia32.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698