Index: src/x64/builtins-x64.cc |
diff --git a/src/x64/builtins-x64.cc b/src/x64/builtins-x64.cc |
index c7d47e1737c0f9ff28e173917ada263a83e85c12..cfd4ecbc45871b8972ea4733773f4fbf2a44223d 100644 |
--- a/src/x64/builtins-x64.cc |
+++ b/src/x64/builtins-x64.cc |
@@ -1620,6 +1620,8 @@ void Builtins::Generate_ArrayCode(MacroAssembler* masm) { |
void Builtins::Generate_MathMaxMin(MacroAssembler* masm, MathMaxMinKind kind) { |
// ----------- S t a t e ------------- |
// -- rax : number of arguments |
+ // -- rdi : function |
+ // -- rsi : context |
// -- rsp[0] : return address |
// -- rsp[(argc - n) * 8] : arg[n] (zero-based) |
// -- rsp[(argc + 1) * 8] : receiver |
@@ -1655,7 +1657,11 @@ void Builtins::Generate_MathMaxMin(MacroAssembler* masm, MathMaxMinKind kind) { |
Heap::kHeapNumberMapRootIndex, &convert_number); |
{ |
// Parameter is not a Number, use the ToNumberStub to convert it. |
- FrameScope scope(masm, StackFrame::INTERNAL); |
+ FrameScope scope(masm, StackFrame::MANUAL); |
+ __ Push(rbp); |
+ __ Move(rbp, rsp); |
+ __ Push(rsi); |
+ __ Push(rdi); |
__ Integer32ToSmi(rax, rax); |
__ Integer32ToSmi(rcx, rcx); |
__ Push(rax); |
@@ -1668,6 +1674,8 @@ void Builtins::Generate_MathMaxMin(MacroAssembler* masm, MathMaxMinKind kind) { |
__ Pop(rdx); |
__ Pop(rcx); |
__ Pop(rax); |
+ __ Pop(rdi); |
+ __ Pop(rsi); |
{ |
// Restore the double accumulator value (xmm0). |
Label restore_smi, done_restore; |
@@ -1680,6 +1688,7 @@ void Builtins::Generate_MathMaxMin(MacroAssembler* masm, MathMaxMinKind kind) { |
} |
__ SmiToInteger32(rcx, rcx); |
__ SmiToInteger32(rax, rax); |
+ __ leave(); |
} |
__ jmp(&convert); |
__ bind(&convert_number); |