| OLD | NEW |
| 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 #include "src/x64/codegen-x64.h" | 5 #include "src/x64/codegen-x64.h" |
| 6 | 6 |
| 7 #if V8_TARGET_ARCH_X64 | 7 #if V8_TARGET_ARCH_X64 |
| 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 541 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 552 | 552 |
| 553 #undef __ | 553 #undef __ |
| 554 | 554 |
| 555 | 555 |
| 556 CodeAgingHelper::CodeAgingHelper(Isolate* isolate) { | 556 CodeAgingHelper::CodeAgingHelper(Isolate* isolate) { |
| 557 USE(isolate); | 557 USE(isolate); |
| 558 DCHECK(young_sequence_.length() == kNoCodeAgeSequenceLength); | 558 DCHECK(young_sequence_.length() == kNoCodeAgeSequenceLength); |
| 559 // The sequence of instructions that is patched out for aging code is the | 559 // The sequence of instructions that is patched out for aging code is the |
| 560 // following boilerplate stack-building prologue that is found both in | 560 // following boilerplate stack-building prologue that is found both in |
| 561 // FUNCTION and OPTIMIZED_FUNCTION code: | 561 // FUNCTION and OPTIMIZED_FUNCTION code: |
| 562 CodePatcher patcher(young_sequence_.start(), young_sequence_.length()); | 562 CodePatcher patcher(isolate, young_sequence_.start(), |
| 563 young_sequence_.length()); |
| 563 patcher.masm()->pushq(rbp); | 564 patcher.masm()->pushq(rbp); |
| 564 patcher.masm()->movp(rbp, rsp); | 565 patcher.masm()->movp(rbp, rsp); |
| 565 patcher.masm()->Push(rsi); | 566 patcher.masm()->Push(rsi); |
| 566 patcher.masm()->Push(rdi); | 567 patcher.masm()->Push(rdi); |
| 567 } | 568 } |
| 568 | 569 |
| 569 | 570 |
| 570 #ifdef DEBUG | 571 #ifdef DEBUG |
| 571 bool CodeAgingHelper::IsOld(byte* candidate) const { | 572 bool CodeAgingHelper::IsOld(byte* candidate) const { |
| 572 return *candidate == kCallOpcode; | 573 return *candidate == kCallOpcode; |
| (...skipping 26 matching lines...) Expand all Loading... |
| 599 void Code::PatchPlatformCodeAge(Isolate* isolate, | 600 void Code::PatchPlatformCodeAge(Isolate* isolate, |
| 600 byte* sequence, | 601 byte* sequence, |
| 601 Code::Age age, | 602 Code::Age age, |
| 602 MarkingParity parity) { | 603 MarkingParity parity) { |
| 603 uint32_t young_length = isolate->code_aging_helper()->young_sequence_length(); | 604 uint32_t young_length = isolate->code_aging_helper()->young_sequence_length(); |
| 604 if (age == kNoAgeCodeAge) { | 605 if (age == kNoAgeCodeAge) { |
| 605 isolate->code_aging_helper()->CopyYoungSequenceTo(sequence); | 606 isolate->code_aging_helper()->CopyYoungSequenceTo(sequence); |
| 606 Assembler::FlushICache(isolate, sequence, young_length); | 607 Assembler::FlushICache(isolate, sequence, young_length); |
| 607 } else { | 608 } else { |
| 608 Code* stub = GetCodeAgeStub(isolate, age, parity); | 609 Code* stub = GetCodeAgeStub(isolate, age, parity); |
| 609 CodePatcher patcher(sequence, young_length); | 610 CodePatcher patcher(isolate, sequence, young_length); |
| 610 patcher.masm()->call(stub->instruction_start()); | 611 patcher.masm()->call(stub->instruction_start()); |
| 611 patcher.masm()->Nop( | 612 patcher.masm()->Nop( |
| 612 kNoCodeAgeSequenceLength - Assembler::kShortCallInstructionLength); | 613 kNoCodeAgeSequenceLength - Assembler::kShortCallInstructionLength); |
| 613 } | 614 } |
| 614 } | 615 } |
| 615 | 616 |
| 616 | 617 |
| 617 Operand StackArgumentsAccessor::GetArgumentOperand(int index) { | 618 Operand StackArgumentsAccessor::GetArgumentOperand(int index) { |
| 618 DCHECK(index >= 0); | 619 DCHECK(index >= 0); |
| 619 int receiver = (receiver_mode_ == ARGUMENTS_CONTAIN_RECEIVER) ? 1 : 0; | 620 int receiver = (receiver_mode_ == ARGUMENTS_CONTAIN_RECEIVER) ? 1 : 0; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 632 return Operand(base_reg_, argument_count_reg_, times_pointer_size, | 633 return Operand(base_reg_, argument_count_reg_, times_pointer_size, |
| 633 displacement_to_last_argument + (receiver - 1 - index) * kPointerSize); | 634 displacement_to_last_argument + (receiver - 1 - index) * kPointerSize); |
| 634 } | 635 } |
| 635 } | 636 } |
| 636 | 637 |
| 637 | 638 |
| 638 } // namespace internal | 639 } // namespace internal |
| 639 } // namespace v8 | 640 } // namespace v8 |
| 640 | 641 |
| 641 #endif // V8_TARGET_ARCH_X64 | 642 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |