| Index: src/mips64/builtins-mips64.cc
 | 
| diff --git a/src/mips64/builtins-mips64.cc b/src/mips64/builtins-mips64.cc
 | 
| index 9f58745a4bee4d6f2f986f5dbea82bb615ccdef5..66da9cfd499c9593b36df893eb262f10ab8703aa 100644
 | 
| --- a/src/mips64/builtins-mips64.cc
 | 
| +++ b/src/mips64/builtins-mips64.cc
 | 
| @@ -1397,6 +1397,42 @@ void Builtins::Generate_CompileOptimizedConcurrent(MacroAssembler* masm) {
 | 
|    GenerateTailCallToReturnedCode(masm, Runtime::kCompileOptimized_Concurrent);
 | 
|  }
 | 
|  
 | 
| +void Builtins::Generate_InstantiateAsmJs(MacroAssembler* masm) {
 | 
| +  // ----------- S t a t e -------------
 | 
| +  //  -- a0 : argument count (preserved for callee)
 | 
| +  //  -- a1 : new target (preserved for callee)
 | 
| +  //  -- a3 : target function (preserved for callee)
 | 
| +  // -----------------------------------
 | 
| +  Label failed;
 | 
| +  {
 | 
| +    FrameScope scope(masm, StackFrame::INTERNAL);
 | 
| +    // Push a copy of the target function and the new target.
 | 
| +    // Push function as parameter to the runtime call.
 | 
| +    __ SmiTag(a0);
 | 
| +    __ Push(a0, a1, a3, a1);
 | 
| +
 | 
| +    // Copy arguments from caller (stdlib, foreign, heap).
 | 
| +    for (int i = 2; i >= 0; --i) {
 | 
| +      __ lw(a3, MemOperand(fp, StandardFrameConstants::kCallerSPOffset +
 | 
| +                                   i * kPointerSize));
 | 
| +      __ push(a3);
 | 
| +    }
 | 
| +    // 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(a0, &failed);
 | 
| +    scope.GenerateLeaveFrame();
 | 
| +    __ Drop(4);
 | 
| +    __ Ret();
 | 
| +
 | 
| +    __ bind(&failed);
 | 
| +    // Restore target function and new target.
 | 
| +    __ Pop(a0, a1, a3);
 | 
| +    __ SmiUntag(a0);
 | 
| +  }
 | 
| +  // 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
 | 
| 
 |