Index: src/ia32/builtins-ia32.cc |
diff --git a/src/ia32/builtins-ia32.cc b/src/ia32/builtins-ia32.cc |
index 7b44bc0d34d51cf8db2719fdfb7c201a9a2a76a1..650d0e32b32b68c573b94c6a42d645e3544790e8 100644 |
--- a/src/ia32/builtins-ia32.cc |
+++ b/src/ia32/builtins-ia32.cc |
@@ -74,8 +74,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. |
__ push(edi); |
@@ -100,7 +100,13 @@ static void GenerateTailCallToSharedCode(MacroAssembler* masm) { |
} |
-void Builtins::Generate_InRecompileQueue(MacroAssembler* masm) { |
+static void GenerateTailCallToReturnedCode(MacroAssembler* masm) { |
+ __ lea(eax, FieldOperand(eax, Code::kHeaderSize)); |
+ __ jmp(eax); |
+} |
+ |
+ |
+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 |
@@ -112,22 +118,14 @@ void Builtins::Generate_InRecompileQueue(MacroAssembler* masm) { |
__ cmp(esp, Operand::StaticVariable(stack_limit)); |
__ j(above_equal, &ok, Label::kNear); |
- CallRuntimePassFunction(masm, Runtime::kTryInstallRecompiledCode); |
- // Tail call to returned code. |
- __ lea(eax, FieldOperand(eax, Code::kHeaderSize)); |
- __ jmp(eax); |
+ 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) { |
@@ -509,19 +507,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(eax, FieldOperand(eax, Code::kHeaderSize)); |
- __ jmp(eax); |
+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(eax, FieldOperand(eax, Code::kHeaderSize)); |
- __ jmp(eax); |
+ |
+static void CallCompileOptimized(MacroAssembler* masm, bool concurrent) { |
+ FrameScope scope(masm, StackFrame::INTERNAL); |
+ // Push a copy of the function. |
+ __ push(edi); |
+ // Push call kind information. |
+ __ push(ecx); |
+ // Function is also the parameter to the runtime call. |
+ __ push(edi); |
+ // Whether to compile in a background thread. |
+ __ Push(masm->isolate()->factory()->ToBoolean(concurrent)); |
+ |
+ __ CallRuntime(Runtime::kCompileOptimized, 2); |
+ // Restore call kind information. |
+ __ pop(ecx); |
+ // Restore receiver. |
+ __ pop(edi); |
+} |
+ |
+ |
+void Builtins::Generate_CompileOptimized(MacroAssembler* masm) { |
+ CallCompileOptimized(masm, false); |
+ GenerateTailCallToReturnedCode(masm); |
+} |
+ |
+ |
+void Builtins::Generate_CompileOptimizedConcurrent(MacroAssembler* masm) { |
+ CallCompileOptimized(masm, true); |
+ GenerateTailCallToReturnedCode(masm); |
} |