Index: src/x64/builtins-x64.cc |
diff --git a/src/x64/builtins-x64.cc b/src/x64/builtins-x64.cc |
index aef91640a01687f133f5dcd68770c416b278968b..9858d65c5fce69674b58d9272a0b9e46a7aa628d 100644 |
--- a/src/x64/builtins-x64.cc |
+++ b/src/x64/builtins-x64.cc |
@@ -73,8 +73,8 @@ void Builtins::Generate_Adaptor(MacroAssembler* masm, |
} |
-static void CallRuntimePassFunction(MacroAssembler* masm, |
- Runtime::FunctionId function_id) { |
+static void CallRuntimePassFunction( |
+ MacroAssembler* masm, Runtime::FunctionId function_id) { |
FrameScope scope(masm, StackFrame::INTERNAL); |
// Push a copy of the function onto the stack. |
__ push(rdi); |
@@ -101,7 +101,13 @@ static void GenerateTailCallToSharedCode(MacroAssembler* masm) { |
} |
-void Builtins::Generate_InRecompileQueue(MacroAssembler* masm) { |
+static void GenerateTailCallToReturnedCode(MacroAssembler* masm) { |
+ __ lea(rax, FieldOperand(rax, Code::kHeaderSize)); |
+ __ jmp(rax); |
+} |
+ |
+ |
+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 |
@@ -111,22 +117,14 @@ void Builtins::Generate_InRecompileQueue(MacroAssembler* masm) { |
__ CompareRoot(rsp, Heap::kStackLimitRootIndex); |
__ j(above_equal, &ok); |
- CallRuntimePassFunction(masm, Runtime::kTryInstallRecompiledCode); |
- // Tail call to returned code. |
- __ lea(rax, FieldOperand(rax, Code::kHeaderSize)); |
- __ jmp(rax); |
+ CallRuntimePassFunction(masm, Runtime::kTryInstallOptimizedCode); |
+ GenerateTailCallToReturnedCode(masm); |
__ 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) { |
@@ -573,19 +571,41 @@ void Builtins::Generate_JSConstructEntryTrampoline(MacroAssembler* masm) { |
} |
-void Builtins::Generate_LazyCompile(MacroAssembler* masm) { |
- CallRuntimePassFunction(masm, Runtime::kLazyCompile); |
- // Do a tail-call of the compiled function. |
- __ lea(rax, FieldOperand(rax, Code::kHeaderSize)); |
- __ jmp(rax); |
+void Builtins::Generate_CompileUnoptimized(MacroAssembler* masm) { |
+ CallRuntimePassFunction(masm, Runtime::kCompileUnoptimized); |
+ GenerateTailCallToReturnedCode(masm); |
} |
-void Builtins::Generate_LazyRecompile(MacroAssembler* masm) { |
- CallRuntimePassFunction(masm, Runtime::kLazyRecompile); |
- // Do a tail-call of the compiled function. |
- __ lea(rax, FieldOperand(rax, Code::kHeaderSize)); |
- __ jmp(rax); |
+static void CallCompileOptimized(MacroAssembler* masm, |
+ bool concurrent) { |
+ FrameScope scope(masm, StackFrame::INTERNAL); |
+ // Push a copy of the function onto the stack. |
+ __ push(rdi); |
+ // Push call kind information. |
+ __ push(rcx); |
+ // Function is also the parameter to the runtime call. |
+ __ push(rdi); |
+ // Whether to compile in a background thread. |
+ __ Push(masm->isolate()->factory()->ToBoolean(concurrent)); |
+ |
+ __ CallRuntime(Runtime::kCompileOptimized, 2); |
+ // Restore call kind information. |
+ __ pop(rcx); |
+ // Restore receiver. |
+ __ pop(rdi); |
+} |
+ |
+ |
+void Builtins::Generate_CompileOptimized(MacroAssembler* masm) { |
+ CallCompileOptimized(masm, false); |
+ GenerateTailCallToReturnedCode(masm); |
+} |
+ |
+ |
+void Builtins::Generate_CompileOptimizedConcurrent(MacroAssembler* masm) { |
+ CallCompileOptimized(masm, true); |
+ GenerateTailCallToReturnedCode(masm); |
} |