Index: src/mips/builtins-mips.cc |
diff --git a/src/mips/builtins-mips.cc b/src/mips/builtins-mips.cc |
index 5a21230c91b460b49a264382019e37a87af68d05..b2348fca20f150474874e700bcc4d2e6c1e85750 100644 |
--- a/src/mips/builtins-mips.cc |
+++ b/src/mips/builtins-mips.cc |
@@ -1255,12 +1255,35 @@ void Builtins::Generate_LazyRecompile(MacroAssembler* masm) { |
} |
-// Just a dummy for now, so snapshot generation works. |
static void GenerateMakeCodeYoungAgainCommon(MacroAssembler* masm) { |
- __ Ret(); |
+ // 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 |
+ // worrying about which of them contain pointers. We also don't build an |
+ // internal frame to make the code faster, since we shouldn't have to do stack |
+ // crawls in MakeCodeYoung. This seems a bit fragile. |
+ |
+ __ mov(a0, ra); |
+ // Adjust a0 to point to the head of the PlatformCodeAge sequence |
+ __ Subu(a0, a0, |
+ Operand((kNoCodeAgeSequenceLength - 1) * Assembler::kInstrSize)); |
+ // Restore the original return address of the function |
+ __ mov(ra, at); |
+ |
+ // The following registers must be saved and restored when calling through to |
+ // the runtime: |
+ // a0 - contains return address (beginning of patch sequence) |
+ // a1 - function object |
+ RegList saved_regs = |
+ (a0.bit() | a1.bit() | ra.bit() | fp.bit()) & ~sp.bit(); |
+ FrameScope scope(masm, StackFrame::MANUAL); |
+ __ MultiPush(saved_regs); |
+ __ PrepareCallCFunction(1, 0, a1); |
+ __ CallCFunction( |
+ ExternalReference::get_make_code_young_function(masm->isolate()), 1); |
+ __ MultiPop(saved_regs); |
+ __ Jump(a0); |
} |
- |
#define DEFINE_CODE_AGE_BUILTIN_GENERATOR(C) \ |
void Builtins::Generate_Make##C##CodeYoungAgainEvenMarking( \ |
MacroAssembler* masm) { \ |