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

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: 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
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 296 matching lines...) Expand 10 before | Expand all | Expand 10 after
307 } 307 }
308 308
309 309
310 Address RelocInfo::target_address() { 310 Address RelocInfo::target_address() {
311 DCHECK(IsCodeTarget(rmode_) || IsRuntimeEntry(rmode_)); 311 DCHECK(IsCodeTarget(rmode_) || IsRuntimeEntry(rmode_));
312 return Assembler::target_address_at(pc_, host_); 312 return Assembler::target_address_at(pc_, host_);
313 } 313 }
314 314
315 315
316 Address RelocInfo::target_address_address() { 316 Address RelocInfo::target_address_address() {
317 DCHECK(IsCodeTarget(rmode_) || IsRuntimeEntry(rmode_) 317 DCHECK(IsCodeTarget(rmode_) || IsRuntimeEntry(rmode_) ||
318 || rmode_ == EMBEDDED_OBJECT 318 rmode_ == EMBEDDED_OBJECT || rmode_ == EXTERNAL_REFERENCE ||
319 || rmode_ == EXTERNAL_REFERENCE); 319 rmode_ == INTERNAL_REFERENCE);
320 return reinterpret_cast<Address>(pc_); 320 return reinterpret_cast<Address>(pc_);
321 } 321 }
322 322
323 323
324 Address RelocInfo::constant_pool_entry_address() { 324 Address RelocInfo::constant_pool_entry_address() {
325 UNREACHABLE(); 325 UNREACHABLE();
326 return NULL; 326 return NULL;
327 } 327 }
328 328
329 329
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
371 return Memory::Address_at(pc_); 371 return Memory::Address_at(pc_);
372 } 372 }
373 373
374 374
375 Address RelocInfo::target_internal_reference() { 375 Address RelocInfo::target_internal_reference() {
376 DCHECK(rmode_ == INTERNAL_REFERENCE); 376 DCHECK(rmode_ == INTERNAL_REFERENCE);
377 return Memory::Address_at(pc_); 377 return Memory::Address_at(pc_);
378 } 378 }
379 379
380 380
381 void RelocInfo::set_target_internal_reference(Address target) { 381 void Assembler::deserialization_set_target_internal_reference_at(
382 DCHECK(rmode_ == INTERNAL_REFERENCE); 382 Address instruction, Address target) {
383 Memory::Address_at(pc_) = target; 383 Memory::Address_at(instruction) = target;
384 } 384 }
385 385
386 386
387 void RelocInfo::set_target_object(Object* target, 387 void RelocInfo::set_target_object(Object* target,
388 WriteBarrierMode write_barrier_mode, 388 WriteBarrierMode write_barrier_mode,
389 ICacheFlushMode icache_flush_mode) { 389 ICacheFlushMode icache_flush_mode) {
390 DCHECK(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT); 390 DCHECK(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT);
391 Memory::Object_at(pc_) = target; 391 Memory::Object_at(pc_) = target;
392 if (icache_flush_mode != SKIP_ICACHE_FLUSH) { 392 if (icache_flush_mode != SKIP_ICACHE_FLUSH) {
393 CpuFeatures::FlushICache(pc_, sizeof(Address)); 393 CpuFeatures::FlushICache(pc_, sizeof(Address));
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
443 host() != NULL) { 443 host() != NULL) {
444 // TODO(1550) We are passing NULL as a slot because cell can never be on 444 // TODO(1550) We are passing NULL as a slot because cell can never be on
445 // evacuation candidate. 445 // evacuation candidate.
446 host()->GetHeap()->incremental_marking()->RecordWrite( 446 host()->GetHeap()->incremental_marking()->RecordWrite(
447 host(), NULL, cell); 447 host(), NULL, cell);
448 } 448 }
449 } 449 }
450 450
451 451
452 void RelocInfo::WipeOut() { 452 void RelocInfo::WipeOut() {
453 if (IsEmbeddedObject(rmode_) || IsExternalReference(rmode_)) { 453 if (IsEmbeddedObject(rmode_) || IsExternalReference(rmode_) ||
454 IsInternalReference(rmode_)) {
454 Memory::Address_at(pc_) = NULL; 455 Memory::Address_at(pc_) = NULL;
455 } else if (IsCodeTarget(rmode_) || IsRuntimeEntry(rmode_)) { 456 } else if (IsCodeTarget(rmode_) || IsRuntimeEntry(rmode_)) {
456 // Effectively write zero into the relocation. 457 // Effectively write zero into the relocation.
457 Assembler::set_target_address_at(pc_, host_, pc_ + sizeof(int32_t)); 458 Assembler::set_target_address_at(pc_, host_, pc_ + sizeof(int32_t));
458 } else { 459 } else {
459 UNREACHABLE(); 460 UNREACHABLE();
460 } 461 }
461 } 462 }
462 463
463 464
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
547 RelocInfo::Mode mode = rmode(); 548 RelocInfo::Mode mode = rmode();
548 if (mode == RelocInfo::EMBEDDED_OBJECT) { 549 if (mode == RelocInfo::EMBEDDED_OBJECT) {
549 visitor->VisitEmbeddedPointer(this); 550 visitor->VisitEmbeddedPointer(this);
550 CpuFeatures::FlushICache(pc_, sizeof(Address)); 551 CpuFeatures::FlushICache(pc_, sizeof(Address));
551 } else if (RelocInfo::IsCodeTarget(mode)) { 552 } else if (RelocInfo::IsCodeTarget(mode)) {
552 visitor->VisitCodeTarget(this); 553 visitor->VisitCodeTarget(this);
553 } else if (mode == RelocInfo::CELL) { 554 } else if (mode == RelocInfo::CELL) {
554 visitor->VisitCell(this); 555 visitor->VisitCell(this);
555 } else if (mode == RelocInfo::EXTERNAL_REFERENCE) { 556 } else if (mode == RelocInfo::EXTERNAL_REFERENCE) {
556 visitor->VisitExternalReference(this); 557 visitor->VisitExternalReference(this);
557 CpuFeatures::FlushICache(pc_, sizeof(Address)); 558 } else if (mode == RelocInfo::INTERNAL_REFERENCE) {
559 visitor->VisitInternalReference(this);
558 } else if (RelocInfo::IsCodeAgeSequence(mode)) { 560 } else if (RelocInfo::IsCodeAgeSequence(mode)) {
559 visitor->VisitCodeAgeSequence(this); 561 visitor->VisitCodeAgeSequence(this);
560 } else if (((RelocInfo::IsJSReturn(mode) && 562 } else if (((RelocInfo::IsJSReturn(mode) &&
561 IsPatchedReturnSequence()) || 563 IsPatchedReturnSequence()) ||
562 (RelocInfo::IsDebugBreakSlot(mode) && 564 (RelocInfo::IsDebugBreakSlot(mode) &&
563 IsPatchedDebugBreakSlotSequence())) && 565 IsPatchedDebugBreakSlotSequence())) &&
564 isolate->debug()->has_break_points()) { 566 isolate->debug()->has_break_points()) {
565 visitor->VisitDebugTarget(this); 567 visitor->VisitDebugTarget(this);
566 } else if (RelocInfo::IsRuntimeEntry(mode)) { 568 } else if (RelocInfo::IsRuntimeEntry(mode)) {
567 visitor->VisitRuntimeEntry(this); 569 visitor->VisitRuntimeEntry(this);
568 } 570 }
569 } 571 }
570 572
571 573
572 template<typename StaticVisitor> 574 template<typename StaticVisitor>
573 void RelocInfo::Visit(Heap* heap) { 575 void RelocInfo::Visit(Heap* heap) {
574 RelocInfo::Mode mode = rmode(); 576 RelocInfo::Mode mode = rmode();
575 if (mode == RelocInfo::EMBEDDED_OBJECT) { 577 if (mode == RelocInfo::EMBEDDED_OBJECT) {
576 StaticVisitor::VisitEmbeddedPointer(heap, this); 578 StaticVisitor::VisitEmbeddedPointer(heap, this);
577 CpuFeatures::FlushICache(pc_, sizeof(Address)); 579 CpuFeatures::FlushICache(pc_, sizeof(Address));
578 } else if (RelocInfo::IsCodeTarget(mode)) { 580 } else if (RelocInfo::IsCodeTarget(mode)) {
579 StaticVisitor::VisitCodeTarget(heap, this); 581 StaticVisitor::VisitCodeTarget(heap, this);
580 } else if (mode == RelocInfo::CELL) { 582 } else if (mode == RelocInfo::CELL) {
581 StaticVisitor::VisitCell(heap, this); 583 StaticVisitor::VisitCell(heap, this);
582 } else if (mode == RelocInfo::EXTERNAL_REFERENCE) { 584 } else if (mode == RelocInfo::EXTERNAL_REFERENCE) {
583 StaticVisitor::VisitExternalReference(this); 585 StaticVisitor::VisitExternalReference(this);
584 CpuFeatures::FlushICache(pc_, sizeof(Address)); 586 } else if (mode == RelocInfo::INTERNAL_REFERENCE) {
587 StaticVisitor::VisitInternalReference(this);
585 } else if (RelocInfo::IsCodeAgeSequence(mode)) { 588 } else if (RelocInfo::IsCodeAgeSequence(mode)) {
586 StaticVisitor::VisitCodeAgeSequence(heap, this); 589 StaticVisitor::VisitCodeAgeSequence(heap, this);
587 } else if (heap->isolate()->debug()->has_break_points() && 590 } else if (heap->isolate()->debug()->has_break_points() &&
588 ((RelocInfo::IsJSReturn(mode) && 591 ((RelocInfo::IsJSReturn(mode) &&
589 IsPatchedReturnSequence()) || 592 IsPatchedReturnSequence()) ||
590 (RelocInfo::IsDebugBreakSlot(mode) && 593 (RelocInfo::IsDebugBreakSlot(mode) &&
591 IsPatchedDebugBreakSlotSequence()))) { 594 IsPatchedDebugBreakSlotSequence()))) {
592 StaticVisitor::VisitDebugTarget(heap, this); 595 StaticVisitor::VisitDebugTarget(heap, this);
593 } else if (RelocInfo::IsRuntimeEntry(mode)) { 596 } else if (RelocInfo::IsRuntimeEntry(mode)) {
594 StaticVisitor::VisitRuntimeEntry(this); 597 StaticVisitor::VisitRuntimeEntry(this);
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
635 638
636 void Operand::set_disp64(int64_t disp) { 639 void Operand::set_disp64(int64_t disp) {
637 DCHECK_EQ(1, len_); 640 DCHECK_EQ(1, len_);
638 int64_t* p = reinterpret_cast<int64_t*>(&buf_[len_]); 641 int64_t* p = reinterpret_cast<int64_t*>(&buf_[len_]);
639 *p = disp; 642 *p = disp;
640 len_ += sizeof(disp); 643 len_ += sizeof(disp);
641 } 644 }
642 } } // namespace v8::internal 645 } } // namespace v8::internal
643 646
644 #endif // V8_X64_ASSEMBLER_X64_INL_H_ 647 #endif // V8_X64_ASSEMBLER_X64_INL_H_
OLDNEW
« src/serialize.cc ('K') | « 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