| 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 795 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 806 } | 806 } |
| 807 | 807 |
| 808 | 808 |
| 809 static void GenerateMakeCodeYoungAgainCommon(MacroAssembler* masm) { | 809 static void GenerateMakeCodeYoungAgainCommon(MacroAssembler* masm) { |
| 810 // For now, we are relying on the fact that make_code_young doesn't do any | 810 // For now, we are relying on the fact that make_code_young doesn't do any |
| 811 // garbage collection which allows us to save/restore the registers without | 811 // garbage collection which allows us to save/restore the registers without |
| 812 // worrying about which of them contain pointers. We also don't build an | 812 // worrying about which of them contain pointers. We also don't build an |
| 813 // internal frame to make the code faster, since we shouldn't have to do stack | 813 // internal frame to make the code faster, since we shouldn't have to do stack |
| 814 // crawls in MakeCodeYoung. This seems a bit fragile. | 814 // crawls in MakeCodeYoung. This seems a bit fragile. |
| 815 | 815 |
| 816 __ mov(a0, ra); | 816 // Set a0 to point to the head of the PlatformCodeAge sequence. |
| 817 // Adjust a0 to point to the head of the PlatformCodeAge sequence | |
| 818 __ Subu(a0, a0, | 817 __ Subu(a0, a0, |
| 819 Operand((kNoCodeAgeSequenceLength - 1) * Assembler::kInstrSize)); | 818 Operand((kNoCodeAgeSequenceLength - 1) * Assembler::kInstrSize)); |
| 820 // Restore the original return address of the function | |
| 821 __ mov(ra, at); | |
| 822 | 819 |
| 823 // The following registers must be saved and restored when calling through to | 820 // The following registers must be saved and restored when calling through to |
| 824 // the runtime: | 821 // the runtime: |
| 825 // a0 - contains return address (beginning of patch sequence) | 822 // a0 - contains return address (beginning of patch sequence) |
| 826 // a1 - isolate | 823 // a1 - isolate |
| 827 RegList saved_regs = | 824 RegList saved_regs = |
| 828 (a0.bit() | a1.bit() | ra.bit() | fp.bit()) & ~sp.bit(); | 825 (a0.bit() | a1.bit() | ra.bit() | fp.bit()) & ~sp.bit(); |
| 829 FrameScope scope(masm, StackFrame::MANUAL); | 826 FrameScope scope(masm, StackFrame::MANUAL); |
| 830 __ MultiPush(saved_regs); | 827 __ MultiPush(saved_regs); |
| 831 __ PrepareCallCFunction(1, 0, a2); | 828 __ PrepareCallCFunction(1, 0, a2); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 848 CODE_AGE_LIST(DEFINE_CODE_AGE_BUILTIN_GENERATOR) | 845 CODE_AGE_LIST(DEFINE_CODE_AGE_BUILTIN_GENERATOR) |
| 849 #undef DEFINE_CODE_AGE_BUILTIN_GENERATOR | 846 #undef DEFINE_CODE_AGE_BUILTIN_GENERATOR |
| 850 | 847 |
| 851 | 848 |
| 852 void Builtins::Generate_MarkCodeAsExecutedOnce(MacroAssembler* masm) { | 849 void Builtins::Generate_MarkCodeAsExecutedOnce(MacroAssembler* masm) { |
| 853 // For now, as in GenerateMakeCodeYoungAgainCommon, we are relying on the fact | 850 // For now, as in GenerateMakeCodeYoungAgainCommon, we are relying on the fact |
| 854 // that make_code_young doesn't do any garbage collection which allows us to | 851 // that make_code_young doesn't do any garbage collection which allows us to |
| 855 // save/restore the registers without worrying about which of them contain | 852 // save/restore the registers without worrying about which of them contain |
| 856 // pointers. | 853 // pointers. |
| 857 | 854 |
| 858 __ mov(a0, ra); | 855 // Set a0 to point to the head of the PlatformCodeAge sequence. |
| 859 // Adjust a0 to point to the head of the PlatformCodeAge sequence | |
| 860 __ Subu(a0, a0, | 856 __ Subu(a0, a0, |
| 861 Operand((kNoCodeAgeSequenceLength - 1) * Assembler::kInstrSize)); | 857 Operand((kNoCodeAgeSequenceLength - 1) * Assembler::kInstrSize)); |
| 862 // Restore the original return address of the function | |
| 863 __ mov(ra, at); | |
| 864 | 858 |
| 865 // The following registers must be saved and restored when calling through to | 859 // The following registers must be saved and restored when calling through to |
| 866 // the runtime: | 860 // the runtime: |
| 867 // a0 - contains return address (beginning of patch sequence) | 861 // a0 - contains return address (beginning of patch sequence) |
| 868 // a1 - isolate | 862 // a1 - isolate |
| 869 RegList saved_regs = | 863 RegList saved_regs = |
| 870 (a0.bit() | a1.bit() | ra.bit() | fp.bit()) & ~sp.bit(); | 864 (a0.bit() | a1.bit() | ra.bit() | fp.bit()) & ~sp.bit(); |
| 871 FrameScope scope(masm, StackFrame::MANUAL); | 865 FrameScope scope(masm, StackFrame::MANUAL); |
| 872 __ MultiPush(saved_regs); | 866 __ MultiPush(saved_regs); |
| 873 __ PrepareCallCFunction(1, 0, a2); | 867 __ PrepareCallCFunction(1, 0, a2); |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 968 void Builtins::Generate_NotifyLazyDeoptimized(MacroAssembler* masm) { | 962 void Builtins::Generate_NotifyLazyDeoptimized(MacroAssembler* masm) { |
| 969 Generate_NotifyDeoptimizedHelper(masm, Deoptimizer::LAZY); | 963 Generate_NotifyDeoptimizedHelper(masm, Deoptimizer::LAZY); |
| 970 } | 964 } |
| 971 | 965 |
| 972 | 966 |
| 973 void Builtins::Generate_OnStackReplacement(MacroAssembler* masm) { | 967 void Builtins::Generate_OnStackReplacement(MacroAssembler* masm) { |
| 974 // Lookup the function in the JavaScript frame. | 968 // Lookup the function in the JavaScript frame. |
| 975 __ lw(a0, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); | 969 __ lw(a0, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); |
| 976 { | 970 { |
| 977 FrameScope scope(masm, StackFrame::INTERNAL); | 971 FrameScope scope(masm, StackFrame::INTERNAL); |
| 978 // Lookup and calculate pc offset. | 972 // Pass function as argument. |
| 979 __ lw(a1, MemOperand(fp, StandardFrameConstants::kCallerPCOffset)); | |
| 980 __ lw(a2, FieldMemOperand(a0, JSFunction::kSharedFunctionInfoOffset)); | |
| 981 __ lw(a2, FieldMemOperand(a2, SharedFunctionInfo::kCodeOffset)); | |
| 982 __ Subu(a1, a1, Operand(Code::kHeaderSize - kHeapObjectTag)); | |
| 983 __ Subu(a1, a1, a2); | |
| 984 __ SmiTag(a1); | |
| 985 | |
| 986 // Pass both function and pc offset as arguments. | |
| 987 __ push(a0); | 973 __ push(a0); |
| 988 __ push(a1); | 974 __ CallRuntime(Runtime::kCompileForOnStackReplacement, 1); |
| 989 __ CallRuntime(Runtime::kCompileForOnStackReplacement, 2); | |
| 990 } | 975 } |
| 991 | 976 |
| 992 // If the code object is null, just return to the unoptimized code. | 977 // If the code object is null, just return to the unoptimized code. |
| 993 __ Ret(eq, v0, Operand(Smi::FromInt(0))); | 978 __ Ret(eq, v0, Operand(Smi::FromInt(0))); |
| 994 | 979 |
| 995 // Load deoptimization data from the code object. | 980 // Load deoptimization data from the code object. |
| 996 // <deopt_data> = <code>[#deoptimization_data_offset] | 981 // <deopt_data> = <code>[#deoptimization_data_offset] |
| 997 __ lw(a1, MemOperand(v0, Code::kDeoptimizationDataOffset - kHeapObjectTag)); | 982 __ lw(a1, MemOperand(v0, Code::kDeoptimizationDataOffset - kHeapObjectTag)); |
| 998 | 983 |
| 999 // Load the OSR entrypoint offset from the deoptimization data. | 984 // Load the OSR entrypoint offset from the deoptimization data. |
| (...skipping 524 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1524 __ bind(&dont_adapt_arguments); | 1509 __ bind(&dont_adapt_arguments); |
| 1525 __ Jump(a3); | 1510 __ Jump(a3); |
| 1526 } | 1511 } |
| 1527 | 1512 |
| 1528 | 1513 |
| 1529 #undef __ | 1514 #undef __ |
| 1530 | 1515 |
| 1531 } } // namespace v8::internal | 1516 } } // namespace v8::internal |
| 1532 | 1517 |
| 1533 #endif // V8_TARGET_ARCH_MIPS | 1518 #endif // V8_TARGET_ARCH_MIPS |
| OLD | NEW |