Chromium Code Reviews| Index: src/arm/builtins-arm.cc |
| diff --git a/src/arm/builtins-arm.cc b/src/arm/builtins-arm.cc |
| index 4b658458a28aa462d7444c225b2fbb7cb66b9c19..71c69bdd12ff48e45d7575e4b6fa98a67b2fb45f 100644 |
| --- a/src/arm/builtins-arm.cc |
| +++ b/src/arm/builtins-arm.cc |
| @@ -289,19 +289,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(r1); |
| - // Push call kind information and function as parameter to the runtime call. |
| - __ Push(r5, r1); |
| - |
| - __ CallRuntime(function_id, 1); |
| - // Restore call kind information. |
| - __ pop(r5); |
| - // Restore receiver. |
| - __ pop(r1); |
| +static void CallRuntimePassFunctionAndTailCall( |
|
titzer
2013/12/09 14:49:28
Maybe split this into a CallRuntimeWithFunction an
Yang
2013/12/10 11:22:04
Done.
|
| + 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 and function as parameter to the runtime call. |
| + __ Push(r5, r1); |
| + |
| + __ CallRuntime(function_id, 1); |
| + // Restore call kind information. |
| + __ pop(r5); |
| + // Restore receiver. |
| + __ pop(r1); |
| + } |
| + |
| + // Tail call to returned code. |
| + __ add(r0, r0, Operand(Code::kHeaderSize - kHeapObjectTag)); |
| + __ Jump(r0); |
| } |
| @@ -313,7 +318,7 @@ static void GenerateTailCallToSharedCode(MacroAssembler* masm) { |
| } |
| -void Builtins::Generate_InRecompileQueue(MacroAssembler* masm) { |
| +void Builtins::Generate_InOptimizationQueue(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 |
| @@ -324,22 +329,13 @@ void Builtins::Generate_InRecompileQueue(MacroAssembler* masm) { |
| __ 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); |
| + CallRuntimePassFunctionAndTailCall(masm, Runtime::kTryInstallOptimizedCode); |
| __ bind(&ok); |
| GenerateTailCallToSharedCode(masm); |
| } |
| -void Builtins::Generate_ConcurrentRecompile(MacroAssembler* masm) { |
| - CallRuntimePassFunction(masm, Runtime::kConcurrentRecompile); |
| - GenerateTailCallToSharedCode(masm); |
| -} |
| - |
| - |
| static void Generate_JSConstructStubHelper(MacroAssembler* masm, |
| bool is_api_function, |
| bool count_constructions) { |
| @@ -775,18 +771,40 @@ void Builtins::Generate_JSConstructEntryTrampoline(MacroAssembler* masm) { |
| void Builtins::Generate_LazyCompile(MacroAssembler* masm) { |
| - CallRuntimePassFunction(masm, Runtime::kLazyCompile); |
| - // Do a tail-call of the compiled function. |
| - __ add(r2, r0, Operand(Code::kHeaderSize - kHeapObjectTag)); |
| - __ Jump(r2); |
| + CallRuntimePassFunctionAndTailCall(masm, Runtime::kCompileUnoptimized); |
| } |
| -void Builtins::Generate_LazyRecompile(MacroAssembler* masm) { |
| - CallRuntimePassFunction(masm, Runtime::kLazyRecompile); |
| - // Do a tail-call of the compiled function. |
| - __ add(r2, r0, Operand(Code::kHeaderSize - kHeapObjectTag)); |
| - __ Jump(r2); |
| +static void CallCompileOptimizedAndTailCall(MacroAssembler* masm, |
| + bool concurrent) { |
| + { FrameScope scope(masm, StackFrame::INTERNAL); |
|
titzer
2013/12/09 14:49:28
This is an almost exact copy of CallRuntimePassFun
Yang
2013/12/10 11:22:04
I thought it would make things unnecessarily compl
|
| + // Push a copy of the function onto the stack. |
| + __ push(r1); |
| + // Push call kind information and function as parameter to the runtime call. |
| + __ Push(r5, r1); |
| + // Whether to compile in a background thread. |
| + __ Push(masm->isolate()->factory()->ToBoolean(concurrent)); |
| + |
| + __ CallRuntime(Runtime::kCompileOptimized, 2); |
| + // Restore call kind information. |
| + __ pop(r5); |
| + // Restore receiver. |
| + __ pop(r1); |
| + } |
| + |
| + // Tail call to returned code. |
| + __ add(r0, r0, Operand(Code::kHeaderSize - kHeapObjectTag)); |
| + __ Jump(r0); |
| +} |
| + |
| + |
| +void Builtins::Generate_CompileOptimized(MacroAssembler* masm) { |
| + CallCompileOptimizedAndTailCall(masm, false); |
| +} |
| + |
| + |
| +void Builtins::Generate_CompileOptimizedConcurrent(MacroAssembler* masm) { |
| + CallCompileOptimizedAndTailCall(masm, true); |
| } |