Chromium Code Reviews| 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 2576 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2587 if (frame_mode == BUILD_STUB_FRAME) { | 2587 if (frame_mode == BUILD_STUB_FRAME) { |
| 2588 ASSERT(StackPointer().Is(jssp)); | 2588 ASSERT(StackPointer().Is(jssp)); |
| 2589 // TODO(jbramley): Does x1 contain a JSFunction here, or does it already | 2589 // TODO(jbramley): Does x1 contain a JSFunction here, or does it already |
| 2590 // have the special STUB smi? | 2590 // have the special STUB smi? |
| 2591 __ Mov(Tmp0(), Operand(Smi::FromInt(StackFrame::STUB))); | 2591 __ Mov(Tmp0(), Operand(Smi::FromInt(StackFrame::STUB))); |
| 2592 // Compiled stubs don't age, and so they don't need the predictable code | 2592 // Compiled stubs don't age, and so they don't need the predictable code |
| 2593 // ageing sequence. | 2593 // ageing sequence. |
| 2594 __ Push(lr, fp, cp, Tmp0()); | 2594 __ Push(lr, fp, cp, Tmp0()); |
| 2595 __ Add(fp, jssp, StandardFrameConstants::kFixedFrameSizeFromFp); | 2595 __ Add(fp, jssp, StandardFrameConstants::kFixedFrameSizeFromFp); |
| 2596 } else { | 2596 } else { |
| 2597 TODO_UNIMPLEMENTED("Prologue: Support IsCodePreAgingActive()."); | 2597 if (isolate()->IsCodePreAgingActive()) { |
| 2598 __ EmitFrameSetupForCodeAgePatching(); | 2598 Code* stub = Code::GetPreAgedCodeAgeStub(isolate()); |
| 2599 EmitCodeAgeSequence(this, stub); | |
|
jochen (gone - plz use gerrit)
2014/02/10 09:27:43
should this be EmitCodeAgeSequence(stub)?
rmcilroy
2014/02/10 10:16:01
Done.
| |
| 2600 } else { | |
| 2601 __ EmitFrameSetupForCodeAgePatching(); | |
| 2602 } | |
| 2599 } | 2603 } |
| 2600 } | 2604 } |
| 2601 | 2605 |
| 2602 | 2606 |
| 2603 void MacroAssembler::EnterFrame(StackFrame::Type type) { | 2607 void MacroAssembler::EnterFrame(StackFrame::Type type) { |
| 2604 ASSERT(jssp.Is(StackPointer())); | 2608 ASSERT(jssp.Is(StackPointer())); |
| 2605 Push(lr, fp, cp); | 2609 Push(lr, fp, cp); |
| 2606 Mov(Tmp1(), Operand(Smi::FromInt(type))); | 2610 Mov(Tmp1(), Operand(Smi::FromInt(type))); |
| 2607 Mov(Tmp0(), Operand(CodeObject())); | 2611 Mov(Tmp0(), Operand(CodeObject())); |
| 2608 Push(Tmp1(), Tmp0()); | 2612 Push(Tmp1(), Tmp0()); |
| (...skipping 2041 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4650 void MacroAssembler::EmitFrameSetupForCodeAgePatching() { | 4654 void MacroAssembler::EmitFrameSetupForCodeAgePatching() { |
| 4651 // TODO(jbramley): Other architectures use the internal memcpy to copy the | 4655 // TODO(jbramley): Other architectures use the internal memcpy to copy the |
| 4652 // sequence. If this is a performance bottleneck, we should consider caching | 4656 // sequence. If this is a performance bottleneck, we should consider caching |
| 4653 // the sequence and copying it in the same way. | 4657 // the sequence and copying it in the same way. |
| 4654 InstructionAccurateScope scope(this, kCodeAgeSequenceSize / kInstructionSize); | 4658 InstructionAccurateScope scope(this, kCodeAgeSequenceSize / kInstructionSize); |
| 4655 ASSERT(jssp.Is(StackPointer())); | 4659 ASSERT(jssp.Is(StackPointer())); |
| 4656 EmitFrameSetupForCodeAgePatching(this); | 4660 EmitFrameSetupForCodeAgePatching(this); |
| 4657 } | 4661 } |
| 4658 | 4662 |
| 4659 | 4663 |
| 4664 | |
| 4665 void MacroAssembler::EmitCodeAgeSequence(Code* stub) { | |
| 4666 InstructionAccurateScope scope(this, kCodeAgeSequenceSize / kInstructionSize); | |
| 4667 ASSERT(jssp.Is(StackPointer())); | |
| 4668 EmitCodeAgeSequence(this, stub); | |
| 4669 } | |
| 4670 | |
| 4671 | |
| 4660 #undef __ | 4672 #undef __ |
| 4661 #define __ assm-> | 4673 #define __ assm-> |
| 4662 | 4674 |
| 4663 | 4675 |
| 4664 void MacroAssembler::EmitFrameSetupForCodeAgePatching(Assembler * assm) { | 4676 void MacroAssembler::EmitFrameSetupForCodeAgePatching(Assembler * assm) { |
| 4665 Label start; | 4677 Label start; |
| 4666 __ bind(&start); | 4678 __ bind(&start); |
| 4667 | 4679 |
| 4668 // We can do this sequence using four instructions, but the code ageing | 4680 // We can do this sequence using four instructions, but the code ageing |
| 4669 // sequence that patches it needs five, so we use the extra space to try to | 4681 // sequence that patches it needs five, so we use the extra space to try to |
| 4670 // simplify some addressing modes and remove some dependencies (compared to | 4682 // simplify some addressing modes and remove some dependencies (compared to |
| 4671 // using two stp instructions with write-back). | 4683 // using two stp instructions with write-back). |
| 4672 __ sub(jssp, jssp, 4 * kXRegSizeInBytes); | 4684 __ sub(jssp, jssp, 4 * kXRegSizeInBytes); |
| 4673 __ sub(csp, csp, 4 * kXRegSizeInBytes); | 4685 __ sub(csp, csp, 4 * kXRegSizeInBytes); |
| 4674 __ stp(x1, cp, MemOperand(jssp, 0 * kXRegSizeInBytes)); | 4686 __ stp(x1, cp, MemOperand(jssp, 0 * kXRegSizeInBytes)); |
| 4675 __ stp(fp, lr, MemOperand(jssp, 2 * kXRegSizeInBytes)); | 4687 __ stp(fp, lr, MemOperand(jssp, 2 * kXRegSizeInBytes)); |
| 4676 __ add(fp, jssp, StandardFrameConstants::kFixedFrameSizeFromFp); | 4688 __ add(fp, jssp, StandardFrameConstants::kFixedFrameSizeFromFp); |
| 4677 | 4689 |
| 4678 __ AssertSizeOfCodeGeneratedSince(&start, kCodeAgeSequenceSize); | 4690 __ AssertSizeOfCodeGeneratedSince(&start, kCodeAgeSequenceSize); |
| 4679 } | 4691 } |
| 4680 | 4692 |
| 4681 | 4693 |
| 4682 void MacroAssembler::EmitCodeAgeSequence(PatchingAssembler * assm, | 4694 void MacroAssembler::EmitCodeAgeSequence(Assembler * assm, |
| 4683 Code * stub) { | 4695 Code * stub) { |
| 4684 Label start; | 4696 Label start; |
| 4685 __ bind(&start); | 4697 __ bind(&start); |
| 4686 // When the stub is called, the sequence is replaced with the young sequence | 4698 // When the stub is called, the sequence is replaced with the young sequence |
| 4687 // (as in EmitFrameSetupForCodeAgePatching). After the code is replaced, the | 4699 // (as in EmitFrameSetupForCodeAgePatching). After the code is replaced, the |
| 4688 // stub jumps to &start, stored in x0. The young sequence does not call the | 4700 // stub jumps to &start, stored in x0. The young sequence does not call the |
| 4689 // stub so there is no infinite loop here. | 4701 // stub so there is no infinite loop here. |
| 4690 // | 4702 // |
| 4691 // A branch (br) is used rather than a call (blr) because this code replaces | 4703 // A branch (br) is used rather than a call (blr) because this code replaces |
| 4692 // the frame setup code that would normally preserve lr. | 4704 // the frame setup code that would normally preserve lr. |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4785 } | 4797 } |
| 4786 } | 4798 } |
| 4787 | 4799 |
| 4788 | 4800 |
| 4789 #undef __ | 4801 #undef __ |
| 4790 | 4802 |
| 4791 | 4803 |
| 4792 } } // namespace v8::internal | 4804 } } // namespace v8::internal |
| 4793 | 4805 |
| 4794 #endif // V8_TARGET_ARCH_A64 | 4806 #endif // V8_TARGET_ARCH_A64 |
| OLD | NEW |