[stubs] Simplify the non-function case of CallConstructStub.
authorbmeurer <bmeurer@chromium.org>
Fri, 11 Sep 2015 09:45:04 +0000 (02:45 -0700)
committerCommit bot <commit-bot@chromium.org>
Fri, 11 Sep 2015 09:45:21 +0000 (09:45 +0000)
commit622fa0ea21b3517b1feaed447c87e580bafac865
treee13d1387f5c068610a1cc1fdc3483de0cd004b82
parent8043a53a0732fabdd295c8d763b97d4333f51874
[stubs] Simplify the non-function case of CallConstructStub.

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).

R=mstarzinger@chromium.org

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

Cr-Commit-Position: refs/heads/master@{#30691}
14 files changed:
src/arm/code-stubs-arm.cc
src/arm64/code-stubs-arm64.cc
src/contexts.h
src/full-codegen/arm/full-codegen-arm.cc
src/full-codegen/arm64/full-codegen-arm64.cc
src/full-codegen/ia32/full-codegen-ia32.cc
src/full-codegen/mips/full-codegen-mips.cc
src/full-codegen/mips64/full-codegen-mips64.cc
src/full-codegen/x64/full-codegen-x64.cc
src/ia32/code-stubs-ia32.cc
src/mips/code-stubs-mips.cc
src/mips64/code-stubs-mips64.cc
src/runtime.js
src/x64/code-stubs-x64.cc