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

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

Issue 887013003: [x64] Assembler support for internal references and RIP relative addressing. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 10 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/x64/assembler-x64.cc ('k') | src/x64/disasm-x64.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 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
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
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_
OLDNEW
« no previous file with comments | « src/x64/assembler-x64.cc ('k') | src/x64/disasm-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698