| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 2582 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2593 if (frame_mode == BUILD_STUB_FRAME) { | 2593 if (frame_mode == BUILD_STUB_FRAME) { |
| 2594 ASSERT(StackPointer().Is(jssp)); | 2594 ASSERT(StackPointer().Is(jssp)); |
| 2595 // TODO(jbramley): Does x1 contain a JSFunction here, or does it already | 2595 // TODO(jbramley): Does x1 contain a JSFunction here, or does it already |
| 2596 // have the special STUB smi? | 2596 // have the special STUB smi? |
| 2597 __ Mov(Tmp0(), Operand(Smi::FromInt(StackFrame::STUB))); | 2597 __ Mov(Tmp0(), Operand(Smi::FromInt(StackFrame::STUB))); |
| 2598 // Compiled stubs don't age, and so they don't need the predictable code | 2598 // Compiled stubs don't age, and so they don't need the predictable code |
| 2599 // ageing sequence. | 2599 // ageing sequence. |
| 2600 __ Push(lr, fp, cp, Tmp0()); | 2600 __ Push(lr, fp, cp, Tmp0()); |
| 2601 __ Add(fp, jssp, StandardFrameConstants::kFixedFrameSizeFromFp); | 2601 __ Add(fp, jssp, StandardFrameConstants::kFixedFrameSizeFromFp); |
| 2602 } else { | 2602 } else { |
| 2603 TODO_UNIMPLEMENTED("Prologue: Support IsCodePreAgingActive()."); | 2603 if (isolate()->IsCodePreAgingActive()) { |
| 2604 __ EmitFrameSetupForCodeAgePatching(); | 2604 Code* stub = Code::GetPreAgedCodeAgeStub(isolate()); |
| 2605 __ EmitCodeAgeSequence(stub); |
| 2606 } else { |
| 2607 __ EmitFrameSetupForCodeAgePatching(); |
| 2608 } |
| 2605 } | 2609 } |
| 2606 } | 2610 } |
| 2607 | 2611 |
| 2608 | 2612 |
| 2609 void MacroAssembler::EnterFrame(StackFrame::Type type) { | 2613 void MacroAssembler::EnterFrame(StackFrame::Type type) { |
| 2610 ASSERT(jssp.Is(StackPointer())); | 2614 ASSERT(jssp.Is(StackPointer())); |
| 2611 Push(lr, fp, cp); | 2615 Push(lr, fp, cp); |
| 2612 Mov(Tmp1(), Operand(Smi::FromInt(type))); | 2616 Mov(Tmp1(), Operand(Smi::FromInt(type))); |
| 2613 Mov(Tmp0(), Operand(CodeObject())); | 2617 Mov(Tmp0(), Operand(CodeObject())); |
| 2614 Push(Tmp1(), Tmp0()); | 2618 Push(Tmp1(), Tmp0()); |
| (...skipping 2044 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4659 void MacroAssembler::EmitFrameSetupForCodeAgePatching() { | 4663 void MacroAssembler::EmitFrameSetupForCodeAgePatching() { |
| 4660 // TODO(jbramley): Other architectures use the internal memcpy to copy the | 4664 // TODO(jbramley): Other architectures use the internal memcpy to copy the |
| 4661 // sequence. If this is a performance bottleneck, we should consider caching | 4665 // sequence. If this is a performance bottleneck, we should consider caching |
| 4662 // the sequence and copying it in the same way. | 4666 // the sequence and copying it in the same way. |
| 4663 InstructionAccurateScope scope(this, kCodeAgeSequenceSize / kInstructionSize); | 4667 InstructionAccurateScope scope(this, kCodeAgeSequenceSize / kInstructionSize); |
| 4664 ASSERT(jssp.Is(StackPointer())); | 4668 ASSERT(jssp.Is(StackPointer())); |
| 4665 EmitFrameSetupForCodeAgePatching(this); | 4669 EmitFrameSetupForCodeAgePatching(this); |
| 4666 } | 4670 } |
| 4667 | 4671 |
| 4668 | 4672 |
| 4673 |
| 4674 void MacroAssembler::EmitCodeAgeSequence(Code* stub) { |
| 4675 InstructionAccurateScope scope(this, kCodeAgeSequenceSize / kInstructionSize); |
| 4676 ASSERT(jssp.Is(StackPointer())); |
| 4677 EmitCodeAgeSequence(this, stub); |
| 4678 } |
| 4679 |
| 4680 |
| 4669 #undef __ | 4681 #undef __ |
| 4670 #define __ assm-> | 4682 #define __ assm-> |
| 4671 | 4683 |
| 4672 | 4684 |
| 4673 void MacroAssembler::EmitFrameSetupForCodeAgePatching(Assembler * assm) { | 4685 void MacroAssembler::EmitFrameSetupForCodeAgePatching(Assembler * assm) { |
| 4674 Label start; | 4686 Label start; |
| 4675 __ bind(&start); | 4687 __ bind(&start); |
| 4676 | 4688 |
| 4677 // We can do this sequence using four instructions, but the code ageing | 4689 // We can do this sequence using four instructions, but the code ageing |
| 4678 // sequence that patches it needs five, so we use the extra space to try to | 4690 // sequence that patches it needs five, so we use the extra space to try to |
| 4679 // simplify some addressing modes and remove some dependencies (compared to | 4691 // simplify some addressing modes and remove some dependencies (compared to |
| 4680 // using two stp instructions with write-back). | 4692 // using two stp instructions with write-back). |
| 4681 __ sub(jssp, jssp, 4 * kXRegSizeInBytes); | 4693 __ sub(jssp, jssp, 4 * kXRegSizeInBytes); |
| 4682 __ sub(csp, csp, 4 * kXRegSizeInBytes); | 4694 __ sub(csp, csp, 4 * kXRegSizeInBytes); |
| 4683 __ stp(x1, cp, MemOperand(jssp, 0 * kXRegSizeInBytes)); | 4695 __ stp(x1, cp, MemOperand(jssp, 0 * kXRegSizeInBytes)); |
| 4684 __ stp(fp, lr, MemOperand(jssp, 2 * kXRegSizeInBytes)); | 4696 __ stp(fp, lr, MemOperand(jssp, 2 * kXRegSizeInBytes)); |
| 4685 __ add(fp, jssp, StandardFrameConstants::kFixedFrameSizeFromFp); | 4697 __ add(fp, jssp, StandardFrameConstants::kFixedFrameSizeFromFp); |
| 4686 | 4698 |
| 4687 __ AssertSizeOfCodeGeneratedSince(&start, kCodeAgeSequenceSize); | 4699 __ AssertSizeOfCodeGeneratedSince(&start, kCodeAgeSequenceSize); |
| 4688 } | 4700 } |
| 4689 | 4701 |
| 4690 | 4702 |
| 4691 void MacroAssembler::EmitCodeAgeSequence(PatchingAssembler * assm, | 4703 void MacroAssembler::EmitCodeAgeSequence(Assembler * assm, |
| 4692 Code * stub) { | 4704 Code * stub) { |
| 4693 Label start; | 4705 Label start; |
| 4694 __ bind(&start); | 4706 __ bind(&start); |
| 4695 // When the stub is called, the sequence is replaced with the young sequence | 4707 // When the stub is called, the sequence is replaced with the young sequence |
| 4696 // (as in EmitFrameSetupForCodeAgePatching). After the code is replaced, the | 4708 // (as in EmitFrameSetupForCodeAgePatching). After the code is replaced, the |
| 4697 // stub jumps to &start, stored in x0. The young sequence does not call the | 4709 // stub jumps to &start, stored in x0. The young sequence does not call the |
| 4698 // stub so there is no infinite loop here. | 4710 // stub so there is no infinite loop here. |
| 4699 // | 4711 // |
| 4700 // A branch (br) is used rather than a call (blr) because this code replaces | 4712 // A branch (br) is used rather than a call (blr) because this code replaces |
| 4701 // the frame setup code that would normally preserve lr. | 4713 // the frame setup code that would normally preserve lr. |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4794 } | 4806 } |
| 4795 } | 4807 } |
| 4796 | 4808 |
| 4797 | 4809 |
| 4798 #undef __ | 4810 #undef __ |
| 4799 | 4811 |
| 4800 | 4812 |
| 4801 } } // namespace v8::internal | 4813 } } // namespace v8::internal |
| 4802 | 4814 |
| 4803 #endif // V8_TARGET_ARCH_A64 | 4815 #endif // V8_TARGET_ARCH_A64 |
| OLD | NEW |