| 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 906 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 917 void Builtins::Generate_NotifySoftDeoptimized(MacroAssembler* masm) { | 917 void Builtins::Generate_NotifySoftDeoptimized(MacroAssembler* masm) { |
| 918 Generate_NotifyDeoptimizedHelper(masm, Deoptimizer::SOFT); | 918 Generate_NotifyDeoptimizedHelper(masm, Deoptimizer::SOFT); |
| 919 } | 919 } |
| 920 | 920 |
| 921 | 921 |
| 922 void Builtins::Generate_NotifyLazyDeoptimized(MacroAssembler* masm) { | 922 void Builtins::Generate_NotifyLazyDeoptimized(MacroAssembler* masm) { |
| 923 Generate_NotifyDeoptimizedHelper(masm, Deoptimizer::LAZY); | 923 Generate_NotifyDeoptimizedHelper(masm, Deoptimizer::LAZY); |
| 924 } | 924 } |
| 925 | 925 |
| 926 | 926 |
| 927 void Builtins::Generate_NotifyOSR(MacroAssembler* masm) { | |
| 928 // For now, we are relying on the fact that Runtime::NotifyOSR | |
| 929 // doesn't do any garbage collection which allows us to save/restore | |
| 930 // the registers without worrying about which of them contain | |
| 931 // pointers. This seems a bit fragile. | |
| 932 RegList saved_regs = | |
| 933 (kJSCallerSaved | kCalleeSaved | ra.bit() | fp.bit()) & ~sp.bit(); | |
| 934 __ MultiPush(saved_regs); | |
| 935 { | |
| 936 FrameScope scope(masm, StackFrame::INTERNAL); | |
| 937 __ CallRuntime(Runtime::kNotifyOSR, 0); | |
| 938 } | |
| 939 __ MultiPop(saved_regs); | |
| 940 __ Ret(); | |
| 941 } | |
| 942 | |
| 943 | |
| 944 void Builtins::Generate_OnStackReplacement(MacroAssembler* masm) { | 927 void Builtins::Generate_OnStackReplacement(MacroAssembler* masm) { |
| 945 // Lookup the function in the JavaScript frame. | 928 // Lookup the function in the JavaScript frame. |
| 946 __ lw(a0, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); | 929 __ lw(a0, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); |
| 947 { | 930 { |
| 948 FrameScope scope(masm, StackFrame::INTERNAL); | 931 FrameScope scope(masm, StackFrame::INTERNAL); |
| 949 // Lookup and calculate pc offset. | 932 // Lookup and calculate pc offset. |
| 950 __ lw(a1, MemOperand(fp, StandardFrameConstants::kCallerPCOffset)); | 933 __ lw(a1, MemOperand(fp, StandardFrameConstants::kCallerPCOffset)); |
| 951 __ lw(a2, FieldMemOperand(a0, JSFunction::kSharedFunctionInfoOffset)); | 934 __ lw(a2, FieldMemOperand(a0, JSFunction::kSharedFunctionInfoOffset)); |
| 952 __ lw(a2, FieldMemOperand(a2, SharedFunctionInfo::kCodeOffset)); | 935 __ lw(a2, FieldMemOperand(a2, SharedFunctionInfo::kCodeOffset)); |
| 953 __ Subu(a1, a1, Operand(Code::kHeaderSize - kHeapObjectTag)); | 936 __ Subu(a1, a1, Operand(Code::kHeaderSize - kHeapObjectTag)); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 976 // Compute the target address = code_obj + header_size + osr_offset | 959 // Compute the target address = code_obj + header_size + osr_offset |
| 977 // <entry_addr> = <code_obj> + #header_size + <osr_offset> | 960 // <entry_addr> = <code_obj> + #header_size + <osr_offset> |
| 978 __ addu(v0, v0, a1); | 961 __ addu(v0, v0, a1); |
| 979 __ addiu(ra, v0, Code::kHeaderSize - kHeapObjectTag); | 962 __ addiu(ra, v0, Code::kHeaderSize - kHeapObjectTag); |
| 980 | 963 |
| 981 // And "return" to the OSR entry point of the function. | 964 // And "return" to the OSR entry point of the function. |
| 982 __ Ret(); | 965 __ Ret(); |
| 983 } | 966 } |
| 984 | 967 |
| 985 | 968 |
| 969 void Builtins::Generate_OsrAfterStackCheck(MacroAssembler* masm) { |
| 970 // We check the stack limit as indicator that recompilation might be done. |
| 971 Label ok; |
| 972 __ LoadRoot(at, Heap::kStackLimitRootIndex); |
| 973 __ Branch(&ok, hs, sp, Operand(at)); |
| 974 { |
| 975 FrameScope scope(masm, StackFrame::INTERNAL); |
| 976 __ CallRuntime(Runtime::kStackGuard, 0); |
| 977 } |
| 978 __ Jump(masm->isolate()->builtins()->OnStackReplacement(), |
| 979 RelocInfo::CODE_TARGET); |
| 980 |
| 981 __ bind(&ok); |
| 982 __ Ret(); |
| 983 } |
| 984 |
| 985 |
| 986 void Builtins::Generate_FunctionCall(MacroAssembler* masm) { | 986 void Builtins::Generate_FunctionCall(MacroAssembler* masm) { |
| 987 // 1. Make sure we have at least one argument. | 987 // 1. Make sure we have at least one argument. |
| 988 // a0: actual number of arguments | 988 // a0: actual number of arguments |
| 989 { Label done; | 989 { Label done; |
| 990 __ Branch(&done, ne, a0, Operand(zero_reg)); | 990 __ Branch(&done, ne, a0, Operand(zero_reg)); |
| 991 __ LoadRoot(t2, Heap::kUndefinedValueRootIndex); | 991 __ LoadRoot(t2, Heap::kUndefinedValueRootIndex); |
| 992 __ push(t2); | 992 __ push(t2); |
| 993 __ Addu(a0, a0, Operand(1)); | 993 __ Addu(a0, a0, Operand(1)); |
| 994 __ bind(&done); | 994 __ bind(&done); |
| 995 } | 995 } |
| (...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1474 __ bind(&dont_adapt_arguments); | 1474 __ bind(&dont_adapt_arguments); |
| 1475 __ Jump(a3); | 1475 __ Jump(a3); |
| 1476 } | 1476 } |
| 1477 | 1477 |
| 1478 | 1478 |
| 1479 #undef __ | 1479 #undef __ |
| 1480 | 1480 |
| 1481 } } // namespace v8::internal | 1481 } } // namespace v8::internal |
| 1482 | 1482 |
| 1483 #endif // V8_TARGET_ARCH_MIPS | 1483 #endif // V8_TARGET_ARCH_MIPS |
| OLD | NEW |