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

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

Issue 196133017: Experimental parser: merge r19949 (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/parser
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.cc ('k') | src/ia32/builtins-ia32.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 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 Address RelocInfo::constant_pool_entry_address() {
101 UNREACHABLE();
102 return NULL;
103 }
104
105
100 int RelocInfo::target_address_size() { 106 int RelocInfo::target_address_size() {
101 return Assembler::kSpecialTargetSize; 107 return Assembler::kSpecialTargetSize;
102 } 108 }
103 109
104 110
105 void RelocInfo::set_target_address(Address target, WriteBarrierMode mode) { 111 void RelocInfo::set_target_address(Address target, WriteBarrierMode mode) {
106 Assembler::set_target_address_at(pc_, target); 112 Assembler::set_target_address_at(pc_, host_, target);
107 ASSERT(IsCodeTarget(rmode_) || IsRuntimeEntry(rmode_)); 113 ASSERT(IsCodeTarget(rmode_) || IsRuntimeEntry(rmode_));
108 if (mode == UPDATE_WRITE_BARRIER && host() != NULL && IsCodeTarget(rmode_)) { 114 if (mode == UPDATE_WRITE_BARRIER && host() != NULL && IsCodeTarget(rmode_)) {
109 Object* target_code = Code::GetCodeFromTargetAddress(target); 115 Object* target_code = Code::GetCodeFromTargetAddress(target);
110 host()->GetHeap()->incremental_marking()->RecordWriteIntoCode( 116 host()->GetHeap()->incremental_marking()->RecordWriteIntoCode(
111 host(), this, HeapObject::cast(target_code)); 117 host(), this, HeapObject::cast(target_code));
112 } 118 }
113 } 119 }
114 120
115 121
116 Object* RelocInfo::target_object() { 122 Object* RelocInfo::target_object() {
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 ASSERT(rmode_ == RelocInfo::CODE_AGE_SEQUENCE); 195 ASSERT(rmode_ == RelocInfo::CODE_AGE_SEQUENCE);
190 ASSERT(*pc_ == kCallOpcode); 196 ASSERT(*pc_ == kCallOpcode);
191 return Memory::Object_Handle_at(pc_ + 1); 197 return Memory::Object_Handle_at(pc_ + 1);
192 } 198 }
193 199
194 200
195 Code* RelocInfo::code_age_stub() { 201 Code* RelocInfo::code_age_stub() {
196 ASSERT(rmode_ == RelocInfo::CODE_AGE_SEQUENCE); 202 ASSERT(rmode_ == RelocInfo::CODE_AGE_SEQUENCE);
197 ASSERT(*pc_ == kCallOpcode); 203 ASSERT(*pc_ == kCallOpcode);
198 return Code::GetCodeFromTargetAddress( 204 return Code::GetCodeFromTargetAddress(
199 Assembler::target_address_at(pc_ + 1)); 205 Assembler::target_address_at(pc_ + 1, host_));
200 } 206 }
201 207
202 208
203 void RelocInfo::set_code_age_stub(Code* stub) { 209 void RelocInfo::set_code_age_stub(Code* stub) {
204 ASSERT(*pc_ == kCallOpcode); 210 ASSERT(*pc_ == kCallOpcode);
205 ASSERT(rmode_ == RelocInfo::CODE_AGE_SEQUENCE); 211 ASSERT(rmode_ == RelocInfo::CODE_AGE_SEQUENCE);
206 Assembler::set_target_address_at(pc_ + 1, stub->instruction_start()); 212 Assembler::set_target_address_at(pc_ + 1, host_, stub->instruction_start());
207 } 213 }
208 214
209 215
210 Address RelocInfo::call_address() { 216 Address RelocInfo::call_address() {
211 ASSERT((IsJSReturn(rmode()) && IsPatchedReturnSequence()) || 217 ASSERT((IsJSReturn(rmode()) && IsPatchedReturnSequence()) ||
212 (IsDebugBreakSlot(rmode()) && IsPatchedDebugBreakSlotSequence())); 218 (IsDebugBreakSlot(rmode()) && IsPatchedDebugBreakSlotSequence()));
213 return Assembler::target_address_at(pc_ + 1); 219 return Assembler::target_address_at(pc_ + 1, host_);
214 } 220 }
215 221
216 222
217 void RelocInfo::set_call_address(Address target) { 223 void RelocInfo::set_call_address(Address target) {
218 ASSERT((IsJSReturn(rmode()) && IsPatchedReturnSequence()) || 224 ASSERT((IsJSReturn(rmode()) && IsPatchedReturnSequence()) ||
219 (IsDebugBreakSlot(rmode()) && IsPatchedDebugBreakSlotSequence())); 225 (IsDebugBreakSlot(rmode()) && IsPatchedDebugBreakSlotSequence()));
220 Assembler::set_target_address_at(pc_ + 1, target); 226 Assembler::set_target_address_at(pc_ + 1, host_, target);
221 if (host() != NULL) { 227 if (host() != NULL) {
222 Object* target_code = Code::GetCodeFromTargetAddress(target); 228 Object* target_code = Code::GetCodeFromTargetAddress(target);
223 host()->GetHeap()->incremental_marking()->RecordWriteIntoCode( 229 host()->GetHeap()->incremental_marking()->RecordWriteIntoCode(
224 host(), this, HeapObject::cast(target_code)); 230 host(), this, HeapObject::cast(target_code));
225 } 231 }
226 } 232 }
227 233
228 234
229 Object* RelocInfo::call_object() { 235 Object* RelocInfo::call_object() {
230 return *call_object_address(); 236 return *call_object_address();
(...skipping 10 matching lines...) Expand all
241 (IsDebugBreakSlot(rmode()) && IsPatchedDebugBreakSlotSequence())); 247 (IsDebugBreakSlot(rmode()) && IsPatchedDebugBreakSlotSequence()));
242 return reinterpret_cast<Object**>(pc_ + 1); 248 return reinterpret_cast<Object**>(pc_ + 1);
243 } 249 }
244 250
245 251
246 void RelocInfo::WipeOut() { 252 void RelocInfo::WipeOut() {
247 if (IsEmbeddedObject(rmode_) || IsExternalReference(rmode_)) { 253 if (IsEmbeddedObject(rmode_) || IsExternalReference(rmode_)) {
248 Memory::Address_at(pc_) = NULL; 254 Memory::Address_at(pc_) = NULL;
249 } else if (IsCodeTarget(rmode_) || IsRuntimeEntry(rmode_)) { 255 } else if (IsCodeTarget(rmode_) || IsRuntimeEntry(rmode_)) {
250 // Effectively write zero into the relocation. 256 // Effectively write zero into the relocation.
251 Assembler::set_target_address_at(pc_, pc_ + sizeof(int32_t)); 257 Assembler::set_target_address_at(pc_, host_, pc_ + sizeof(int32_t));
252 } else { 258 } else {
253 UNREACHABLE(); 259 UNREACHABLE();
254 } 260 }
255 } 261 }
256 262
257 263
258 bool RelocInfo::IsPatchedReturnSequence() { 264 bool RelocInfo::IsPatchedReturnSequence() {
259 return *pc_ == kCallOpcode; 265 return *pc_ == kCallOpcode;
260 } 266 }
261 267
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
432 438
433 439
434 void Assembler::emit_w(const Immediate& x) { 440 void Assembler::emit_w(const Immediate& x) {
435 ASSERT(RelocInfo::IsNone(x.rmode_)); 441 ASSERT(RelocInfo::IsNone(x.rmode_));
436 uint16_t value = static_cast<uint16_t>(x.x_); 442 uint16_t value = static_cast<uint16_t>(x.x_);
437 reinterpret_cast<uint16_t*>(pc_)[0] = value; 443 reinterpret_cast<uint16_t*>(pc_)[0] = value;
438 pc_ += sizeof(uint16_t); 444 pc_ += sizeof(uint16_t);
439 } 445 }
440 446
441 447
442 Address Assembler::target_address_at(Address pc) { 448 Address Assembler::target_address_at(Address pc,
449 ConstantPoolArray* constant_pool) {
443 return pc + sizeof(int32_t) + *reinterpret_cast<int32_t*>(pc); 450 return pc + sizeof(int32_t) + *reinterpret_cast<int32_t*>(pc);
444 } 451 }
445 452
446 453
447 void Assembler::set_target_address_at(Address pc, Address target) { 454 void Assembler::set_target_address_at(Address pc,
455 ConstantPoolArray* constant_pool,
456 Address target) {
448 int32_t* p = reinterpret_cast<int32_t*>(pc); 457 int32_t* p = reinterpret_cast<int32_t*>(pc);
449 *p = target - (pc + sizeof(int32_t)); 458 *p = target - (pc + sizeof(int32_t));
450 CPU::FlushICache(p, sizeof(int32_t)); 459 CPU::FlushICache(p, sizeof(int32_t));
451 } 460 }
452 461
453 462
454 Address Assembler::target_address_from_return_address(Address pc) { 463 Address Assembler::target_address_from_return_address(Address pc) {
455 return pc - kCallTargetAddressOffset; 464 return pc - kCallTargetAddressOffset;
456 } 465 }
457 466
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
530 539
531 Operand::Operand(int32_t disp, RelocInfo::Mode rmode) { 540 Operand::Operand(int32_t disp, RelocInfo::Mode rmode) {
532 // [disp/r] 541 // [disp/r]
533 set_modrm(0, ebp); 542 set_modrm(0, ebp);
534 set_dispr(disp, rmode); 543 set_dispr(disp, rmode);
535 } 544 }
536 545
537 } } // namespace v8::internal 546 } } // namespace v8::internal
538 547
539 #endif // V8_IA32_ASSEMBLER_IA32_INL_H_ 548 #endif // V8_IA32_ASSEMBLER_IA32_INL_H_
OLDNEW
« no previous file with comments | « src/ia32/assembler-ia32.cc ('k') | src/ia32/builtins-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698