| Index: src/mips/builtins-mips.cc
|
| diff --git a/src/mips/builtins-mips.cc b/src/mips/builtins-mips.cc
|
| index f27ded73480ceb38206d870741ec93b3ffdbb6c0..400292e694b2e8146f0083bb0414fdc45b6d62bf 100644
|
| --- a/src/mips/builtins-mips.cc
|
| +++ b/src/mips/builtins-mips.cc
|
| @@ -299,6 +299,24 @@ void Builtins::Generate_StringConstructCode(MacroAssembler* masm) {
|
| }
|
|
|
|
|
| +static void CallRuntimePassFunction(MacroAssembler* masm,
|
| + Runtime::FunctionId function_id) {
|
| + FrameScope scope(masm, StackFrame::INTERNAL);
|
| + // Push a copy of the function onto the stack.
|
| + __ push(a1);
|
| + // Push call kind information.
|
| + __ push(t1);
|
| + // Function is also the parameter to the runtime call.
|
| + __ push(a1);
|
| +
|
| + __ CallRuntime(function_id, 1);
|
| + // Restore call kind information.
|
| + __ pop(t1);
|
| + // Restore receiver.
|
| + __ pop(a1);
|
| +}
|
| +
|
| +
|
| static void GenerateTailCallToSharedCode(MacroAssembler* masm) {
|
| __ lw(a2, FieldMemOperand(a1, JSFunction::kSharedFunctionInfoOffset));
|
| __ lw(a2, FieldMemOperand(a2, SharedFunctionInfo::kCodeOffset));
|
| @@ -308,59 +326,27 @@ static void GenerateTailCallToSharedCode(MacroAssembler* masm) {
|
|
|
|
|
| void Builtins::Generate_InRecompileQueue(MacroAssembler* masm) {
|
| - GenerateTailCallToSharedCode(masm);
|
| -}
|
| -
|
| -
|
| -void Builtins::Generate_InstallRecompiledCode(MacroAssembler* masm) {
|
| - // Enter an internal frame.
|
| - {
|
| - FrameScope scope(masm, StackFrame::INTERNAL);
|
| -
|
| - // Preserve the function.
|
| - __ push(a1);
|
| - // Push call kind information.
|
| - __ push(t1);
|
| -
|
| - // Push the function on the stack as the argument to the runtime function.
|
| - __ push(a1);
|
| - __ CallRuntime(Runtime::kInstallRecompiledCode, 1);
|
| - // Calculate the entry point.
|
| - __ Addu(t9, v0, Operand(Code::kHeaderSize - kHeapObjectTag));
|
| -
|
| - // Restore call kind information.
|
| - __ pop(t1);
|
| - // Restore saved function.
|
| - __ pop(a1);
|
| -
|
| - // Tear down temporary frame.
|
| - }
|
| + // Checking whether the queued function is ready for install is optional,
|
| + // since we come across interrupts and stack checks elsewhere. However,
|
| + // not checking may delay installing ready functions, and always checking
|
| + // would be quite expensive. A good compromise is to first check against
|
| + // stack limit as a cue for an interrupt signal.
|
| + Label ok;
|
| + __ LoadRoot(t0, Heap::kStackLimitRootIndex);
|
| + __ Branch(&ok, hs, sp, Operand(t0));
|
| +
|
| + CallRuntimePassFunction(masm, Runtime::kTryInstallRecompiledCode);
|
| + // Tail call to returned code.
|
| + __ Addu(at, v0, Operand(Code::kHeaderSize - kHeapObjectTag));
|
| + __ Jump(at);
|
|
|
| - // Do a tail-call of the compiled function.
|
| - __ Jump(t9);
|
| + __ bind(&ok);
|
| + GenerateTailCallToSharedCode(masm);
|
| }
|
|
|
|
|
| void Builtins::Generate_ConcurrentRecompile(MacroAssembler* masm) {
|
| - {
|
| - FrameScope scope(masm, StackFrame::INTERNAL);
|
| -
|
| - // Push a copy of the function onto the stack.
|
| - __ push(a1);
|
| - // Push call kind information.
|
| - __ push(t1);
|
| -
|
| - __ push(a1); // Function is also the parameter to the runtime call.
|
| - __ CallRuntime(Runtime::kConcurrentRecompile, 1);
|
| -
|
| - // Restore call kind information.
|
| - __ pop(t1);
|
| - // Restore receiver.
|
| - __ pop(a1);
|
| -
|
| - // Tear down internal frame.
|
| - }
|
| -
|
| + CallRuntimePassFunction(masm, Runtime::kConcurrentRecompile);
|
| GenerateTailCallToSharedCode(masm);
|
| }
|
|
|
| @@ -815,60 +801,17 @@ void Builtins::Generate_JSConstructEntryTrampoline(MacroAssembler* masm) {
|
|
|
|
|
| void Builtins::Generate_LazyCompile(MacroAssembler* masm) {
|
| - // Enter an internal frame.
|
| - {
|
| - FrameScope scope(masm, StackFrame::INTERNAL);
|
| -
|
| - // Preserve the function.
|
| - __ push(a1);
|
| - // Push call kind information.
|
| - __ push(t1);
|
| -
|
| - // Push the function on the stack as the argument to the runtime function.
|
| - __ push(a1);
|
| - // Call the runtime function.
|
| - __ CallRuntime(Runtime::kLazyCompile, 1);
|
| - // Calculate the entry point.
|
| - __ addiu(t9, v0, Code::kHeaderSize - kHeapObjectTag);
|
| -
|
| - // Restore call kind information.
|
| - __ pop(t1);
|
| - // Restore saved function.
|
| - __ pop(a1);
|
| -
|
| - // Tear down temporary frame.
|
| - }
|
| -
|
| + CallRuntimePassFunction(masm, Runtime::kLazyCompile);
|
| // Do a tail-call of the compiled function.
|
| + __ Addu(t9, v0, Operand(Code::kHeaderSize - kHeapObjectTag));
|
| __ Jump(t9);
|
| }
|
|
|
|
|
| void Builtins::Generate_LazyRecompile(MacroAssembler* masm) {
|
| - // Enter an internal frame.
|
| - {
|
| - FrameScope scope(masm, StackFrame::INTERNAL);
|
| -
|
| - // Preserve the function.
|
| - __ push(a1);
|
| - // Push call kind information.
|
| - __ push(t1);
|
| -
|
| - // Push the function on the stack as the argument to the runtime function.
|
| - __ push(a1);
|
| - __ CallRuntime(Runtime::kLazyRecompile, 1);
|
| - // Calculate the entry point.
|
| - __ Addu(t9, v0, Operand(Code::kHeaderSize - kHeapObjectTag));
|
| -
|
| - // Restore call kind information.
|
| - __ pop(t1);
|
| - // Restore saved function.
|
| - __ pop(a1);
|
| -
|
| - // Tear down temporary frame.
|
| - }
|
| -
|
| + CallRuntimePassFunction(masm, Runtime::kLazyRecompile);
|
| // Do a tail-call of the compiled function.
|
| + __ Addu(t9, v0, Operand(Code::kHeaderSize - kHeapObjectTag));
|
| __ Jump(t9);
|
| }
|
|
|
| @@ -890,14 +833,15 @@ static void GenerateMakeCodeYoungAgainCommon(MacroAssembler* masm) {
|
| // The following registers must be saved and restored when calling through to
|
| // the runtime:
|
| // a0 - contains return address (beginning of patch sequence)
|
| - // a1 - function object
|
| + // a1 - isolate
|
| RegList saved_regs =
|
| (a0.bit() | a1.bit() | ra.bit() | fp.bit()) & ~sp.bit();
|
| FrameScope scope(masm, StackFrame::MANUAL);
|
| __ MultiPush(saved_regs);
|
| - __ PrepareCallCFunction(1, 0, a1);
|
| + __ PrepareCallCFunction(1, 0, a2);
|
| + __ li(a1, Operand(ExternalReference::isolate_address(masm->isolate())));
|
| __ CallCFunction(
|
| - ExternalReference::get_make_code_young_function(masm->isolate()), 1);
|
| + ExternalReference::get_make_code_young_function(masm->isolate()), 2);
|
| __ MultiPop(saved_regs);
|
| __ Jump(a0);
|
| }
|
|
|