| OLD | NEW |
| 1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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 #include "src/ppc/codegen-ppc.h" | 5 #include "src/ppc/codegen-ppc.h" |
| 6 | 6 |
| 7 #if V8_TARGET_ARCH_PPC | 7 #if V8_TARGET_ARCH_PPC |
| 8 | 8 |
| 9 #include "src/codegen.h" | 9 #include "src/codegen.h" |
| 10 #include "src/macro-assembler.h" | 10 #include "src/macro-assembler.h" |
| (...skipping 597 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 608 | 608 |
| 609 #undef __ | 609 #undef __ |
| 610 | 610 |
| 611 CodeAgingHelper::CodeAgingHelper(Isolate* isolate) { | 611 CodeAgingHelper::CodeAgingHelper(Isolate* isolate) { |
| 612 USE(isolate); | 612 USE(isolate); |
| 613 DCHECK(young_sequence_.length() == kNoCodeAgeSequenceLength); | 613 DCHECK(young_sequence_.length() == kNoCodeAgeSequenceLength); |
| 614 // Since patcher is a large object, allocate it dynamically when needed, | 614 // Since patcher is a large object, allocate it dynamically when needed, |
| 615 // to avoid overloading the stack in stress conditions. | 615 // to avoid overloading the stack in stress conditions. |
| 616 // DONT_FLUSH is used because the CodeAgingHelper is initialized early in | 616 // DONT_FLUSH is used because the CodeAgingHelper is initialized early in |
| 617 // the process, before ARM simulator ICache is setup. | 617 // the process, before ARM simulator ICache is setup. |
| 618 base::SmartPointer<CodePatcher> patcher(new CodePatcher( | 618 base::SmartPointer<CodePatcher> patcher( |
| 619 young_sequence_.start(), young_sequence_.length() / Assembler::kInstrSize, | 619 new CodePatcher(isolate, young_sequence_.start(), |
| 620 CodePatcher::DONT_FLUSH)); | 620 young_sequence_.length() / Assembler::kInstrSize, |
| 621 CodePatcher::DONT_FLUSH)); |
| 621 PredictableCodeSizeScope scope(patcher->masm(), young_sequence_.length()); | 622 PredictableCodeSizeScope scope(patcher->masm(), young_sequence_.length()); |
| 622 patcher->masm()->PushFixedFrame(r4); | 623 patcher->masm()->PushFixedFrame(r4); |
| 623 patcher->masm()->addi(fp, sp, | 624 patcher->masm()->addi(fp, sp, |
| 624 Operand(StandardFrameConstants::kFixedFrameSizeFromFp)); | 625 Operand(StandardFrameConstants::kFixedFrameSizeFromFp)); |
| 625 for (int i = 0; i < kNoCodeAgeSequenceNops; i++) { | 626 for (int i = 0; i < kNoCodeAgeSequenceNops; i++) { |
| 626 patcher->masm()->nop(); | 627 patcher->masm()->nop(); |
| 627 } | 628 } |
| 628 } | 629 } |
| 629 | 630 |
| 630 | 631 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 659 | 660 |
| 660 void Code::PatchPlatformCodeAge(Isolate* isolate, byte* sequence, Code::Age age, | 661 void Code::PatchPlatformCodeAge(Isolate* isolate, byte* sequence, Code::Age age, |
| 661 MarkingParity parity) { | 662 MarkingParity parity) { |
| 662 uint32_t young_length = isolate->code_aging_helper()->young_sequence_length(); | 663 uint32_t young_length = isolate->code_aging_helper()->young_sequence_length(); |
| 663 if (age == kNoAgeCodeAge) { | 664 if (age == kNoAgeCodeAge) { |
| 664 isolate->code_aging_helper()->CopyYoungSequenceTo(sequence); | 665 isolate->code_aging_helper()->CopyYoungSequenceTo(sequence); |
| 665 Assembler::FlushICache(isolate, sequence, young_length); | 666 Assembler::FlushICache(isolate, sequence, young_length); |
| 666 } else { | 667 } else { |
| 667 // FIXED_SEQUENCE | 668 // FIXED_SEQUENCE |
| 668 Code* stub = GetCodeAgeStub(isolate, age, parity); | 669 Code* stub = GetCodeAgeStub(isolate, age, parity); |
| 669 CodePatcher patcher(sequence, young_length / Assembler::kInstrSize); | 670 CodePatcher patcher(isolate, sequence, |
| 671 young_length / Assembler::kInstrSize); |
| 670 Assembler::BlockTrampolinePoolScope block_trampoline_pool(patcher.masm()); | 672 Assembler::BlockTrampolinePoolScope block_trampoline_pool(patcher.masm()); |
| 671 intptr_t target = reinterpret_cast<intptr_t>(stub->instruction_start()); | 673 intptr_t target = reinterpret_cast<intptr_t>(stub->instruction_start()); |
| 672 // Don't use Call -- we need to preserve ip and lr. | 674 // Don't use Call -- we need to preserve ip and lr. |
| 673 // GenerateMakeCodeYoungAgainCommon for the stub code. | 675 // GenerateMakeCodeYoungAgainCommon for the stub code. |
| 674 patcher.masm()->nop(); // marker to detect sequence (see IsOld) | 676 patcher.masm()->nop(); // marker to detect sequence (see IsOld) |
| 675 patcher.masm()->mov(r3, Operand(target)); | 677 patcher.masm()->mov(r3, Operand(target)); |
| 676 patcher.masm()->Jump(r3); | 678 patcher.masm()->Jump(r3); |
| 677 for (int i = 0; i < kCodeAgingSequenceNops; i++) { | 679 for (int i = 0; i < kCodeAgingSequenceNops; i++) { |
| 678 patcher.masm()->nop(); | 680 patcher.masm()->nop(); |
| 679 } | 681 } |
| 680 } | 682 } |
| 681 } | 683 } |
| 682 } // namespace internal | 684 } // namespace internal |
| 683 } // namespace v8 | 685 } // namespace v8 |
| 684 | 686 |
| 685 #endif // V8_TARGET_ARCH_PPC | 687 #endif // V8_TARGET_ARCH_PPC |
| OLD | NEW |