| 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 805 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 816 } | 816 } |
| 817 | 817 |
| 818 | 818 |
| 819 static void GenerateMakeCodeYoungAgainCommon(MacroAssembler* masm) { | 819 static void GenerateMakeCodeYoungAgainCommon(MacroAssembler* masm) { |
| 820 // For now, we are relying on the fact that make_code_young doesn't do any | 820 // For now, we are relying on the fact that make_code_young doesn't do any |
| 821 // garbage collection which allows us to save/restore the registers without | 821 // garbage collection which allows us to save/restore the registers without |
| 822 // worrying about which of them contain pointers. We also don't build an | 822 // worrying about which of them contain pointers. We also don't build an |
| 823 // internal frame to make the code faster, since we shouldn't have to do stack | 823 // internal frame to make the code faster, since we shouldn't have to do stack |
| 824 // crawls in MakeCodeYoung. This seems a bit fragile. | 824 // crawls in MakeCodeYoung. This seems a bit fragile. |
| 825 | 825 |
| 826 __ mov(a0, ra); | 826 // Set a0 to point to the head of the PlatformCodeAge sequence. |
| 827 // Adjust a0 to point to the head of the PlatformCodeAge sequence | |
| 828 __ Subu(a0, a0, | 827 __ Subu(a0, a0, |
| 829 Operand((kNoCodeAgeSequenceLength - 1) * Assembler::kInstrSize)); | 828 Operand((kNoCodeAgeSequenceLength - 1) * Assembler::kInstrSize)); |
| 830 // Restore the original return address of the function | |
| 831 __ mov(ra, at); | |
| 832 | 829 |
| 833 // The following registers must be saved and restored when calling through to | 830 // The following registers must be saved and restored when calling through to |
| 834 // the runtime: | 831 // the runtime: |
| 835 // a0 - contains return address (beginning of patch sequence) | 832 // a0 - contains return address (beginning of patch sequence) |
| 836 // a1 - function object | 833 // a1 - function object |
| 837 RegList saved_regs = | 834 RegList saved_regs = |
| 838 (a0.bit() | a1.bit() | ra.bit() | fp.bit()) & ~sp.bit(); | 835 (a0.bit() | a1.bit() | ra.bit() | fp.bit()) & ~sp.bit(); |
| 839 FrameScope scope(masm, StackFrame::MANUAL); | 836 FrameScope scope(masm, StackFrame::MANUAL); |
| 840 __ MultiPush(saved_regs); | 837 __ MultiPush(saved_regs); |
| 841 __ PrepareCallCFunction(1, 0, a1); | 838 __ PrepareCallCFunction(1, 0, a1); |
| 842 __ CallCFunction( | 839 __ CallCFunction( |
| 843 ExternalReference::get_make_code_young_function(masm->isolate()), 1); | 840 ExternalReference::get_make_code_young_function(masm->isolate()), 1); |
| 844 __ MultiPop(saved_regs); | 841 __ MultiPop(saved_regs); |
| 845 __ Jump(a0); | 842 __ Jump(a0); |
| 846 } | 843 } |
| 847 | 844 |
| 848 #define DEFINE_CODE_AGE_BUILTIN_GENERATOR(C) \ | 845 #define DEFINE_CODE_AGE_BUILTIN_GENERATOR(C) \ |
| 849 void Builtins::Generate_Make##C##CodeYoungAgainEvenMarking( \ | 846 void Builtins::Generate_Make##C##CodeYoungAgainEvenMarking( \ |
| 850 MacroAssembler* masm) { \ | 847 MacroAssembler* masm) { \ |
| 851 GenerateMakeCodeYoungAgainCommon(masm); \ | 848 GenerateMakeCodeYoungAgainCommon(masm); \ |
| 852 } \ | 849 } \ |
| 853 void Builtins::Generate_Make##C##CodeYoungAgainOddMarking( \ | 850 void Builtins::Generate_Make##C##CodeYoungAgainOddMarking( \ |
| 854 MacroAssembler* masm) { \ | 851 MacroAssembler* masm) { \ |
| 855 GenerateMakeCodeYoungAgainCommon(masm); \ | 852 GenerateMakeCodeYoungAgainCommon(masm); \ |
| 856 } | 853 } |
| 857 CODE_AGE_LIST(DEFINE_CODE_AGE_BUILTIN_GENERATOR) | 854 CODE_AGE_LIST(DEFINE_CODE_AGE_BUILTIN_GENERATOR) |
| 858 #undef DEFINE_CODE_AGE_BUILTIN_GENERATOR | 855 #undef DEFINE_CODE_AGE_BUILTIN_GENERATOR |
| 859 | 856 |
| 860 | 857 |
| 861 void Builtins::Generate_NotifyStubFailure(MacroAssembler* masm) { | 858 |
| 859 static void Generate_NotifyStubFailureHelper(MacroAssembler* masm, |
| 860 SaveFPRegsMode save_doubles) { |
| 862 { | 861 { |
| 863 FrameScope scope(masm, StackFrame::INTERNAL); | 862 FrameScope scope(masm, StackFrame::INTERNAL); |
| 864 | 863 |
| 865 // Preserve registers across notification, this is important for compiled | 864 // Preserve registers across notification, this is important for compiled |
| 866 // stubs that tail call the runtime on deopts passing their parameters in | 865 // stubs that tail call the runtime on deopts passing their parameters in |
| 867 // registers. | 866 // registers. |
| 868 __ MultiPush(kJSCallerSaved | kCalleeSaved); | 867 __ MultiPush(kJSCallerSaved | kCalleeSaved); |
| 869 // Pass the function and deoptimization type to the runtime system. | 868 // Pass the function and deoptimization type to the runtime system. |
| 870 __ CallRuntime(Runtime::kNotifyStubFailure, 0); | 869 __ CallRuntime(Runtime::kNotifyStubFailure, 0, save_doubles); |
| 871 __ MultiPop(kJSCallerSaved | kCalleeSaved); | 870 __ MultiPop(kJSCallerSaved | kCalleeSaved); |
| 872 } | 871 } |
| 873 | 872 |
| 874 __ Addu(sp, sp, Operand(kPointerSize)); // Ignore state | 873 __ Addu(sp, sp, Operand(kPointerSize)); // Ignore state |
| 875 __ Jump(ra); // Jump to miss handler | 874 __ Jump(ra); // Jump to miss handler |
| 876 } | 875 } |
| 877 | 876 |
| 878 | 877 |
| 878 void Builtins::Generate_NotifyStubFailure(MacroAssembler* masm) { |
| 879 Generate_NotifyStubFailureHelper(masm, kDontSaveFPRegs); |
| 880 } |
| 881 |
| 882 |
| 883 void Builtins::Generate_NotifyStubFailureSaveDoubles(MacroAssembler* masm) { |
| 884 Generate_NotifyStubFailureHelper(masm, kSaveFPRegs); |
| 885 } |
| 886 |
| 887 |
| 879 static void Generate_NotifyDeoptimizedHelper(MacroAssembler* masm, | 888 static void Generate_NotifyDeoptimizedHelper(MacroAssembler* masm, |
| 880 Deoptimizer::BailoutType type) { | 889 Deoptimizer::BailoutType type) { |
| 881 { | 890 { |
| 882 FrameScope scope(masm, StackFrame::INTERNAL); | 891 FrameScope scope(masm, StackFrame::INTERNAL); |
| 883 // Pass the function and deoptimization type to the runtime system. | 892 // Pass the function and deoptimization type to the runtime system. |
| 884 __ li(a0, Operand(Smi::FromInt(static_cast<int>(type)))); | 893 __ li(a0, Operand(Smi::FromInt(static_cast<int>(type)))); |
| 885 __ push(a0); | 894 __ push(a0); |
| 886 __ CallRuntime(Runtime::kNotifyDeoptimized, 1); | 895 __ CallRuntime(Runtime::kNotifyDeoptimized, 1); |
| 887 } | 896 } |
| 888 | 897 |
| (...skipping 586 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1475 __ bind(&dont_adapt_arguments); | 1484 __ bind(&dont_adapt_arguments); |
| 1476 __ Jump(a3); | 1485 __ Jump(a3); |
| 1477 } | 1486 } |
| 1478 | 1487 |
| 1479 | 1488 |
| 1480 #undef __ | 1489 #undef __ |
| 1481 | 1490 |
| 1482 } } // namespace v8::internal | 1491 } } // namespace v8::internal |
| 1483 | 1492 |
| 1484 #endif // V8_TARGET_ARCH_MIPS | 1493 #endif // V8_TARGET_ARCH_MIPS |
| OLD | NEW |