Commit c2f4498f authored by jkummerow's avatar jkummerow Committed by Commit bot

Mark Number and String as strict functions

As required by #sec-built-in-function-objects.
They were strict functions before (see
e2f1c269), but that got lost when they
were ported to ASM builtins.
This makes optimized and non-optimized code agree on the same behavior
in regress-105.js.

BUG=v8:105,v8:5778,v8:6325

Review-Url: https://codereview.chromium.org/2848313004
Cr-Commit-Position: refs/heads/master@{#45012}
parent 26cf06bb
......@@ -1595,6 +1595,10 @@ void Genesis::InitializeGlobal(Handle<JSGlobalObject> global_object,
number_fun->shared()->SetConstructStub(
*isolate->builtins()->NumberConstructor_ConstructStub());
number_fun->shared()->set_length(1);
// https://tc39.github.io/ecma262/#sec-built-in-function-objects says
// that "Built-in functions that are ECMAScript function objects must
// be strict functions".
number_fun->shared()->set_language_mode(STRICT);
InstallWithIntrinsicDefaultProto(isolate, number_fun,
Context::NUMBER_FUNCTION_INDEX);
......@@ -1740,6 +1744,10 @@ void Genesis::InitializeGlobal(Handle<JSGlobalObject> global_object,
*isolate->builtins()->StringConstructor_ConstructStub());
string_fun->shared()->DontAdaptArguments();
string_fun->shared()->set_length(1);
// https://tc39.github.io/ecma262/#sec-built-in-function-objects says
// that "Built-in functions that are ECMAScript function objects must
// be strict functions".
string_fun->shared()->set_language_mode(STRICT);
InstallWithIntrinsicDefaultProto(isolate, string_fun,
Context::STRING_FUNCTION_INDEX);
......
......@@ -186,10 +186,6 @@
# which makes the test useless.
'big-object-literal': [PASS, ['mode == debug', SKIP]],
# BUG(v8:5778): These fail with --future, which we are about to turn on.
# Investigate.
'regress/regress-105': [SKIP],
# BUG(v8:6101): This fails because of a hole deopt, need to investigate.
'getters-on-elements': [SKIP],
......
......@@ -26,12 +26,12 @@
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
var custom_valueOf = function() {
assertEquals(Number, custom_valueOf.caller);
assertEquals(null, custom_valueOf.caller);
return 2;
}
var custom_toString = function() {
assertEquals(String, custom_toString.caller);
assertEquals(null, custom_toString.caller);
return "I used to be an adventurer like you";
}
......
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