Commit d1ca0121 authored by balazs.kilvady's avatar balazs.kilvady Committed by Commit bot

MIPS: Refine '[stubs] Simplify the non-function case of CallConstructStub.'

Port 622fa0ea

Original commit message:
Currently we do this dance between the CallConstructStub, the
CALL_* builtins and the %GetConstructorDelegate, %GetProxyTrap,
and %Apply runtime functions for every [[Construct]] operation on
non-function callables. This is complexity is unnecessary, and can
be simplified to work without any JS builtin. This will also make it
a lot easier to implement ES6 compliant [[Construct]] for proxies.

Also sanitize the invariant for CallConstructStub, which up until now
always restored the context itself, but that force us to always create
another copy of all arguments in case of proxies and other callables,
so we can relax that constraint by making the caller restore the context
(this only affects fullcodegen, since the optimizing compilers already
properly restore the context anyway).

BUG=

Review URL: https://codereview.chromium.org/1340553002

Cr-Commit-Position: refs/heads/master@{#30699}
parent 31026cd5
...@@ -2671,12 +2671,12 @@ void CallConstructStub::Generate(MacroAssembler* masm) { ...@@ -2671,12 +2671,12 @@ void CallConstructStub::Generate(MacroAssembler* masm) {
{ {
// Determine the delegate for the target (if any). // Determine the delegate for the target (if any).
FrameScope scope(masm, StackFrame::INTERNAL); FrameScope scope(masm, StackFrame::INTERNAL);
__ sll(a0, a0, kSmiTagSize); // Smi tagged. __ SmiTag(a0);
__ Push(a0, a1); __ Push(a0, a1);
__ CallRuntime(Runtime::kGetConstructorDelegate, 1); __ CallRuntime(Runtime::kGetConstructorDelegate, 1);
__ mov(a1, v0); __ mov(a1, v0);
__ Pop(a0); __ Pop(a0);
__ sra(a0, a0, kSmiTagSize); // Un-tag. __ SmiUntag(a0);
} }
// The delegate is always a regular function. // The delegate is always a regular function.
__ AssertFunction(a1); __ AssertFunction(a1);
......
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