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

Side by Side Diff: src/arm/assembler-arm-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/arm/assembler-arm.cc ('k') | src/arm/builtins-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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 int32_t* p = reinterpret_cast<int32_t*>(pc_); 94 int32_t* p = reinterpret_cast<int32_t*>(pc_);
95 *p += delta; // relocate entry 95 *p += delta; // relocate entry
96 } 96 }
97 // We do not use pc relative addressing on ARM, so there is 97 // We do not use pc relative addressing on ARM, so there is
98 // nothing else to do. 98 // nothing else to do.
99 } 99 }
100 100
101 101
102 Address RelocInfo::target_address() { 102 Address RelocInfo::target_address() {
103 ASSERT(IsCodeTarget(rmode_) || IsRuntimeEntry(rmode_)); 103 ASSERT(IsCodeTarget(rmode_) || IsRuntimeEntry(rmode_));
104 return Assembler::target_address_at(pc_); 104 return Assembler::target_address_at(pc_, host_);
105 } 105 }
106 106
107 107
108 Address RelocInfo::target_address_address() { 108 Address RelocInfo::target_address_address() {
109 ASSERT(IsCodeTarget(rmode_) || IsRuntimeEntry(rmode_) 109 ASSERT(IsCodeTarget(rmode_) || IsRuntimeEntry(rmode_)
110 || rmode_ == EMBEDDED_OBJECT 110 || rmode_ == EMBEDDED_OBJECT
111 || rmode_ == EXTERNAL_REFERENCE); 111 || rmode_ == EXTERNAL_REFERENCE);
112 return Assembler::target_pointer_address_at(pc_); 112 return Assembler::target_pointer_address_at(pc_);
113 } 113 }
114 114
115 115
116 Address RelocInfo::constant_pool_entry_address() {
117 ASSERT(IsInConstantPool());
118 ASSERT(Assembler::IsLdrPcImmediateOffset(Memory::int32_at(pc_)));
119 return Assembler::target_pointer_address_at(pc_);
120 }
121
122
116 int RelocInfo::target_address_size() { 123 int RelocInfo::target_address_size() {
117 return kPointerSize; 124 return kPointerSize;
118 } 125 }
119 126
120 127
121 void RelocInfo::set_target_address(Address target, WriteBarrierMode mode) { 128 void RelocInfo::set_target_address(Address target, WriteBarrierMode mode) {
122 ASSERT(IsCodeTarget(rmode_) || IsRuntimeEntry(rmode_)); 129 ASSERT(IsCodeTarget(rmode_) || IsRuntimeEntry(rmode_));
123 Assembler::set_target_address_at(pc_, target); 130 Assembler::set_target_address_at(pc_, host_, target);
124 if (mode == UPDATE_WRITE_BARRIER && host() != NULL && IsCodeTarget(rmode_)) { 131 if (mode == UPDATE_WRITE_BARRIER && host() != NULL && IsCodeTarget(rmode_)) {
125 Object* target_code = Code::GetCodeFromTargetAddress(target); 132 Object* target_code = Code::GetCodeFromTargetAddress(target);
126 host()->GetHeap()->incremental_marking()->RecordWriteIntoCode( 133 host()->GetHeap()->incremental_marking()->RecordWriteIntoCode(
127 host(), this, HeapObject::cast(target_code)); 134 host(), this, HeapObject::cast(target_code));
128 } 135 }
129 } 136 }
130 137
131 138
132 Object* RelocInfo::target_object() { 139 Object* RelocInfo::target_object() {
133 ASSERT(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT); 140 ASSERT(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT);
134 return reinterpret_cast<Object*>(Assembler::target_address_at(pc_)); 141 return reinterpret_cast<Object*>(Assembler::target_address_at(pc_, host_));
135 } 142 }
136 143
137 144
138 Handle<Object> RelocInfo::target_object_handle(Assembler* origin) { 145 Handle<Object> RelocInfo::target_object_handle(Assembler* origin) {
139 ASSERT(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT); 146 ASSERT(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT);
140 return Handle<Object>(reinterpret_cast<Object**>( 147 return Handle<Object>(reinterpret_cast<Object**>(
141 Assembler::target_address_at(pc_))); 148 Assembler::target_address_at(pc_, host_)));
142 } 149 }
143 150
144 151
145 void RelocInfo::set_target_object(Object* target, WriteBarrierMode mode) { 152 void RelocInfo::set_target_object(Object* target, WriteBarrierMode mode) {
146 ASSERT(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT); 153 ASSERT(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT);
147 ASSERT(!target->IsConsString()); 154 ASSERT(!target->IsConsString());
148 Assembler::set_target_address_at(pc_, reinterpret_cast<Address>(target)); 155 Assembler::set_target_address_at(pc_, host_,
156 reinterpret_cast<Address>(target));
149 if (mode == UPDATE_WRITE_BARRIER && 157 if (mode == UPDATE_WRITE_BARRIER &&
150 host() != NULL && 158 host() != NULL &&
151 target->IsHeapObject()) { 159 target->IsHeapObject()) {
152 host()->GetHeap()->incremental_marking()->RecordWrite( 160 host()->GetHeap()->incremental_marking()->RecordWrite(
153 host(), &Memory::Object_at(pc_), HeapObject::cast(target)); 161 host(), &Memory::Object_at(pc_), HeapObject::cast(target));
154 } 162 }
155 } 163 }
156 164
157 165
158 Address RelocInfo::target_reference() { 166 Address RelocInfo::target_reference() {
159 ASSERT(rmode_ == EXTERNAL_REFERENCE); 167 ASSERT(rmode_ == EXTERNAL_REFERENCE);
160 return Assembler::target_address_at(pc_); 168 return Assembler::target_address_at(pc_, host_);
161 } 169 }
162 170
163 171
164 Address RelocInfo::target_runtime_entry(Assembler* origin) { 172 Address RelocInfo::target_runtime_entry(Assembler* origin) {
165 ASSERT(IsRuntimeEntry(rmode_)); 173 ASSERT(IsRuntimeEntry(rmode_));
166 return target_address(); 174 return target_address();
167 } 175 }
168 176
169 177
170 void RelocInfo::set_target_runtime_entry(Address target, 178 void RelocInfo::set_target_runtime_entry(Address target,
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 (IsDebugBreakSlot(rmode()) && IsPatchedDebugBreakSlotSequence())); 269 (IsDebugBreakSlot(rmode()) && IsPatchedDebugBreakSlotSequence()));
262 return reinterpret_cast<Object**>(pc_ + 2 * Assembler::kInstrSize); 270 return reinterpret_cast<Object**>(pc_ + 2 * Assembler::kInstrSize);
263 } 271 }
264 272
265 273
266 void RelocInfo::WipeOut() { 274 void RelocInfo::WipeOut() {
267 ASSERT(IsEmbeddedObject(rmode_) || 275 ASSERT(IsEmbeddedObject(rmode_) ||
268 IsCodeTarget(rmode_) || 276 IsCodeTarget(rmode_) ||
269 IsRuntimeEntry(rmode_) || 277 IsRuntimeEntry(rmode_) ||
270 IsExternalReference(rmode_)); 278 IsExternalReference(rmode_));
271 Assembler::set_target_address_at(pc_, NULL); 279 Assembler::set_target_address_at(pc_, host_, NULL);
272 } 280 }
273 281
274 282
275 bool RelocInfo::IsPatchedReturnSequence() { 283 bool RelocInfo::IsPatchedReturnSequence() {
276 Instr current_instr = Assembler::instr_at(pc_); 284 Instr current_instr = Assembler::instr_at(pc_);
277 Instr next_instr = Assembler::instr_at(pc_ + Assembler::kInstrSize); 285 Instr next_instr = Assembler::instr_at(pc_ + Assembler::kInstrSize);
278 // A patched return sequence is: 286 // A patched return sequence is:
279 // ldr ip, [pc, #0] 287 // ldr ip, [pc, #0]
280 // blx ip 288 // blx ip
281 return ((current_instr & kLdrPCMask) == kLdrPCPattern) 289 return ((current_instr & kLdrPCMask) == kLdrPCPattern)
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
395 pc_ += kInstrSize; 403 pc_ += kInstrSize;
396 } 404 }
397 405
398 406
399 Address Assembler::target_pointer_address_at(Address pc) { 407 Address Assembler::target_pointer_address_at(Address pc) {
400 Instr instr = Memory::int32_at(pc); 408 Instr instr = Memory::int32_at(pc);
401 return pc + GetLdrRegisterImmediateOffset(instr) + kPcLoadDelta; 409 return pc + GetLdrRegisterImmediateOffset(instr) + kPcLoadDelta;
402 } 410 }
403 411
404 412
405 Address Assembler::target_address_at(Address pc) { 413 Address Assembler::target_address_at(Address pc,
414 ConstantPoolArray* constant_pool) {
406 if (IsMovW(Memory::int32_at(pc))) { 415 if (IsMovW(Memory::int32_at(pc))) {
407 ASSERT(IsMovT(Memory::int32_at(pc + kInstrSize))); 416 ASSERT(IsMovT(Memory::int32_at(pc + kInstrSize)));
408 Instruction* instr = Instruction::At(pc); 417 Instruction* instr = Instruction::At(pc);
409 Instruction* next_instr = Instruction::At(pc + kInstrSize); 418 Instruction* next_instr = Instruction::At(pc + kInstrSize);
410 return reinterpret_cast<Address>( 419 return reinterpret_cast<Address>(
411 (next_instr->ImmedMovwMovtValue() << 16) | 420 (next_instr->ImmedMovwMovtValue() << 16) |
412 instr->ImmedMovwMovtValue()); 421 instr->ImmedMovwMovtValue());
413 } 422 }
414 ASSERT(IsLdrPcImmediateOffset(Memory::int32_at(pc))); 423 ASSERT(IsLdrPcImmediateOffset(Memory::int32_at(pc)));
415 return Memory::Address_at(target_pointer_address_at(pc)); 424 return Memory::Address_at(target_pointer_address_at(pc));
(...skipping 29 matching lines...) Expand all
445 return pc + kInstrSize * 2; 454 return pc + kInstrSize * 2;
446 } else { 455 } else {
447 ASSERT(IsMovW(Memory::int32_at(pc))); 456 ASSERT(IsMovW(Memory::int32_at(pc)));
448 ASSERT(IsMovT(Memory::int32_at(pc + kInstrSize))); 457 ASSERT(IsMovT(Memory::int32_at(pc + kInstrSize)));
449 return pc + kInstrSize * 3; 458 return pc + kInstrSize * 3;
450 } 459 }
451 } 460 }
452 461
453 462
454 void Assembler::deserialization_set_special_target_at( 463 void Assembler::deserialization_set_special_target_at(
455 Address constant_pool_entry, Address target) { 464 Address constant_pool_entry, Code* code, Address target) {
456 Memory::Address_at(constant_pool_entry) = target; 465 Memory::Address_at(constant_pool_entry) = target;
457 } 466 }
458 467
459 468
460 static Instr EncodeMovwImmediate(uint32_t immediate) { 469 static Instr EncodeMovwImmediate(uint32_t immediate) {
461 ASSERT(immediate < 0x10000); 470 ASSERT(immediate < 0x10000);
462 return ((immediate & 0xf000) << 4) | (immediate & 0xfff); 471 return ((immediate & 0xf000) << 4) | (immediate & 0xfff);
463 } 472 }
464 473
465 474
466 void Assembler::set_target_address_at(Address pc, Address target) { 475 void Assembler::set_target_address_at(Address pc,
476 ConstantPoolArray* constant_pool,
477 Address target) {
467 if (IsMovW(Memory::int32_at(pc))) { 478 if (IsMovW(Memory::int32_at(pc))) {
468 ASSERT(IsMovT(Memory::int32_at(pc + kInstrSize))); 479 ASSERT(IsMovT(Memory::int32_at(pc + kInstrSize)));
469 uint32_t* instr_ptr = reinterpret_cast<uint32_t*>(pc); 480 uint32_t* instr_ptr = reinterpret_cast<uint32_t*>(pc);
470 uint32_t immediate = reinterpret_cast<uint32_t>(target); 481 uint32_t immediate = reinterpret_cast<uint32_t>(target);
471 uint32_t intermediate = instr_ptr[0]; 482 uint32_t intermediate = instr_ptr[0];
472 intermediate &= ~EncodeMovwImmediate(0xFFFF); 483 intermediate &= ~EncodeMovwImmediate(0xFFFF);
473 intermediate |= EncodeMovwImmediate(immediate & 0xFFFF); 484 intermediate |= EncodeMovwImmediate(immediate & 0xFFFF);
474 instr_ptr[0] = intermediate; 485 instr_ptr[0] = intermediate;
475 intermediate = instr_ptr[1]; 486 intermediate = instr_ptr[1];
476 intermediate &= ~EncodeMovwImmediate(0xFFFF); 487 intermediate &= ~EncodeMovwImmediate(0xFFFF);
(...skipping 13 matching lines...) Expand all
490 // ldr ip, [pc, #...] 501 // ldr ip, [pc, #...]
491 // since the instruction accessing this address in the constant pool remains 502 // since the instruction accessing this address in the constant pool remains
492 // unchanged. 503 // unchanged.
493 } 504 }
494 } 505 }
495 506
496 507
497 } } // namespace v8::internal 508 } } // namespace v8::internal
498 509
499 #endif // V8_ARM_ASSEMBLER_ARM_INL_H_ 510 #endif // V8_ARM_ASSEMBLER_ARM_INL_H_
OLDNEW
« no previous file with comments | « src/arm/assembler-arm.cc ('k') | src/arm/builtins-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698