| Index: src/arm/builtins-arm.cc
|
| diff --git a/src/arm/builtins-arm.cc b/src/arm/builtins-arm.cc
|
| index a8e1df3b4d5dc46c21c850737bd2cfd825de330e..2fd792a01bd3c398f88bcc22eb320f447da1047f 100644
|
| --- a/src/arm/builtins-arm.cc
|
| +++ b/src/arm/builtins-arm.cc
|
| @@ -1418,6 +1418,48 @@ void Builtins::Generate_CompileOptimizedConcurrent(MacroAssembler* masm) {
|
| GenerateTailCallToReturnedCode(masm, Runtime::kCompileOptimized_Concurrent);
|
| }
|
|
|
| +void Builtins::Generate_InstantiateAsmJs(MacroAssembler* masm) {
|
| + // ----------- S t a t e -------------
|
| + // -- r0 : argument count (preserved for callee)
|
| + // -- r1 : new target (preserved for callee)
|
| + // -- r3 : target function (preserved for callee)
|
| + // -----------------------------------
|
| + Label failed;
|
| + {
|
| + FrameScope scope(masm, StackFrame::INTERNAL);
|
| + // Push the number of arguments to the callee.
|
| + __ SmiTag(r0);
|
| + __ push(r0);
|
| + // Push a copy of the target function and the new target.
|
| + __ push(r1);
|
| + __ push(r3);
|
| +
|
| + // The function.
|
| + __ push(r1);
|
| + // Copy arguments from caller (stdlib, foreign, heap).
|
| + for (int i = 2; i >= 0; --i) {
|
| + __ ldr(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(r0, &failed);
|
| + scope.GenerateLeaveFrame();
|
| + __ Drop(4);
|
| + __ Ret();
|
| +
|
| + __ bind(&failed);
|
| + // Restore target function and new target.
|
| + __ pop(r3);
|
| + __ pop(r1);
|
| + __ pop(r0);
|
| + __ SmiUntag(r0);
|
| + }
|
| + // 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
|
|
|