| Index: src/s390/builtins-s390.cc
|
| diff --git a/src/s390/builtins-s390.cc b/src/s390/builtins-s390.cc
|
| index 4ffd1528c4c4f7fd0ea07e571b2d76b37929ed33..f722d16288d5b48b984c9c758d60caeb4ca32f59 100644
|
| --- a/src/s390/builtins-s390.cc
|
| +++ b/src/s390/builtins-s390.cc
|
| @@ -1396,6 +1396,43 @@ void Builtins::Generate_CompileOptimizedConcurrent(MacroAssembler* masm) {
|
| GenerateTailCallToReturnedCode(masm, Runtime::kCompileOptimized_Concurrent);
|
| }
|
|
|
| +void Builtins::Generate_InstantiateAsmJs(MacroAssembler* masm) {
|
| + // ----------- S t a t e -------------
|
| + // -- r2 : argument count (preserved for callee)
|
| + // -- r3 : new target (preserved for callee)
|
| + // -- r5 : target function (preserved for callee)
|
| + // -----------------------------------
|
| + Label failed;
|
| + {
|
| + FrameScope scope(masm, StackFrame::INTERNAL);
|
| + // Push a copy of the target function and the new target.
|
| + __ SmiTag(r2);
|
| + // Push another copy as a parameter to the runtime call.
|
| + __ Push(r2, r3, r5, r3);
|
| +
|
| + // Copy arguments from caller (stdlib, foreign, heap).
|
| + for (int i = 2; i >= 0; --i) {
|
| + __ LoadP(r4, MemOperand(fp, StandardFrameConstants::kCallerSPOffset +
|
| + i * kPointerSize));
|
| + __ push(r4);
|
| + }
|
| + // Call runtime, on success unwind frame, and parent frame.
|
| + __ CallRuntime(Runtime::kInstantiateAsmJs, 4);
|
| + // A smi 0 is returned on failure, an object on success.
|
| + __ JumpIfSmi(r2, &failed);
|
| + scope.GenerateLeaveFrame();
|
| + __ Drop(4);
|
| + __ Ret();
|
| +
|
| + __ bind(&failed);
|
| + // Restore target function and new target.
|
| + __ Pop(r2, r3, r5);
|
| + __ SmiUntag(r2);
|
| + }
|
| + // On failure, tail call back to regular js.
|
| + GenerateTailCallToReturnedCode(masm, Runtime::kCompileLazy);
|
| +}
|
| +
|
| static void GenerateMakeCodeYoungAgainCommon(MacroAssembler* masm) {
|
| // For now, we are relying on the fact that make_code_young doesn't do any
|
| // garbage collection which allows us to save/restore the registers without
|
|
|