Commit 6fe75e30 authored by Josh Wolfe's avatar Josh Wolfe Committed by Commit Bot

Reland: Enable --harmony-function-tostring by default

Update tests to work with new behavior.

Thanks Yang Guo for fixing the GC problem in
ad126d46

R=adamk@chromium.org, machenbach@chromium.org
Q_INCLUDE_TRYBOTS=master.tryserver.blink:linux_trusty_blink_rel

Bug: v8:4958
Change-Id: Ia7d9417f80087fb6df4ef877d0b4357875ee6c30
Reviewed-on: https://chromium-review.googlesource.com/834458Reviewed-by: 's avatarAdam Klein <adamk@chromium.org>
Commit-Queue: Josh Wolfe <jwolfe@igalia.com>
Cr-Commit-Position: refs/heads/master@{#50486}
parent 73253d42
...@@ -211,7 +211,6 @@ DEFINE_IMPLICATION(harmony_class_fields, harmony_static_fields) ...@@ -211,7 +211,6 @@ DEFINE_IMPLICATION(harmony_class_fields, harmony_static_fields)
// Features that are complete (but still behind --harmony/es-staging flag). // Features that are complete (but still behind --harmony/es-staging flag).
#define HARMONY_STAGED(V) \ #define HARMONY_STAGED(V) \
V(harmony_function_tostring, "harmony Function.prototype.toString") \
V(harmony_restrict_constructor_return, \ V(harmony_restrict_constructor_return, \
"harmony disallow non undefined primitive return value from class " \ "harmony disallow non undefined primitive return value from class " \
"constructor") \ "constructor") \
...@@ -225,6 +224,7 @@ DEFINE_IMPLICATION(harmony_class_fields, harmony_static_fields) ...@@ -225,6 +224,7 @@ DEFINE_IMPLICATION(harmony_class_fields, harmony_static_fields)
V(harmony_regexp_named_captures, "harmony regexp named captures") \ V(harmony_regexp_named_captures, "harmony regexp named captures") \
V(harmony_regexp_property, "harmony Unicode regexp property classes") \ V(harmony_regexp_property, "harmony Unicode regexp property classes") \
V(harmony_async_iteration, "harmony async iteration") \ V(harmony_async_iteration, "harmony async iteration") \
V(harmony_function_tostring, "harmony Function.prototype.toString") \
V(harmony_promise_finally, "harmony Promise.prototype.finally") V(harmony_promise_finally, "harmony Promise.prototype.finally")
#ifdef V8_INTL_SUPPORT #ifdef V8_INTL_SUPPORT
......
*%(basename)s:29: SyntaxError: Function arg string contains parenthesis undefined:1: SyntaxError: Arg string terminates parameters early
var paren_in_arg_string_bad = new Function(')', 'return;'); (function anonymous()
^ ^
SyntaxError: Function arg string contains parenthesis SyntaxError: Arg string terminates parameters early
at new Function (<anonymous>) at new Function (<anonymous>)
at *%(basename)s:29:31 at *%(basename)s:29:31
...@@ -153,7 +153,7 @@ async function* asyncGeneratorForToString() {} ...@@ -153,7 +153,7 @@ async function* asyncGeneratorForToString() {}
assertEquals("async function* asyncGeneratorForToString() {}", assertEquals("async function* asyncGeneratorForToString() {}",
asyncGeneratorForToString.toString()); asyncGeneratorForToString.toString());
assertEquals("async function* () {}", async function*() {}.toString()); assertEquals("async function*() {}", async function*() {}.toString());
assertEquals("async function* namedAsyncGeneratorForToString() {}", assertEquals("async function* namedAsyncGeneratorForToString() {}",
async function* namedAsyncGeneratorForToString() {}.toString()); async function* namedAsyncGeneratorForToString() {}.toString());
...@@ -164,9 +164,9 @@ assertEquals("async *method() { }", ...@@ -164,9 +164,9 @@ assertEquals("async *method() { }",
assertEquals("async *method() { }", assertEquals("async *method() { }",
(new (class { async *method() { } })).method.toString()); (new (class { async *method() { } })).method.toString());
assertEquals("async function* anonymous() {\n\n}", assertEquals("async function* anonymous(\n) {\n\n}",
AsyncGeneratorFunction().toString()); AsyncGeneratorFunction().toString());
assertEquals("async function* anonymous() {\n\n}", assertEquals("async function* anonymous(\n) {\n\n}",
(new AsyncGeneratorFunction()).toString()); (new AsyncGeneratorFunction()).toString());
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
......
...@@ -46,4 +46,4 @@ assertThrows('Function("a", "", "//", "//")', SyntaxError); ...@@ -46,4 +46,4 @@ assertThrows('Function("a", "", "//", "//")', SyntaxError);
// Some embedders rely on the string representation of the resulting // Some embedders rely on the string representation of the resulting
// function in cases where no formal parameters are specified. // function in cases where no formal parameters are specified.
var asString = Function("return 23").toString(); var asString = Function("return 23").toString();
assertSame("function anonymous() {\nreturn 23\n}", asString); assertSame("function anonymous(\n) {\nreturn 23\n}", asString);
...@@ -14,15 +14,16 @@ function test(expectation, f) { ...@@ -14,15 +14,16 @@ function test(expectation, f) {
} }
/* /*
(function() { (function(
) {
1 + reference_error //@ sourceURL=evaltest 1 + reference_error //@ sourceURL=evaltest
}) })
*/ */
test("2:5", new Function( test("3:5", new Function(
'1 + reference_error //@ sourceURL=evaltest')); '1 + reference_error //@ sourceURL=evaltest'));
/* /*
(function(x (function(x
/\**\/) { ) {
1 + reference_error //@ sourceURL=evaltest 1 + reference_error //@ sourceURL=evaltest
}) })
...@@ -34,7 +35,7 @@ test("4:6", new Function( ...@@ -34,7 +35,7 @@ test("4:6", new Function(
,z// ,z//
,y ,y
/\**\/) { ) {
1 + reference_error //@ sourceURL=evaltest 1 + reference_error //@ sourceURL=evaltest
}) })
...@@ -44,7 +45,7 @@ test("7:6", new Function( ...@@ -44,7 +45,7 @@ test("7:6", new Function(
/* /*
(function(x/\*,z// (function(x/\*,z//
,y*\/ ,y*\/
/\**\/) { ) {
1 + reference_error //@ sourceURL=evaltest 1 + reference_error //@ sourceURL=evaltest
}) })
*/ */
......
...@@ -4,5 +4,5 @@ ...@@ -4,5 +4,5 @@
function alert(x) {}; function alert(x) {};
assertThrows( assertThrows(
Function("a=`","`,xss=1){alert(xss)") 'Function("a=`","`,xss=1){alert(xss)")'
); );
...@@ -118,6 +118,10 @@ ...@@ -118,6 +118,10 @@
# Invalid according to ES2015 syntax. (Details: crbug.com/726625) # Invalid according to ES2015 syntax. (Details: crbug.com/726625)
'ecma_3/extensions/regress-368516': [FAIL], 'ecma_3/extensions/regress-368516': [FAIL],
# Function.prototype.toString revision.
# (https://chromium-review.googlesource.com/c/546941#message-5dc0f5efe277388501e8870e39ec70383dfc7db8)
'js1_5/Scope/regress-185485': [FAIL],
##################### SKIPPED TESTS ##################### ##################### SKIPPED TESTS #####################
# This test checks that we behave properly in an out-of-memory # This test checks that we behave properly in an out-of-memory
......
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