| Index: src/builtins/ia32/builtins-ia32.cc
|
| diff --git a/src/builtins/ia32/builtins-ia32.cc b/src/builtins/ia32/builtins-ia32.cc
|
| index bcffedfef2ba51010fbfff161b626e0b1a82a4a9..296b09093dbb5b06bdd9d14b9cde70b01a52e3ce 100644
|
| --- a/src/builtins/ia32/builtins-ia32.cc
|
| +++ b/src/builtins/ia32/builtins-ia32.cc
|
| @@ -1462,6 +1462,72 @@ void Builtins::Generate_NotifyStubFailureSaveDoubles(MacroAssembler* masm) {
|
| Generate_NotifyStubFailureHelper(masm, kSaveFPRegs);
|
| }
|
|
|
| +void Builtins::Generate_NotifyBuiltinContinuation(MacroAssembler* masm) {
|
| + // Enter an internal frame.
|
| + {
|
| + FrameScope scope(masm, StackFrame::INTERNAL);
|
| + // Preserve possible return result from lazy deopt.
|
| + __ push(eax);
|
| + __ CallRuntime(Runtime::kNotifyStubFailure, false);
|
| + __ pop(eax);
|
| + // Tear down internal frame.
|
| + }
|
| +
|
| + __ pop(MemOperand(esp, 0)); // Ignore state offset
|
| + __ ret(0); // Return to ContinueToBuiltin stub still on stack.
|
| +}
|
| +
|
| +namespace {
|
| +void Generate_ContinueToBuiltinHelper(MacroAssembler* masm,
|
| + bool java_script_builtin,
|
| + bool with_result) {
|
| + const RegisterConfiguration* config(RegisterConfiguration::Turbofan());
|
| + int allocatable_register_count = config->num_allocatable_general_registers();
|
| + if (with_result) {
|
| + // Overwrite the hole inserted by the deoptimizer with the return value from
|
| + // the LAZY deopt point.
|
| + __ mov(Operand(esp,
|
| + config->num_allocatable_general_registers() * kPointerSize +
|
| + BuiltinContinuationFrameConstants::kFixedFrameSize),
|
| + eax);
|
| + }
|
| + for (int i = allocatable_register_count - 1; i >= 0; --i) {
|
| + int code = config->GetAllocatableGeneralCode(i);
|
| + __ pop(Register::from_code(code));
|
| + if (java_script_builtin && code == kJavaScriptCallArgCountRegister.code()) {
|
| + __ SmiUntag(Register::from_code(code));
|
| + }
|
| + }
|
| + __ mov(
|
| + ebp,
|
| + Operand(esp, BuiltinContinuationFrameConstants::kFixedFrameSizeFromFp));
|
| + const int offsetToPC =
|
| + BuiltinContinuationFrameConstants::kFixedFrameSizeFromFp - kPointerSize;
|
| + __ pop(Operand(esp, offsetToPC));
|
| + __ Drop(offsetToPC / kPointerSize);
|
| + __ add(Operand(esp, 0), Immediate(Code::kHeaderSize - kHeapObjectTag));
|
| + __ ret(0);
|
| +}
|
| +} // namespace
|
| +
|
| +void Builtins::Generate_ContinueToCodeStubBuiltin(MacroAssembler* masm) {
|
| + Generate_ContinueToBuiltinHelper(masm, false, false);
|
| +}
|
| +
|
| +void Builtins::Generate_ContinueToCodeStubBuiltinWithResult(
|
| + MacroAssembler* masm) {
|
| + Generate_ContinueToBuiltinHelper(masm, false, true);
|
| +}
|
| +
|
| +void Builtins::Generate_ContinueToJavaScriptBuiltin(MacroAssembler* masm) {
|
| + Generate_ContinueToBuiltinHelper(masm, true, false);
|
| +}
|
| +
|
| +void Builtins::Generate_ContinueToJavaScriptBuiltinWithResult(
|
| + MacroAssembler* masm) {
|
| + Generate_ContinueToBuiltinHelper(masm, true, true);
|
| +}
|
| +
|
| static void Generate_NotifyDeoptimizedHelper(MacroAssembler* masm,
|
| Deoptimizer::BailoutType type) {
|
| {
|
|
|