| Index: src/arm/builtins-arm.cc
|
| diff --git a/src/arm/builtins-arm.cc b/src/arm/builtins-arm.cc
|
| index e0c37e1a9ff82d03427e04e3e5acf184b2dc2c06..b7a343fd6121ef76b919eef35a3158e5024bd580 100644
|
| --- a/src/arm/builtins-arm.cc
|
| +++ b/src/arm/builtins-arm.cc
|
| @@ -291,68 +291,55 @@ 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(r1);
|
| + // Push call kind information.
|
| + __ push(r5);
|
| + // Function is also the parameter to the runtime call.
|
| + __ push(r1);
|
| +
|
| + __ CallRuntime(function_id, 1);
|
| + // Restore call kind information.
|
| + __ pop(r5);
|
| + // Restore receiver.
|
| + __ pop(r1);
|
| +}
|
| +
|
| +
|
| static void GenerateTailCallToSharedCode(MacroAssembler* masm) {
|
| __ ldr(r2, FieldMemOperand(r1, JSFunction::kSharedFunctionInfoOffset));
|
| __ ldr(r2, FieldMemOperand(r2, SharedFunctionInfo::kCodeOffset));
|
| __ add(r2, r2, Operand(Code::kHeaderSize - kHeapObjectTag));
|
| - __ mov(pc, r2);
|
| + __ Jump(r2);
|
| }
|
|
|
|
|
| void Builtins::Generate_InRecompileQueue(MacroAssembler* masm) {
|
| + // 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(ip, Heap::kStackLimitRootIndex);
|
| + __ cmp(sp, Operand(ip));
|
| + __ b(hs, &ok);
|
| +
|
| + CallRuntimePassFunction(masm, Runtime::kTryInstallRecompiledCode);
|
| + // Tail call to returned code.
|
| + __ add(r0, r0, Operand(Code::kHeaderSize - kHeapObjectTag));
|
| + __ Jump(r0);
|
| +
|
| + __ bind(&ok);
|
| GenerateTailCallToSharedCode(masm);
|
| }
|
|
|
|
|
| -void Builtins::Generate_InstallRecompiledCode(MacroAssembler* masm) {
|
| - // Enter an internal frame.
|
| - {
|
| - FrameScope scope(masm, StackFrame::INTERNAL);
|
| -
|
| - // Preserve the function.
|
| - __ push(r1);
|
| - // Push call kind information.
|
| - __ push(r5);
|
| -
|
| - // Push the function on the stack as the argument to the runtime function.
|
| - __ push(r1);
|
| - __ CallRuntime(Runtime::kInstallRecompiledCode, 1);
|
| - // Calculate the entry point.
|
| - __ add(r2, r0, Operand(Code::kHeaderSize - kHeapObjectTag));
|
| -
|
| - // Restore call kind information.
|
| - __ pop(r5);
|
| - // Restore saved function.
|
| - __ pop(r1);
|
| -
|
| - // Tear down internal frame.
|
| - }
|
| -
|
| - // Do a tail-call of the compiled function.
|
| - __ Jump(r2);
|
| -}
|
| -
|
| -
|
| void Builtins::Generate_ConcurrentRecompile(MacroAssembler* masm) {
|
| - {
|
| - FrameScope scope(masm, StackFrame::INTERNAL);
|
| -
|
| - // Push a copy of the function onto the stack.
|
| - __ push(r1);
|
| - // Push call kind information.
|
| - __ push(r5);
|
| -
|
| - __ push(r1); // Function is also the parameter to the runtime call.
|
| - __ CallRuntime(Runtime::kConcurrentRecompile, 1);
|
| -
|
| - // Restore call kind information.
|
| - __ pop(r5);
|
| - // Restore receiver.
|
| - __ pop(r1);
|
| -
|
| - // Tear down internal frame.
|
| - }
|
| -
|
| + CallRuntimePassFunction(masm, Runtime::kConcurrentRecompile);
|
| GenerateTailCallToSharedCode(masm);
|
| }
|
|
|
| @@ -795,59 +782,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(r1);
|
| - // Push call kind information.
|
| - __ push(r5);
|
| -
|
| - // Push the function on the stack as the argument to the runtime function.
|
| - __ push(r1);
|
| - __ CallRuntime(Runtime::kLazyCompile, 1);
|
| - // Calculate the entry point.
|
| - __ add(r2, r0, Operand(Code::kHeaderSize - kHeapObjectTag));
|
| -
|
| - // Restore call kind information.
|
| - __ pop(r5);
|
| - // Restore saved function.
|
| - __ pop(r1);
|
| -
|
| - // Tear down internal frame.
|
| - }
|
| -
|
| + CallRuntimePassFunction(masm, Runtime::kLazyCompile);
|
| // Do a tail-call of the compiled function.
|
| + __ add(r2, r0, Operand(Code::kHeaderSize - kHeapObjectTag));
|
| __ Jump(r2);
|
| }
|
|
|
|
|
| void Builtins::Generate_LazyRecompile(MacroAssembler* masm) {
|
| - // Enter an internal frame.
|
| - {
|
| - FrameScope scope(masm, StackFrame::INTERNAL);
|
| -
|
| - // Preserve the function.
|
| - __ push(r1);
|
| - // Push call kind information.
|
| - __ push(r5);
|
| -
|
| - // Push the function on the stack as the argument to the runtime function.
|
| - __ push(r1);
|
| - __ CallRuntime(Runtime::kLazyRecompile, 1);
|
| - // Calculate the entry point.
|
| - __ add(r2, r0, Operand(Code::kHeaderSize - kHeapObjectTag));
|
| -
|
| - // Restore call kind information.
|
| - __ pop(r5);
|
| - // Restore saved function.
|
| - __ pop(r1);
|
| -
|
| - // Tear down internal frame.
|
| - }
|
| -
|
| + CallRuntimePassFunction(masm, Runtime::kLazyRecompile);
|
| // Do a tail-call of the compiled function.
|
| + __ add(r2, r0, Operand(Code::kHeaderSize - kHeapObjectTag));
|
| __ Jump(r2);
|
| }
|
|
|
| @@ -862,12 +807,13 @@ static void GenerateMakeCodeYoungAgainCommon(MacroAssembler* masm) {
|
| // The following registers must be saved and restored when calling through to
|
| // the runtime:
|
| // r0 - contains return address (beginning of patch sequence)
|
| - // r1 - function object
|
| + // r1 - isolate
|
| FrameScope scope(masm, StackFrame::MANUAL);
|
| __ stm(db_w, sp, r0.bit() | r1.bit() | fp.bit() | lr.bit());
|
| - __ PrepareCallCFunction(1, 0, r1);
|
| + __ PrepareCallCFunction(1, 0, r2);
|
| + __ mov(r1, 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);
|
| __ ldm(ia_w, sp, r0.bit() | r1.bit() | fp.bit() | lr.bit());
|
| __ mov(pc, r0);
|
| }
|
|
|