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 982 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
993 { | 993 { |
994 FrameScope scope(masm, StackFrame::INTERNAL); | 994 FrameScope scope(masm, StackFrame::INTERNAL); |
995 __ CallRuntime(Runtime::kNotifyOSR, 0); | 995 __ CallRuntime(Runtime::kNotifyOSR, 0); |
996 } | 996 } |
997 __ MultiPop(saved_regs); | 997 __ MultiPop(saved_regs); |
998 __ Ret(); | 998 __ Ret(); |
999 } | 999 } |
1000 | 1000 |
1001 | 1001 |
1002 void Builtins::Generate_OnStackReplacement(MacroAssembler* masm) { | 1002 void Builtins::Generate_OnStackReplacement(MacroAssembler* masm) { |
1003 // Lookup the function in the JavaScript frame and push it as an | 1003 // Lookup the function in the JavaScript frame. |
1004 // argument to the on-stack replacement function. | |
1005 __ lw(a0, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); | 1004 __ lw(a0, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); |
1006 { | 1005 { |
1007 FrameScope scope(masm, StackFrame::INTERNAL); | 1006 FrameScope scope(masm, StackFrame::INTERNAL); |
| 1007 // Lookup and calculate pc offset. |
| 1008 __ lw(a1, MemOperand(fp, StandardFrameConstants::kCallerPCOffset)); |
| 1009 __ lw(a2, FieldMemOperand(a0, JSFunction::kSharedFunctionInfoOffset)); |
| 1010 __ lw(a2, FieldMemOperand(a2, SharedFunctionInfo::kCodeOffset)); |
| 1011 __ Subu(a1, a1, Operand(Code::kHeaderSize - kHeapObjectTag)); |
| 1012 __ Subu(a1, a1, a2); |
| 1013 __ SmiTag(a1); |
| 1014 |
| 1015 // Pass both function and pc offset as arguments. |
1008 __ push(a0); | 1016 __ push(a0); |
1009 __ CallRuntime(Runtime::kCompileForOnStackReplacement, 1); | 1017 __ push(a1); |
| 1018 __ CallRuntime(Runtime::kCompileForOnStackReplacement, 2); |
1010 } | 1019 } |
1011 | 1020 |
1012 // If the code object is null, just return to the unoptimized code. | 1021 // If the code object is null, just return to the unoptimized code. |
1013 __ Ret(eq, v0, Operand(Smi::FromInt(0))); | 1022 __ Ret(eq, v0, Operand(Smi::FromInt(0))); |
1014 | 1023 |
1015 // Load deoptimization data from the code object. | 1024 // Load deoptimization data from the code object. |
1016 // <deopt_data> = <code>[#deoptimization_data_offset] | 1025 // <deopt_data> = <code>[#deoptimization_data_offset] |
1017 __ lw(a1, MemOperand(v0, Code::kDeoptimizationDataOffset - kHeapObjectTag)); | 1026 __ lw(a1, MemOperand(v0, Code::kDeoptimizationDataOffset - kHeapObjectTag)); |
1018 | 1027 |
1019 // Load the OSR entrypoint offset from the deoptimization data. | 1028 // Load the OSR entrypoint offset from the deoptimization data. |
(...skipping 503 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1523 __ bind(&dont_adapt_arguments); | 1532 __ bind(&dont_adapt_arguments); |
1524 __ Jump(a3); | 1533 __ Jump(a3); |
1525 } | 1534 } |
1526 | 1535 |
1527 | 1536 |
1528 #undef __ | 1537 #undef __ |
1529 | 1538 |
1530 } } // namespace v8::internal | 1539 } } // namespace v8::internal |
1531 | 1540 |
1532 #endif // V8_TARGET_ARCH_MIPS | 1541 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |