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

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

Issue 1332283002: Make FlushICache part of Assembler(Base) and take Isolate as parameter. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix arm64 PatchingAssembler that initialized its isolate with NULL :) Created 5 years, 3 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/snapshot/serialize.cc ('k') | src/x64/code-stubs-x64.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 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 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 Address Assembler::target_address_at(Address pc, Address constant_pool) { 270 Address Assembler::target_address_at(Address pc, Address constant_pool) {
271 return Memory::int32_at(pc) + pc + 4; 271 return Memory::int32_at(pc) + pc + 4;
272 } 272 }
273 273
274 274
275 void Assembler::set_target_address_at(Address pc, Address constant_pool, 275 void Assembler::set_target_address_at(Address pc, Address constant_pool,
276 Address target, 276 Address target,
277 ICacheFlushMode icache_flush_mode) { 277 ICacheFlushMode icache_flush_mode) {
278 Memory::int32_at(pc) = static_cast<int32_t>(target - pc - 4); 278 Memory::int32_at(pc) = static_cast<int32_t>(target - pc - 4);
279 if (icache_flush_mode != SKIP_ICACHE_FLUSH) { 279 if (icache_flush_mode != SKIP_ICACHE_FLUSH) {
280 CpuFeatures::FlushICache(pc, sizeof(int32_t)); 280 Assembler::FlushICacheWithoutIsolate(pc, sizeof(int32_t));
281 } 281 }
282 } 282 }
283 283
284 284
285 void Assembler::deserialization_set_target_internal_reference_at( 285 void Assembler::deserialization_set_target_internal_reference_at(
286 Address pc, Address target, RelocInfo::Mode mode) { 286 Address pc, Address target, RelocInfo::Mode mode) {
287 Memory::Address_at(pc) = target; 287 Memory::Address_at(pc) = target;
288 } 288 }
289 289
290 290
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
397 return reinterpret_cast<Address>(pc_); 397 return reinterpret_cast<Address>(pc_);
398 } 398 }
399 399
400 400
401 void RelocInfo::set_target_object(Object* target, 401 void RelocInfo::set_target_object(Object* target,
402 WriteBarrierMode write_barrier_mode, 402 WriteBarrierMode write_barrier_mode,
403 ICacheFlushMode icache_flush_mode) { 403 ICacheFlushMode icache_flush_mode) {
404 DCHECK(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT); 404 DCHECK(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT);
405 Memory::Object_at(pc_) = target; 405 Memory::Object_at(pc_) = target;
406 if (icache_flush_mode != SKIP_ICACHE_FLUSH) { 406 if (icache_flush_mode != SKIP_ICACHE_FLUSH) {
407 CpuFeatures::FlushICache(pc_, sizeof(Address)); 407 Assembler::FlushICacheWithoutIsolate(pc_, sizeof(Address));
408 } 408 }
409 if (write_barrier_mode == UPDATE_WRITE_BARRIER && 409 if (write_barrier_mode == UPDATE_WRITE_BARRIER &&
410 host() != NULL && 410 host() != NULL &&
411 target->IsHeapObject()) { 411 target->IsHeapObject()) {
412 host()->GetHeap()->incremental_marking()->RecordWrite( 412 host()->GetHeap()->incremental_marking()->RecordWrite(
413 host(), &Memory::Object_at(pc_), HeapObject::cast(target)); 413 host(), &Memory::Object_at(pc_), HeapObject::cast(target));
414 } 414 }
415 } 415 }
416 416
417 417
(...skipping 26 matching lines...) Expand all
444 } 444 }
445 445
446 446
447 void RelocInfo::set_target_cell(Cell* cell, 447 void RelocInfo::set_target_cell(Cell* cell,
448 WriteBarrierMode write_barrier_mode, 448 WriteBarrierMode write_barrier_mode,
449 ICacheFlushMode icache_flush_mode) { 449 ICacheFlushMode icache_flush_mode) {
450 DCHECK(rmode_ == RelocInfo::CELL); 450 DCHECK(rmode_ == RelocInfo::CELL);
451 Address address = cell->address() + Cell::kValueOffset; 451 Address address = cell->address() + Cell::kValueOffset;
452 Memory::Address_at(pc_) = address; 452 Memory::Address_at(pc_) = address;
453 if (icache_flush_mode != SKIP_ICACHE_FLUSH) { 453 if (icache_flush_mode != SKIP_ICACHE_FLUSH) {
454 CpuFeatures::FlushICache(pc_, sizeof(Address)); 454 Assembler::FlushICacheWithoutIsolate(pc_, sizeof(Address));
455 } 455 }
456 if (write_barrier_mode == UPDATE_WRITE_BARRIER && 456 if (write_barrier_mode == UPDATE_WRITE_BARRIER &&
457 host() != NULL) { 457 host() != NULL) {
458 // TODO(1550) We are passing NULL as a slot because cell can never be on 458 // TODO(1550) We are passing NULL as a slot because cell can never be on
459 // evacuation candidate. 459 // evacuation candidate.
460 host()->GetHeap()->incremental_marking()->RecordWrite( 460 host()->GetHeap()->incremental_marking()->RecordWrite(
461 host(), NULL, cell); 461 host(), NULL, cell);
462 } 462 }
463 } 463 }
464 464
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
520 Address RelocInfo::debug_call_address() { 520 Address RelocInfo::debug_call_address() {
521 DCHECK(IsDebugBreakSlot(rmode()) && IsPatchedDebugBreakSlotSequence()); 521 DCHECK(IsDebugBreakSlot(rmode()) && IsPatchedDebugBreakSlotSequence());
522 return Memory::Address_at(pc_ + Assembler::kPatchDebugBreakSlotAddressOffset); 522 return Memory::Address_at(pc_ + Assembler::kPatchDebugBreakSlotAddressOffset);
523 } 523 }
524 524
525 525
526 void RelocInfo::set_debug_call_address(Address target) { 526 void RelocInfo::set_debug_call_address(Address target) {
527 DCHECK(IsDebugBreakSlot(rmode()) && IsPatchedDebugBreakSlotSequence()); 527 DCHECK(IsDebugBreakSlot(rmode()) && IsPatchedDebugBreakSlotSequence());
528 Memory::Address_at(pc_ + Assembler::kPatchDebugBreakSlotAddressOffset) = 528 Memory::Address_at(pc_ + Assembler::kPatchDebugBreakSlotAddressOffset) =
529 target; 529 target;
530 CpuFeatures::FlushICache(pc_ + Assembler::kPatchDebugBreakSlotAddressOffset, 530 Assembler::FlushICacheWithoutIsolate(
531 sizeof(Address)); 531 pc_ + Assembler::kPatchDebugBreakSlotAddressOffset, sizeof(Address));
532 if (host() != NULL) { 532 if (host() != NULL) {
533 Object* target_code = Code::GetCodeFromTargetAddress(target); 533 Object* target_code = Code::GetCodeFromTargetAddress(target);
534 host()->GetHeap()->incremental_marking()->RecordWriteIntoCode( 534 host()->GetHeap()->incremental_marking()->RecordWriteIntoCode(
535 host(), this, HeapObject::cast(target_code)); 535 host(), this, HeapObject::cast(target_code));
536 } 536 }
537 } 537 }
538 538
539 539
540 void RelocInfo::Visit(Isolate* isolate, ObjectVisitor* visitor) { 540 void RelocInfo::Visit(Isolate* isolate, ObjectVisitor* visitor) {
541 RelocInfo::Mode mode = rmode(); 541 RelocInfo::Mode mode = rmode();
542 if (mode == RelocInfo::EMBEDDED_OBJECT) { 542 if (mode == RelocInfo::EMBEDDED_OBJECT) {
543 visitor->VisitEmbeddedPointer(this); 543 visitor->VisitEmbeddedPointer(this);
544 CpuFeatures::FlushICache(pc_, sizeof(Address)); 544 Assembler::FlushICacheWithoutIsolate(pc_, sizeof(Address));
545 } else if (RelocInfo::IsCodeTarget(mode)) { 545 } else if (RelocInfo::IsCodeTarget(mode)) {
546 visitor->VisitCodeTarget(this); 546 visitor->VisitCodeTarget(this);
547 } else if (mode == RelocInfo::CELL) { 547 } else if (mode == RelocInfo::CELL) {
548 visitor->VisitCell(this); 548 visitor->VisitCell(this);
549 } else if (mode == RelocInfo::EXTERNAL_REFERENCE) { 549 } else if (mode == RelocInfo::EXTERNAL_REFERENCE) {
550 visitor->VisitExternalReference(this); 550 visitor->VisitExternalReference(this);
551 } else if (mode == RelocInfo::INTERNAL_REFERENCE) { 551 } else if (mode == RelocInfo::INTERNAL_REFERENCE) {
552 visitor->VisitInternalReference(this); 552 visitor->VisitInternalReference(this);
553 } else if (RelocInfo::IsCodeAgeSequence(mode)) { 553 } else if (RelocInfo::IsCodeAgeSequence(mode)) {
554 visitor->VisitCodeAgeSequence(this); 554 visitor->VisitCodeAgeSequence(this);
555 } else if (RelocInfo::IsDebugBreakSlot(mode) && 555 } else if (RelocInfo::IsDebugBreakSlot(mode) &&
556 IsPatchedDebugBreakSlotSequence()) { 556 IsPatchedDebugBreakSlotSequence()) {
557 visitor->VisitDebugTarget(this); 557 visitor->VisitDebugTarget(this);
558 } else if (RelocInfo::IsRuntimeEntry(mode)) { 558 } else if (RelocInfo::IsRuntimeEntry(mode)) {
559 visitor->VisitRuntimeEntry(this); 559 visitor->VisitRuntimeEntry(this);
560 } 560 }
561 } 561 }
562 562
563 563
564 template<typename StaticVisitor> 564 template<typename StaticVisitor>
565 void RelocInfo::Visit(Heap* heap) { 565 void RelocInfo::Visit(Heap* heap) {
566 RelocInfo::Mode mode = rmode(); 566 RelocInfo::Mode mode = rmode();
567 if (mode == RelocInfo::EMBEDDED_OBJECT) { 567 if (mode == RelocInfo::EMBEDDED_OBJECT) {
568 StaticVisitor::VisitEmbeddedPointer(heap, this); 568 StaticVisitor::VisitEmbeddedPointer(heap, this);
569 CpuFeatures::FlushICache(pc_, sizeof(Address)); 569 Assembler::FlushICache(heap->isolate(), pc_, sizeof(Address));
570 } else if (RelocInfo::IsCodeTarget(mode)) { 570 } else if (RelocInfo::IsCodeTarget(mode)) {
571 StaticVisitor::VisitCodeTarget(heap, this); 571 StaticVisitor::VisitCodeTarget(heap, this);
572 } else if (mode == RelocInfo::CELL) { 572 } else if (mode == RelocInfo::CELL) {
573 StaticVisitor::VisitCell(heap, this); 573 StaticVisitor::VisitCell(heap, this);
574 } else if (mode == RelocInfo::EXTERNAL_REFERENCE) { 574 } else if (mode == RelocInfo::EXTERNAL_REFERENCE) {
575 StaticVisitor::VisitExternalReference(this); 575 StaticVisitor::VisitExternalReference(this);
576 } else if (mode == RelocInfo::INTERNAL_REFERENCE) { 576 } else if (mode == RelocInfo::INTERNAL_REFERENCE) {
577 StaticVisitor::VisitInternalReference(this); 577 StaticVisitor::VisitInternalReference(this);
578 } else if (RelocInfo::IsCodeAgeSequence(mode)) { 578 } else if (RelocInfo::IsCodeAgeSequence(mode)) {
579 StaticVisitor::VisitCodeAgeSequence(heap, this); 579 StaticVisitor::VisitCodeAgeSequence(heap, this);
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
625 625
626 void Operand::set_disp64(int64_t disp) { 626 void Operand::set_disp64(int64_t disp) {
627 DCHECK_EQ(1, len_); 627 DCHECK_EQ(1, len_);
628 int64_t* p = reinterpret_cast<int64_t*>(&buf_[len_]); 628 int64_t* p = reinterpret_cast<int64_t*>(&buf_[len_]);
629 *p = disp; 629 *p = disp;
630 len_ += sizeof(disp); 630 len_ += sizeof(disp);
631 } 631 }
632 } } // namespace v8::internal 632 } } // namespace v8::internal
633 633
634 #endif // V8_X64_ASSEMBLER_X64_INL_H_ 634 #endif // V8_X64_ASSEMBLER_X64_INL_H_
OLDNEW
« no previous file with comments | « src/snapshot/serialize.cc ('k') | src/x64/code-stubs-x64.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698