[builtins] Unify the String constructor.
authorbmeurer <bmeurer@chromium.org>
Wed, 16 Sep 2015 10:44:36 +0000 (03:44 -0700)
committerCommit bot <commit-bot@chromium.org>
Wed, 16 Sep 2015 10:44:47 +0000 (10:44 +0000)
commita3d6f6cce317dbe1d31079eb81e15e49f3fb687a
tree6c50c22edd55198bf11531ee1142ea78d0948d25
parent905e008c52ba06120f4a523aab00a53bc50830f1
[builtins] Unify the String constructor.

Implement the String constructor completely as native builtin,
avoiding the need to do gymnastics in JavaScript builtin to
properly detect the no argument case (which is different from
the undefined argument case) and also allowing to just
tailcall through to ToString or SymbolDescriptiveString for
the common case. Also the JavaScript builtin was misleading
since the case for construct call was unused, but could be
triggered in a wrong way once we support tail calls from
constructor functions.

This refactoring allows us to properly implement subclassing
for String builtins, once we have the correct initial_map on
derived classes (it's merely a matter of using NewTarget
instead of the target register now).

This introduces a new %SymbolDescriptiveString runtime
entry, which is also used by Symbol.toString() now.

R=mstarzinger@chromium.org

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

Cr-Commit-Position: refs/heads/master@{#30759}
12 files changed:
src/arm/builtins-arm.cc
src/arm64/builtins-arm64.cc
src/bootstrapper.cc
src/builtins.h
src/ia32/builtins-ia32.cc
src/mips/builtins-mips.cc
src/mips64/builtins-mips64.cc
src/runtime/runtime-symbol.cc
src/runtime/runtime.h
src/string.js
src/symbol.js
src/x64/builtins-x64.cc