OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 7748 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7759 // Array literal has ElementsKind of FAST_*_DOUBLE_ELEMENTS. | 7759 // Array literal has ElementsKind of FAST_*_DOUBLE_ELEMENTS. |
7760 __ bind(&double_elements); | 7760 __ bind(&double_elements); |
7761 __ lw(t1, FieldMemOperand(a1, JSObject::kElementsOffset)); | 7761 __ lw(t1, FieldMemOperand(a1, JSObject::kElementsOffset)); |
7762 __ StoreNumberToDoubleElements(a0, a3, a1, t1, t2, t3, t5, a2, | 7762 __ StoreNumberToDoubleElements(a0, a3, a1, t1, t2, t3, t5, a2, |
7763 &slow_elements); | 7763 &slow_elements); |
7764 __ Ret(USE_DELAY_SLOT); | 7764 __ Ret(USE_DELAY_SLOT); |
7765 __ mov(v0, a0); | 7765 __ mov(v0, a0); |
7766 } | 7766 } |
7767 | 7767 |
7768 | 7768 |
| 7769 void ProfileEntryHookStub::MaybeCallEntryHook(MacroAssembler* masm) { |
| 7770 if (entry_hook_ != NULL) { |
| 7771 ProfileEntryHookStub stub; |
| 7772 __ push(ra); |
| 7773 __ CallStub(&stub); |
| 7774 __ pop(ra); |
| 7775 } |
| 7776 } |
| 7777 |
| 7778 |
| 7779 void ProfileEntryHookStub::Generate(MacroAssembler* masm) { |
| 7780 // The entry hook is a "push ra" instruction, followed by a call. |
| 7781 // Note: on MIPS "push" is 2 instruction |
| 7782 const int32_t kReturnAddressDistanceFromFunctionStart = |
| 7783 Assembler::kCallTargetAddressOffset + (2 * Assembler::kInstrSize); |
| 7784 |
| 7785 // Save live volatile registers. |
| 7786 __ Push(ra, t1, a1); |
| 7787 const int32_t kNumSavedRegs = 3; |
| 7788 |
| 7789 // Compute the function's address for the first argument. |
| 7790 __ Subu(a0, ra, Operand(kReturnAddressDistanceFromFunctionStart)); |
| 7791 |
| 7792 // The caller's return address is above the saved temporaries. |
| 7793 // Grab that for the second argument to the hook. |
| 7794 __ Addu(a1, sp, Operand(kNumSavedRegs * kPointerSize)); |
| 7795 |
| 7796 // Align the stack if necessary. |
| 7797 int frame_alignment = masm->ActivationFrameAlignment(); |
| 7798 if (frame_alignment > kPointerSize) { |
| 7799 __ mov(t1, sp); |
| 7800 ASSERT(IsPowerOf2(frame_alignment)); |
| 7801 __ And(sp, sp, Operand(-frame_alignment)); |
| 7802 } |
| 7803 |
| 7804 #if defined(V8_HOST_ARCH_MIPS) |
| 7805 __ li(at, Operand(reinterpret_cast<int32_t>(&entry_hook_))); |
| 7806 __ lw(at, MemOperand(at)); |
| 7807 #else |
| 7808 // Under the simulator we need to indirect the entry hook through a |
| 7809 // trampoline function at a known address. |
| 7810 Address trampoline_address = reinterpret_cast<Address>( |
| 7811 reinterpret_cast<intptr_t>(EntryHookTrampoline)); |
| 7812 ApiFunction dispatcher(trampoline_address); |
| 7813 __ li(at, Operand(ExternalReference(&dispatcher, |
| 7814 ExternalReference::BUILTIN_CALL, |
| 7815 masm->isolate()))); |
| 7816 #endif |
| 7817 __ Call(at); |
| 7818 |
| 7819 // Restore the stack pointer if needed. |
| 7820 if (frame_alignment > kPointerSize) { |
| 7821 __ mov(sp, t1); |
| 7822 } |
| 7823 |
| 7824 __ Pop(ra, t1, a1); |
| 7825 __ Ret(); |
| 7826 } |
| 7827 |
| 7828 |
7769 #undef __ | 7829 #undef __ |
7770 | 7830 |
7771 } } // namespace v8::internal | 7831 } } // namespace v8::internal |
7772 | 7832 |
7773 #endif // V8_TARGET_ARCH_MIPS | 7833 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |