OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef V8_X64_ASSEMBLER_X64_INL_H_ | 5 #ifndef V8_X64_ASSEMBLER_X64_INL_H_ |
6 #define V8_X64_ASSEMBLER_X64_INL_H_ | 6 #define V8_X64_ASSEMBLER_X64_INL_H_ |
7 | 7 |
8 #include "src/x64/assembler-x64.h" | 8 #include "src/x64/assembler-x64.h" |
9 | 9 |
10 #include "src/base/cpu.h" | 10 #include "src/base/cpu.h" |
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
285 } | 285 } |
286 | 286 |
287 // ----------------------------------------------------------------------------- | 287 // ----------------------------------------------------------------------------- |
288 // Implementation of RelocInfo | 288 // Implementation of RelocInfo |
289 | 289 |
290 // The modes possibly affected by apply must be in kApplyMask. | 290 // The modes possibly affected by apply must be in kApplyMask. |
291 void RelocInfo::apply(intptr_t delta, ICacheFlushMode icache_flush_mode) { | 291 void RelocInfo::apply(intptr_t delta, ICacheFlushMode icache_flush_mode) { |
292 bool flush_icache = icache_flush_mode != SKIP_ICACHE_FLUSH; | 292 bool flush_icache = icache_flush_mode != SKIP_ICACHE_FLUSH; |
293 if (IsInternalReference(rmode_)) { | 293 if (IsInternalReference(rmode_)) { |
294 // absolute code pointer inside code object moves with the code object. | 294 // absolute code pointer inside code object moves with the code object. |
295 Memory::Address_at(pc_) += static_cast<int32_t>(delta); | 295 Memory::Address_at(pc_) += delta; |
296 if (flush_icache) CpuFeatures::FlushICache(pc_, sizeof(Address)); | 296 if (flush_icache) CpuFeatures::FlushICache(pc_, sizeof(Address)); |
297 } else if (IsCodeTarget(rmode_) || IsRuntimeEntry(rmode_)) { | 297 } else if (IsCodeTarget(rmode_) || IsRuntimeEntry(rmode_)) { |
298 Memory::int32_at(pc_) -= static_cast<int32_t>(delta); | 298 Memory::int32_at(pc_) -= static_cast<int32_t>(delta); |
299 if (flush_icache) CpuFeatures::FlushICache(pc_, sizeof(int32_t)); | 299 if (flush_icache) CpuFeatures::FlushICache(pc_, sizeof(int32_t)); |
300 } else if (rmode_ == CODE_AGE_SEQUENCE) { | 300 } else if (rmode_ == CODE_AGE_SEQUENCE) { |
301 if (*pc_ == kCallOpcode) { | 301 if (*pc_ == kCallOpcode) { |
302 int32_t* p = reinterpret_cast<int32_t*>(pc_ + 1); | 302 int32_t* p = reinterpret_cast<int32_t*>(pc_ + 1); |
303 *p -= static_cast<int32_t>(delta); // Relocate entry. | 303 *p -= static_cast<int32_t>(delta); // Relocate entry. |
304 if (flush_icache) CpuFeatures::FlushICache(p, sizeof(uint32_t)); | 304 if (flush_icache) CpuFeatures::FlushICache(p, sizeof(uint32_t)); |
305 } | 305 } |
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
614 len_ += sizeof(int8_t); | 614 len_ += sizeof(int8_t); |
615 } | 615 } |
616 | 616 |
617 void Operand::set_disp32(int disp) { | 617 void Operand::set_disp32(int disp) { |
618 DCHECK(len_ == 1 || len_ == 2); | 618 DCHECK(len_ == 1 || len_ == 2); |
619 int32_t* p = reinterpret_cast<int32_t*>(&buf_[len_]); | 619 int32_t* p = reinterpret_cast<int32_t*>(&buf_[len_]); |
620 *p = disp; | 620 *p = disp; |
621 len_ += sizeof(int32_t); | 621 len_ += sizeof(int32_t); |
622 } | 622 } |
623 | 623 |
624 | 624 void Operand::set_disp64(int64_t disp) { |
| 625 DCHECK_EQ(1, len_); |
| 626 int64_t* p = reinterpret_cast<int64_t*>(&buf_[len_]); |
| 627 *p = disp; |
| 628 len_ += sizeof(disp); |
| 629 } |
625 } } // namespace v8::internal | 630 } } // namespace v8::internal |
626 | 631 |
627 #endif // V8_X64_ASSEMBLER_X64_INL_H_ | 632 #endif // V8_X64_ASSEMBLER_X64_INL_H_ |
OLD | NEW |