Commit 1e18c55e authored by zhengxing.li's avatar zhengxing.li Committed by Commit bot

X87: [builtins] Introduce a proper BUILTIN frame type.

  port f47b9e98 (r37051)

  original commit message:
  This adds a new BUILTIN frame type, which supports variable number of
  arguments for builtins implemented in hand-written native code (we will
  extend this mechanism to TurboFan builtins at some point). Convert the
  Math.max and Math.min builtins to construct a BUILTIN frame if required.

  This does not yet work for C++ builtins, but that'll be the next step.

BUG=

Review-Url: https://codereview.chromium.org/2096283003
Cr-Commit-Position: refs/heads/master@{#37270}
parent 9714c98f
......@@ -1570,6 +1570,8 @@ void Builtins::Generate_ArrayCode(MacroAssembler* masm) {
void Builtins::Generate_MathMaxMin(MacroAssembler* masm, MathMaxMinKind kind) {
// ----------- S t a t e -------------
// -- eax : number of arguments
// -- edi : function
// -- esi : context
// -- esp[0] : return address
// -- esp[(argc - n) * 8] : arg[n] (zero-based)
// -- esp[(argc + 1) * 8] : receiver
......@@ -1605,7 +1607,11 @@ void Builtins::Generate_MathMaxMin(MacroAssembler* masm, MathMaxMinKind kind) {
Heap::kHeapNumberMapRootIndex, &convert_number);
{
// Parameter is not a Number, use the ToNumber builtin to convert it.
FrameScope scope(masm, StackFrame::INTERNAL);
FrameScope scope(masm, StackFrame::MANUAL);
__ Push(ebp);
__ Move(ebp, esp);
__ Push(esi);
__ Push(edi);
__ SmiTag(eax);
__ SmiTag(ecx);
__ Push(eax);
......@@ -1617,6 +1623,8 @@ void Builtins::Generate_MathMaxMin(MacroAssembler* masm, MathMaxMinKind kind) {
__ Pop(edx);
__ Pop(ecx);
__ Pop(eax);
__ Pop(edi);
__ Pop(esi);
{
// Restore the double accumulator value (stX_0).
Label restore_smi, done_restore;
......@@ -1633,6 +1641,7 @@ void Builtins::Generate_MathMaxMin(MacroAssembler* masm, MathMaxMinKind kind) {
}
__ SmiUntag(ecx);
__ SmiUntag(eax);
__ leave();
}
__ jmp(&convert);
__ bind(&convert_number);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment