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

Side by Side Diff: src/x64/assembler-x64.cc

Issue 146021: X64 implementation: Change argument to relocator to take a 64-bit delta. Cha... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 11 years, 6 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/x64/assembler-x64.h ('k') | src/x64/assembler-x64-inl.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 2009 the V8 project authors. All rights reserved. 1 // Copyright 2009 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after
334 desc.instr_size = pc_offset(); 334 desc.instr_size = pc_offset();
335 desc.reloc_size = (buffer_ + buffer_size_) - (reloc_info_writer.pos()); 335 desc.reloc_size = (buffer_ + buffer_size_) - (reloc_info_writer.pos());
336 336
337 // Clear the buffer in debug mode. Use 'int3' instructions to make 337 // Clear the buffer in debug mode. Use 'int3' instructions to make
338 // sure to get into problems if we ever run uninitialized code. 338 // sure to get into problems if we ever run uninitialized code.
339 #ifdef DEBUG 339 #ifdef DEBUG
340 memset(desc.buffer, 0xCC, desc.buffer_size); 340 memset(desc.buffer, 0xCC, desc.buffer_size);
341 #endif 341 #endif
342 342
343 // copy the data 343 // copy the data
344 int pc_delta = desc.buffer - buffer_; 344 intptr_t pc_delta = desc.buffer - buffer_;
345 int rc_delta = (desc.buffer + desc.buffer_size) - (buffer_ + buffer_size_); 345 intptr_t rc_delta = (desc.buffer + desc.buffer_size) -
346 (buffer_ + buffer_size_);
346 memmove(desc.buffer, buffer_, desc.instr_size); 347 memmove(desc.buffer, buffer_, desc.instr_size);
347 memmove(rc_delta + reloc_info_writer.pos(), 348 memmove(rc_delta + reloc_info_writer.pos(),
348 reloc_info_writer.pos(), desc.reloc_size); 349 reloc_info_writer.pos(), desc.reloc_size);
349 350
350 // switch buffers 351 // switch buffers
351 if (spare_buffer_ == NULL && buffer_size_ == kMinimalBufferSize) { 352 if (spare_buffer_ == NULL && buffer_size_ == kMinimalBufferSize) {
352 spare_buffer_ = buffer_; 353 spare_buffer_ = buffer_;
353 } else { 354 } else {
354 DeleteArray(buffer_); 355 DeleteArray(buffer_);
355 } 356 }
356 buffer_ = desc.buffer; 357 buffer_ = desc.buffer;
357 buffer_size_ = desc.buffer_size; 358 buffer_size_ = desc.buffer_size;
358 pc_ += pc_delta; 359 pc_ += pc_delta;
359 if (last_pc_ != NULL) { 360 if (last_pc_ != NULL) {
360 last_pc_ += pc_delta; 361 last_pc_ += pc_delta;
361 } 362 }
362 reloc_info_writer.Reposition(reloc_info_writer.pos() + rc_delta, 363 reloc_info_writer.Reposition(reloc_info_writer.pos() + rc_delta,
363 reloc_info_writer.last_pc() + pc_delta); 364 reloc_info_writer.last_pc() + pc_delta);
364 365
365 // relocate runtime entries 366 // relocate runtime entries
366 for (RelocIterator it(desc); !it.done(); it.next()) { 367 for (RelocIterator it(desc); !it.done(); it.next()) {
367 RelocInfo::Mode rmode = it.rinfo()->rmode(); 368 RelocInfo::Mode rmode = it.rinfo()->rmode();
368 if (rmode == RelocInfo::RUNTIME_ENTRY) { 369 if (rmode == RelocInfo::INTERNAL_REFERENCE) {
369 int32_t* p = reinterpret_cast<int32_t*>(it.rinfo()->pc()); 370 intptr_t* p = reinterpret_cast<intptr_t*>(it.rinfo()->pc());
370 *p -= pc_delta; // relocate entry
371 } else if (rmode == RelocInfo::INTERNAL_REFERENCE) {
372 int32_t* p = reinterpret_cast<int32_t*>(it.rinfo()->pc());
373 if (*p != 0) { // 0 means uninitialized. 371 if (*p != 0) { // 0 means uninitialized.
374 *p += pc_delta; 372 *p += pc_delta;
375 } 373 }
376 } 374 }
377 } 375 }
378 376
379 ASSERT(!overflow()); 377 ASSERT(!overflow());
380 } 378 }
381 379
382 380
(...skipping 1435 matching lines...) Expand 10 before | Expand all | Expand 10 after
1818 // also different from the written statement position. 1816 // also different from the written statement position.
1819 if (current_position_ != written_position_ && 1817 if (current_position_ != written_position_ &&
1820 current_position_ != written_statement_position_) { 1818 current_position_ != written_statement_position_) {
1821 EnsureSpace ensure_space(this); 1819 EnsureSpace ensure_space(this);
1822 RecordRelocInfo(RelocInfo::POSITION, current_position_); 1820 RecordRelocInfo(RelocInfo::POSITION, current_position_);
1823 written_position_ = current_position_; 1821 written_position_ = current_position_;
1824 } 1822 }
1825 } 1823 }
1826 1824
1827 1825
1828 const int RelocInfo::kApplyMask = 1826 const int RelocInfo::kApplyMask = 1 << RelocInfo::INTERNAL_REFERENCE;
1829 RelocInfo::kCodeTargetMask | 1 << RelocInfo::RUNTIME_ENTRY |
1830 1 << RelocInfo::JS_RETURN | 1 << RelocInfo::INTERNAL_REFERENCE;
1831 1827
1832 1828
1833 } } // namespace v8::internal 1829 } } // namespace v8::internal
1834 1830
1835 1831
1836 // TODO(x64): Implement and move these to their correct cc-files: 1832 // TODO(x64): Implement and move these to their correct cc-files:
1837 #include "ast.h" 1833 #include "ast.h"
1838 #include "bootstrapper.h" 1834 #include "bootstrapper.h"
1839 #include "codegen-inl.h" 1835 #include "codegen-inl.h"
1840 #include "cpu.h" 1836 #include "cpu.h"
(...skipping 28 matching lines...) Expand all
1869 bool BreakLocationIterator::IsDebugBreakAtReturn() { 1865 bool BreakLocationIterator::IsDebugBreakAtReturn() {
1870 UNIMPLEMENTED(); 1866 UNIMPLEMENTED();
1871 return false; 1867 return false;
1872 } 1868 }
1873 1869
1874 void BreakLocationIterator::SetDebugBreakAtReturn() { 1870 void BreakLocationIterator::SetDebugBreakAtReturn() {
1875 UNIMPLEMENTED(); 1871 UNIMPLEMENTED();
1876 } 1872 }
1877 1873
1878 } } // namespace v8::internal 1874 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/x64/assembler-x64.h ('k') | src/x64/assembler-x64-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698