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

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

Issue 1005183006: Serializer: serialize internal references via object visitor. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: fix compilation Created 5 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
« no previous file with comments | « src/x64/assembler-x64.h ('k') | test/cctest/test-serialize.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 247 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 ConstantPoolArray* constant_pool, 258 ConstantPoolArray* constant_pool,
259 Address target, 259 Address target,
260 ICacheFlushMode icache_flush_mode) { 260 ICacheFlushMode icache_flush_mode) {
261 Memory::int32_at(pc) = static_cast<int32_t>(target - pc - 4); 261 Memory::int32_at(pc) = static_cast<int32_t>(target - pc - 4);
262 if (icache_flush_mode != SKIP_ICACHE_FLUSH) { 262 if (icache_flush_mode != SKIP_ICACHE_FLUSH) {
263 CpuFeatures::FlushICache(pc, sizeof(int32_t)); 263 CpuFeatures::FlushICache(pc, sizeof(int32_t));
264 } 264 }
265 } 265 }
266 266
267 267
268 void Assembler::deserialization_set_target_internal_reference_at(
269 Address pc, Address target) {
270 Memory::Address_at(pc) = target;
271 }
272
273
268 Address Assembler::target_address_from_return_address(Address pc) { 274 Address Assembler::target_address_from_return_address(Address pc) {
269 return pc - kCallTargetAddressOffset; 275 return pc - kCallTargetAddressOffset;
270 } 276 }
271 277
272 278
273 Address Assembler::break_address_from_return_address(Address pc) { 279 Address Assembler::break_address_from_return_address(Address pc) {
274 return pc - Assembler::kPatchDebugBreakSlotReturnOffset; 280 return pc - Assembler::kPatchDebugBreakSlotReturnOffset;
275 } 281 }
276 282
277 283
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
371 return Memory::Address_at(pc_); 377 return Memory::Address_at(pc_);
372 } 378 }
373 379
374 380
375 Address RelocInfo::target_internal_reference() { 381 Address RelocInfo::target_internal_reference() {
376 DCHECK(rmode_ == INTERNAL_REFERENCE); 382 DCHECK(rmode_ == INTERNAL_REFERENCE);
377 return Memory::Address_at(pc_); 383 return Memory::Address_at(pc_);
378 } 384 }
379 385
380 386
381 void RelocInfo::set_target_internal_reference(Address target) { 387 Address RelocInfo::target_internal_reference_address() {
382 DCHECK(rmode_ == INTERNAL_REFERENCE); 388 DCHECK(rmode_ == INTERNAL_REFERENCE);
383 Memory::Address_at(pc_) = target; 389 return reinterpret_cast<Address>(pc_);
384 } 390 }
385 391
386 392
387 void RelocInfo::set_target_object(Object* target, 393 void RelocInfo::set_target_object(Object* target,
388 WriteBarrierMode write_barrier_mode, 394 WriteBarrierMode write_barrier_mode,
389 ICacheFlushMode icache_flush_mode) { 395 ICacheFlushMode icache_flush_mode) {
390 DCHECK(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT); 396 DCHECK(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT);
391 Memory::Object_at(pc_) = target; 397 Memory::Object_at(pc_) = target;
392 if (icache_flush_mode != SKIP_ICACHE_FLUSH) { 398 if (icache_flush_mode != SKIP_ICACHE_FLUSH) {
393 CpuFeatures::FlushICache(pc_, sizeof(Address)); 399 CpuFeatures::FlushICache(pc_, sizeof(Address));
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
443 host() != NULL) { 449 host() != NULL) {
444 // TODO(1550) We are passing NULL as a slot because cell can never be on 450 // TODO(1550) We are passing NULL as a slot because cell can never be on
445 // evacuation candidate. 451 // evacuation candidate.
446 host()->GetHeap()->incremental_marking()->RecordWrite( 452 host()->GetHeap()->incremental_marking()->RecordWrite(
447 host(), NULL, cell); 453 host(), NULL, cell);
448 } 454 }
449 } 455 }
450 456
451 457
452 void RelocInfo::WipeOut() { 458 void RelocInfo::WipeOut() {
453 if (IsEmbeddedObject(rmode_) || IsExternalReference(rmode_)) { 459 if (IsEmbeddedObject(rmode_) || IsExternalReference(rmode_) ||
460 IsInternalReference(rmode_)) {
454 Memory::Address_at(pc_) = NULL; 461 Memory::Address_at(pc_) = NULL;
455 } else if (IsCodeTarget(rmode_) || IsRuntimeEntry(rmode_)) { 462 } else if (IsCodeTarget(rmode_) || IsRuntimeEntry(rmode_)) {
456 // Effectively write zero into the relocation. 463 // Effectively write zero into the relocation.
457 Assembler::set_target_address_at(pc_, host_, pc_ + sizeof(int32_t)); 464 Assembler::set_target_address_at(pc_, host_, pc_ + sizeof(int32_t));
458 } else { 465 } else {
459 UNREACHABLE(); 466 UNREACHABLE();
460 } 467 }
461 } 468 }
462 469
463 470
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
547 RelocInfo::Mode mode = rmode(); 554 RelocInfo::Mode mode = rmode();
548 if (mode == RelocInfo::EMBEDDED_OBJECT) { 555 if (mode == RelocInfo::EMBEDDED_OBJECT) {
549 visitor->VisitEmbeddedPointer(this); 556 visitor->VisitEmbeddedPointer(this);
550 CpuFeatures::FlushICache(pc_, sizeof(Address)); 557 CpuFeatures::FlushICache(pc_, sizeof(Address));
551 } else if (RelocInfo::IsCodeTarget(mode)) { 558 } else if (RelocInfo::IsCodeTarget(mode)) {
552 visitor->VisitCodeTarget(this); 559 visitor->VisitCodeTarget(this);
553 } else if (mode == RelocInfo::CELL) { 560 } else if (mode == RelocInfo::CELL) {
554 visitor->VisitCell(this); 561 visitor->VisitCell(this);
555 } else if (mode == RelocInfo::EXTERNAL_REFERENCE) { 562 } else if (mode == RelocInfo::EXTERNAL_REFERENCE) {
556 visitor->VisitExternalReference(this); 563 visitor->VisitExternalReference(this);
557 CpuFeatures::FlushICache(pc_, sizeof(Address)); 564 } else if (mode == RelocInfo::INTERNAL_REFERENCE) {
565 visitor->VisitInternalReference(this);
558 } else if (RelocInfo::IsCodeAgeSequence(mode)) { 566 } else if (RelocInfo::IsCodeAgeSequence(mode)) {
559 visitor->VisitCodeAgeSequence(this); 567 visitor->VisitCodeAgeSequence(this);
560 } else if (((RelocInfo::IsJSReturn(mode) && 568 } else if (((RelocInfo::IsJSReturn(mode) &&
561 IsPatchedReturnSequence()) || 569 IsPatchedReturnSequence()) ||
562 (RelocInfo::IsDebugBreakSlot(mode) && 570 (RelocInfo::IsDebugBreakSlot(mode) &&
563 IsPatchedDebugBreakSlotSequence())) && 571 IsPatchedDebugBreakSlotSequence())) &&
564 isolate->debug()->has_break_points()) { 572 isolate->debug()->has_break_points()) {
565 visitor->VisitDebugTarget(this); 573 visitor->VisitDebugTarget(this);
566 } else if (RelocInfo::IsRuntimeEntry(mode)) { 574 } else if (RelocInfo::IsRuntimeEntry(mode)) {
567 visitor->VisitRuntimeEntry(this); 575 visitor->VisitRuntimeEntry(this);
568 } 576 }
569 } 577 }
570 578
571 579
572 template<typename StaticVisitor> 580 template<typename StaticVisitor>
573 void RelocInfo::Visit(Heap* heap) { 581 void RelocInfo::Visit(Heap* heap) {
574 RelocInfo::Mode mode = rmode(); 582 RelocInfo::Mode mode = rmode();
575 if (mode == RelocInfo::EMBEDDED_OBJECT) { 583 if (mode == RelocInfo::EMBEDDED_OBJECT) {
576 StaticVisitor::VisitEmbeddedPointer(heap, this); 584 StaticVisitor::VisitEmbeddedPointer(heap, this);
577 CpuFeatures::FlushICache(pc_, sizeof(Address)); 585 CpuFeatures::FlushICache(pc_, sizeof(Address));
578 } else if (RelocInfo::IsCodeTarget(mode)) { 586 } else if (RelocInfo::IsCodeTarget(mode)) {
579 StaticVisitor::VisitCodeTarget(heap, this); 587 StaticVisitor::VisitCodeTarget(heap, this);
580 } else if (mode == RelocInfo::CELL) { 588 } else if (mode == RelocInfo::CELL) {
581 StaticVisitor::VisitCell(heap, this); 589 StaticVisitor::VisitCell(heap, this);
582 } else if (mode == RelocInfo::EXTERNAL_REFERENCE) { 590 } else if (mode == RelocInfo::EXTERNAL_REFERENCE) {
583 StaticVisitor::VisitExternalReference(this); 591 StaticVisitor::VisitExternalReference(this);
584 CpuFeatures::FlushICache(pc_, sizeof(Address)); 592 } else if (mode == RelocInfo::INTERNAL_REFERENCE) {
593 StaticVisitor::VisitInternalReference(this);
585 } else if (RelocInfo::IsCodeAgeSequence(mode)) { 594 } else if (RelocInfo::IsCodeAgeSequence(mode)) {
586 StaticVisitor::VisitCodeAgeSequence(heap, this); 595 StaticVisitor::VisitCodeAgeSequence(heap, this);
587 } else if (heap->isolate()->debug()->has_break_points() && 596 } else if (heap->isolate()->debug()->has_break_points() &&
588 ((RelocInfo::IsJSReturn(mode) && 597 ((RelocInfo::IsJSReturn(mode) &&
589 IsPatchedReturnSequence()) || 598 IsPatchedReturnSequence()) ||
590 (RelocInfo::IsDebugBreakSlot(mode) && 599 (RelocInfo::IsDebugBreakSlot(mode) &&
591 IsPatchedDebugBreakSlotSequence()))) { 600 IsPatchedDebugBreakSlotSequence()))) {
592 StaticVisitor::VisitDebugTarget(heap, this); 601 StaticVisitor::VisitDebugTarget(heap, this);
593 } else if (RelocInfo::IsRuntimeEntry(mode)) { 602 } else if (RelocInfo::IsRuntimeEntry(mode)) {
594 StaticVisitor::VisitRuntimeEntry(this); 603 StaticVisitor::VisitRuntimeEntry(this);
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
635 644
636 void Operand::set_disp64(int64_t disp) { 645 void Operand::set_disp64(int64_t disp) {
637 DCHECK_EQ(1, len_); 646 DCHECK_EQ(1, len_);
638 int64_t* p = reinterpret_cast<int64_t*>(&buf_[len_]); 647 int64_t* p = reinterpret_cast<int64_t*>(&buf_[len_]);
639 *p = disp; 648 *p = disp;
640 len_ += sizeof(disp); 649 len_ += sizeof(disp);
641 } 650 }
642 } } // namespace v8::internal 651 } } // namespace v8::internal
643 652
644 #endif // V8_X64_ASSEMBLER_X64_INL_H_ 653 #endif // V8_X64_ASSEMBLER_X64_INL_H_
OLDNEW
« no previous file with comments | « src/x64/assembler-x64.h ('k') | test/cctest/test-serialize.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698