From 86bd2b3c23b562213d5af158849dcd65f347a827 Mon Sep 17 00:00:00 2001 From: machenbach Date: Tue, 24 Nov 2015 02:57:45 -0800 Subject: [PATCH] Revert of Disable non-standard Promise functions in staging (patchset #5 id:80001 of https://codereview.chromium.org/1469543003/ ) Reason for revert: [Sheriff] This breaks ignition on arm sim debug: https://build.chromium.org/p/client.v8/builders/V8%20Linux%20-%20arm%20-%20sim%20-%20debug/builds/5317 Seems to not be caught by the cq bot that builds release with dchecks. Original issue's description: > Disable non-standard Promise functions in staging > > This patch removes Promise functions and methods which are absent > from the ES2015 specification when the --es-staging flag is on. > > BUG=v8:3237 > R=rossberg > LOG=Y > > Committed: https://crrev.com/941251af7e04d50ac2243da2870249a42111221a > Cr-Commit-Position: refs/heads/master@{#32194} TBR=rossberg@chromium.org,littledan@chromium.org NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=v8:3237 Review URL: https://codereview.chromium.org/1473603002 Cr-Commit-Position: refs/heads/master@{#32199} --- BUILD.gn | 3 +- src/bootstrapper.cc | 6 ---- src/flag-definitions.h | 4 --- src/js/prologue.js | 3 -- src/js/promise-extra.js | 30 ------------------- src/js/promise.js | 14 +++------ test/mjsunit/es6/debug-promises/reentry.js | 2 +- .../debug-promises/reject-after-resolve.js | 2 +- .../es6/debug-promises/reject-caught-all.js | 2 +- .../es6/debug-promises/reject-caught-late.js | 2 +- .../debug-promises/reject-caught-uncaught.js | 2 +- .../es6/debug-promises/reject-uncaught-all.js | 2 +- .../reject-uncaught-uncaught.js | 2 +- .../reject-with-invalid-reject.js | 2 +- .../reject-with-throw-in-reject.js | 2 +- .../reject-with-undefined-reject.js | 2 +- .../es6/debug-promises/throw-caught-all.js | 2 +- .../es6/debug-promises/throw-caught-late.js | 2 +- .../debug-promises/throw-caught-uncaught.js | 2 +- .../es6/debug-promises/throw-uncaught-all.js | 2 +- .../debug-promises/throw-uncaught-uncaught.js | 2 +- .../throw-with-throw-in-reject.js | 2 +- .../throw-with-undefined-reject.js | 2 +- test/mjsunit/es6/promise-internal-setter.js | 2 -- test/mjsunit/es6/promises.js | 2 +- test/mjsunit/es6/regress/regress-cr372788.js | 2 +- tools/gyp/v8.gyp | 1 - 27 files changed, 24 insertions(+), 77 deletions(-) delete mode 100644 src/js/promise-extra.js diff --git a/BUILD.gn b/BUILD.gn index 52140ffb8b..b5fe404e5e 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -320,8 +320,7 @@ action("js2c_experimental") { "src/js/harmony-reflect.js", "src/js/harmony-object-observe.js", "src/js/harmony-sharedarraybuffer.js", - "src/js/harmony-simd.js", - "src/js/promise-extra.js" + "src/js/harmony-simd.js" ] outputs = [ diff --git a/src/bootstrapper.cc b/src/bootstrapper.cc index 3a08b2f92e..afc25508e6 100644 --- a/src/bootstrapper.cc +++ b/src/bootstrapper.cc @@ -206,7 +206,6 @@ class Genesis BASE_EMBEDDED { HARMONY_INPROGRESS(DECLARE_FEATURE_INITIALIZATION) HARMONY_STAGED(DECLARE_FEATURE_INITIALIZATION) HARMONY_SHIPPING(DECLARE_FEATURE_INITIALIZATION) - DECLARE_FEATURE_INITIALIZATION(promise_extra, "") #undef DECLARE_FEATURE_INITIALIZATION Handle InstallInternalArray(Handle target, @@ -1525,7 +1524,6 @@ void Genesis::InitializeExperimentalGlobal() { HARMONY_INPROGRESS(FEATURE_INITIALIZE_GLOBAL) HARMONY_STAGED(FEATURE_INITIALIZE_GLOBAL) HARMONY_SHIPPING(FEATURE_INITIALIZE_GLOBAL) - FEATURE_INITIALIZE_GLOBAL(promise_extra, "") #undef FEATURE_INITIALIZE_GLOBAL } @@ -2065,7 +2063,6 @@ EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_completion) EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_tolength) EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_do_expressions) EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_regexp_lookbehind) -EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(promise_extra) static void SimpleInstallFunction(Handle base, Handle name, @@ -2599,8 +2596,6 @@ bool Genesis::InstallExperimentalNatives() { static const char* harmony_do_expressions_natives[] = {nullptr}; static const char* harmony_regexp_subclass_natives[] = {nullptr}; static const char* harmony_regexp_lookbehind_natives[] = {nullptr}; - static const char* promise_extra_natives[] = {"native promise-extra.js", - nullptr}; for (int i = ExperimentalNatives::GetDebuggerCount(); i < ExperimentalNatives::GetBuiltinsCount(); i++) { @@ -2619,7 +2614,6 @@ bool Genesis::InstallExperimentalNatives() { HARMONY_INPROGRESS(INSTALL_EXPERIMENTAL_NATIVES); HARMONY_STAGED(INSTALL_EXPERIMENTAL_NATIVES); HARMONY_SHIPPING(INSTALL_EXPERIMENTAL_NATIVES); - INSTALL_EXPERIMENTAL_NATIVES(promise_extra, ""); #undef INSTALL_EXPERIMENTAL_NATIVES } diff --git a/src/flag-definitions.h b/src/flag-definitions.h index 90af23bc26..c427eece92 100644 --- a/src/flag-definitions.h +++ b/src/flag-definitions.h @@ -189,10 +189,6 @@ DEFINE_BOOL(legacy_const, true, "legacy semantics for const in sloppy mode") // ES2015 const semantics are staged DEFINE_NEG_IMPLICATION(harmony, legacy_const) -DEFINE_BOOL(promise_extra, true, "additional V8 Promise functions") -// Removing extra Promise functions is staged -DEFINE_NEG_IMPLICATION(es_staging, promise_extra) - // Activate on ClusterFuzz. DEFINE_IMPLICATION(es_staging, harmony_destructuring_bind) diff --git a/src/js/prologue.js b/src/js/prologue.js index 6093069a5f..0f605be649 100644 --- a/src/js/prologue.js +++ b/src/js/prologue.js @@ -202,9 +202,6 @@ function PostNatives(utils) { "ObserveArrayMethods", "ObserveObjectMethods", "OwnPropertyKeys", - "PromiseChain", - "PromiseDeferred", - "PromiseResolved", "SameValueZero", "SetIterator", "SetIteratorNext", diff --git a/src/js/promise-extra.js b/src/js/promise-extra.js deleted file mode 100644 index 2613a500de..0000000000 --- a/src/js/promise-extra.js +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright 2015 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -(function(global, utils) { - -"use strict"; - -%CheckIsBootstrapping(); - -var GlobalPromise = global.Promise; - -var PromiseChain = utils.ImportNow("PromiseChain"); -var PromiseDeferred = utils.ImportNow("PromiseDeferred"); -var PromiseResolved = utils.ImportNow("PromiseResolved"); - -utils.InstallFunctions(GlobalPromise.prototype, DONT_ENUM, [ - "chain", PromiseChain, -]); - -%InstallToContext([ - "promise_chain", PromiseChain, -]); - -utils.InstallFunctions(GlobalPromise, DONT_ENUM, [ - "defer", PromiseDeferred, - "accept", PromiseResolved, -]); - -}) diff --git a/src/js/promise.js b/src/js/promise.js index 794f57b6fc..f0c9bb3b52 100644 --- a/src/js/promise.js +++ b/src/js/promise.js @@ -446,6 +446,8 @@ function PromiseHasUserDefinedRejectHandler() { DONT_ENUM | READ_ONLY); utils.InstallFunctions(GlobalPromise, DONT_ENUM, [ + "defer", PromiseDeferred, + "accept", PromiseResolved, "reject", PromiseRejected, "all", PromiseAll, "race", PromiseRace, @@ -453,12 +455,14 @@ utils.InstallFunctions(GlobalPromise, DONT_ENUM, [ ]); utils.InstallFunctions(GlobalPromise.prototype, DONT_ENUM, [ + "chain", PromiseChain, "then", PromiseThen, "catch", PromiseCatch ]); %InstallToContext([ "promise_catch", PromiseCatch, + "promise_chain", PromiseChain, "promise_create", PromiseCreate, "promise_has_user_defined_reject_handler", PromiseHasUserDefinedRejectHandler, "promise_reject", PromiseReject, @@ -475,14 +479,4 @@ utils.InstallFunctions(extrasUtils, 0, [ "rejectPromise", PromiseReject ]); -// TODO(v8:4567): Allow experimental natives to remove function prototype -[PromiseChain, PromiseDeferred, PromiseResolved].forEach( - fn => %FunctionRemovePrototype(fn)); - -utils.Export(function(to) { - to.PromiseChain = PromiseChain; - to.PromiseDeferred = PromiseDeferred; - to.PromiseResolved = PromiseResolved; -}); - }) diff --git a/test/mjsunit/es6/debug-promises/reentry.js b/test/mjsunit/es6/debug-promises/reentry.js index a97ce81012..fbe54242dd 100644 --- a/test/mjsunit/es6/debug-promises/reentry.js +++ b/test/mjsunit/es6/debug-promises/reentry.js @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flags: --expose-debug-as debug --promise-extra +// Flags: --expose-debug-as debug // Test reentry of special try catch for Promises. diff --git a/test/mjsunit/es6/debug-promises/reject-after-resolve.js b/test/mjsunit/es6/debug-promises/reject-after-resolve.js index ed4b2c435e..a0036cfd0f 100644 --- a/test/mjsunit/es6/debug-promises/reject-after-resolve.js +++ b/test/mjsunit/es6/debug-promises/reject-after-resolve.js @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flags: --expose-debug-as debug --allow-natives-syntax --promise-extra +// Flags: --expose-debug-as debug --allow-natives-syntax // Test debug events when we listen to uncaught exceptions and // the Promise is rejected in a chained closure after it has been resolved. diff --git a/test/mjsunit/es6/debug-promises/reject-caught-all.js b/test/mjsunit/es6/debug-promises/reject-caught-all.js index e1a653889d..fd4770ebee 100644 --- a/test/mjsunit/es6/debug-promises/reject-caught-all.js +++ b/test/mjsunit/es6/debug-promises/reject-caught-all.js @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flags: --expose-debug-as debug --allow-natives-syntax --promise-extra +// Flags: --expose-debug-as debug --allow-natives-syntax // Test debug events when we listen to all exceptions and // there is a catch handler for the to-be-rejected Promise. diff --git a/test/mjsunit/es6/debug-promises/reject-caught-late.js b/test/mjsunit/es6/debug-promises/reject-caught-late.js index 922449261b..2ff13d5605 100644 --- a/test/mjsunit/es6/debug-promises/reject-caught-late.js +++ b/test/mjsunit/es6/debug-promises/reject-caught-late.js @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flags: --expose-debug-as debug --allow-natives-syntax --promise-extra +// Flags: --expose-debug-as debug --allow-natives-syntax // Test debug events when we only listen to uncaught exceptions, the Promise // is rejected, and a catch handler is installed right before the rejection. diff --git a/test/mjsunit/es6/debug-promises/reject-caught-uncaught.js b/test/mjsunit/es6/debug-promises/reject-caught-uncaught.js index afb46fea8f..d3fd9f3ae7 100644 --- a/test/mjsunit/es6/debug-promises/reject-caught-uncaught.js +++ b/test/mjsunit/es6/debug-promises/reject-caught-uncaught.js @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flags: --expose-debug-as debug --allow-natives-syntax --promise-extra +// Flags: --expose-debug-as debug --allow-natives-syntax // Test debug events when we only listen to uncaught exceptions and // there is a catch handler for the to-be-rejected Promise. diff --git a/test/mjsunit/es6/debug-promises/reject-uncaught-all.js b/test/mjsunit/es6/debug-promises/reject-uncaught-all.js index 63e3b8678d..0b0c0c8e38 100644 --- a/test/mjsunit/es6/debug-promises/reject-uncaught-all.js +++ b/test/mjsunit/es6/debug-promises/reject-uncaught-all.js @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flags: --expose-debug-as debug --allow-natives-syntax --promise-extra +// Flags: --expose-debug-as debug --allow-natives-syntax // Test debug events when we listen to all exceptions and // there is a catch handler for the to-be-rejected Promise. diff --git a/test/mjsunit/es6/debug-promises/reject-uncaught-uncaught.js b/test/mjsunit/es6/debug-promises/reject-uncaught-uncaught.js index b542bc69dd..ac23b48b6f 100644 --- a/test/mjsunit/es6/debug-promises/reject-uncaught-uncaught.js +++ b/test/mjsunit/es6/debug-promises/reject-uncaught-uncaught.js @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flags: --expose-debug-as debug --allow-natives-syntax --promise-extra +// Flags: --expose-debug-as debug --allow-natives-syntax // Test debug events when we only listen to uncaught exceptions and // there is no catch handler for the to-be-rejected Promise. diff --git a/test/mjsunit/es6/debug-promises/reject-with-invalid-reject.js b/test/mjsunit/es6/debug-promises/reject-with-invalid-reject.js index 8775df687d..fa263458c4 100644 --- a/test/mjsunit/es6/debug-promises/reject-with-invalid-reject.js +++ b/test/mjsunit/es6/debug-promises/reject-with-invalid-reject.js @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flags: --expose-debug-as debug --allow-natives-syntax --promise-extra +// Flags: --expose-debug-as debug --allow-natives-syntax // Test debug events when a Promise is rejected, which is caught by a custom // promise, which has a number for reject closure. We expect an Exception debug diff --git a/test/mjsunit/es6/debug-promises/reject-with-throw-in-reject.js b/test/mjsunit/es6/debug-promises/reject-with-throw-in-reject.js index b6c06df49e..6b7dc1a77c 100644 --- a/test/mjsunit/es6/debug-promises/reject-with-throw-in-reject.js +++ b/test/mjsunit/es6/debug-promises/reject-with-throw-in-reject.js @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flags: --expose-debug-as debug --allow-natives-syntax --promise-extra +// Flags: --expose-debug-as debug --allow-natives-syntax // Test debug events when a Promise is rejected, which is caught by a // custom promise, which throws a new exception in its reject handler. diff --git a/test/mjsunit/es6/debug-promises/reject-with-undefined-reject.js b/test/mjsunit/es6/debug-promises/reject-with-undefined-reject.js index d058d41b96..4c57cf0237 100644 --- a/test/mjsunit/es6/debug-promises/reject-with-undefined-reject.js +++ b/test/mjsunit/es6/debug-promises/reject-with-undefined-reject.js @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flags: --expose-debug-as debug --allow-natives-syntax --promise-extra +// Flags: --expose-debug-as debug --allow-natives-syntax // Test debug events when a Promise is rejected, which is caught by a custom // promise, which has undefined for reject closure. We expect an Exception diff --git a/test/mjsunit/es6/debug-promises/throw-caught-all.js b/test/mjsunit/es6/debug-promises/throw-caught-all.js index 3b7c48c1cf..bd6d343f82 100644 --- a/test/mjsunit/es6/debug-promises/throw-caught-all.js +++ b/test/mjsunit/es6/debug-promises/throw-caught-all.js @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flags: --expose-debug-as debug --allow-natives-syntax --promise-extra +// Flags: --expose-debug-as debug --allow-natives-syntax // Test debug events when we listen to all exceptions and // there is a catch handler for the exception thrown in a Promise. diff --git a/test/mjsunit/es6/debug-promises/throw-caught-late.js b/test/mjsunit/es6/debug-promises/throw-caught-late.js index aa7e584320..ac79aba769 100644 --- a/test/mjsunit/es6/debug-promises/throw-caught-late.js +++ b/test/mjsunit/es6/debug-promises/throw-caught-late.js @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flags: --expose-debug-as debug --allow-natives-syntax --promise-extra +// Flags: --expose-debug-as debug --allow-natives-syntax // Test debug events when we only listen to uncaught exceptions, the Promise // throws, and a catch handler is installed right before throwing. diff --git a/test/mjsunit/es6/debug-promises/throw-caught-uncaught.js b/test/mjsunit/es6/debug-promises/throw-caught-uncaught.js index a424ccc9f7..0ad9ce48a2 100644 --- a/test/mjsunit/es6/debug-promises/throw-caught-uncaught.js +++ b/test/mjsunit/es6/debug-promises/throw-caught-uncaught.js @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flags: --expose-debug-as debug --allow-natives-syntax --promise-extra +// Flags: --expose-debug-as debug --allow-natives-syntax // Test debug events when we only listen to uncaught exceptions and // there is a catch handler for the exception thrown in a Promise. diff --git a/test/mjsunit/es6/debug-promises/throw-uncaught-all.js b/test/mjsunit/es6/debug-promises/throw-uncaught-all.js index bfe0bedbac..c4bc6c44e3 100644 --- a/test/mjsunit/es6/debug-promises/throw-uncaught-all.js +++ b/test/mjsunit/es6/debug-promises/throw-uncaught-all.js @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flags: --expose-debug-as debug --allow-natives-syntax --promise-extra +// Flags: --expose-debug-as debug --allow-natives-syntax // Test debug events when we listen to all exceptions and // there is no catch handler for the exception thrown in a Promise. diff --git a/test/mjsunit/es6/debug-promises/throw-uncaught-uncaught.js b/test/mjsunit/es6/debug-promises/throw-uncaught-uncaught.js index 8dff592f33..ba82a1f8cb 100644 --- a/test/mjsunit/es6/debug-promises/throw-uncaught-uncaught.js +++ b/test/mjsunit/es6/debug-promises/throw-uncaught-uncaught.js @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flags: --expose-debug-as debug --allow-natives-syntax --promise-extra +// Flags: --expose-debug-as debug --allow-natives-syntax // Test debug events when we only listen to uncaught exceptions and // there is a catch handler for the exception thrown in a Promise. diff --git a/test/mjsunit/es6/debug-promises/throw-with-throw-in-reject.js b/test/mjsunit/es6/debug-promises/throw-with-throw-in-reject.js index 349d014701..bd39a155cc 100644 --- a/test/mjsunit/es6/debug-promises/throw-with-throw-in-reject.js +++ b/test/mjsunit/es6/debug-promises/throw-with-throw-in-reject.js @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flags: --expose-debug-as debug --allow-natives-syntax --promise-extra +// Flags: --expose-debug-as debug --allow-natives-syntax // Test debug events when an exception is thrown inside a Promise, which is // caught by a custom promise, which throws a new exception in its reject diff --git a/test/mjsunit/es6/debug-promises/throw-with-undefined-reject.js b/test/mjsunit/es6/debug-promises/throw-with-undefined-reject.js index 7fa60f86cf..c88feb9c39 100644 --- a/test/mjsunit/es6/debug-promises/throw-with-undefined-reject.js +++ b/test/mjsunit/es6/debug-promises/throw-with-undefined-reject.js @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flags: --expose-debug-as debug --allow-natives-syntax --promise-extra +// Flags: --expose-debug-as debug --allow-natives-syntax // Test debug events when an exception is thrown inside a Promise, which is // caught by a custom promise, which has no reject handler. diff --git a/test/mjsunit/es6/promise-internal-setter.js b/test/mjsunit/es6/promise-internal-setter.js index 20d361f623..83e4738316 100644 --- a/test/mjsunit/es6/promise-internal-setter.js +++ b/test/mjsunit/es6/promise-internal-setter.js @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flags: --promise-extra - 'use strict'; Object.defineProperties(Object.prototype, { diff --git a/test/mjsunit/es6/promises.js b/test/mjsunit/es6/promises.js index d02f7b7ef3..478f216eb1 100644 --- a/test/mjsunit/es6/promises.js +++ b/test/mjsunit/es6/promises.js @@ -25,7 +25,7 @@ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// Flags: --allow-natives-syntax --harmony-tostring --promise-extra +// Flags: --allow-natives-syntax --harmony-tostring // Make sure we don't rely on functions patchable by monkeys. var call = Function.prototype.call.call.bind(Function.prototype.call) diff --git a/test/mjsunit/es6/regress/regress-cr372788.js b/test/mjsunit/es6/regress/regress-cr372788.js index 3144b39830..9b66a7e08b 100644 --- a/test/mjsunit/es6/regress/regress-cr372788.js +++ b/test/mjsunit/es6/regress/regress-cr372788.js @@ -25,7 +25,7 @@ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// Flags: --allow-natives-syntax --promise-extra +// Flags: --allow-natives-syntax var x = 0; var y = 0; diff --git a/tools/gyp/v8.gyp b/tools/gyp/v8.gyp index fe61527b4d..13569b47a0 100644 --- a/tools/gyp/v8.gyp +++ b/tools/gyp/v8.gyp @@ -1879,7 +1879,6 @@ '../../src/js/harmony-object-observe.js', '../../src/js/harmony-sharedarraybuffer.js', '../../src/js/harmony-simd.js', - '../../src/js/promise-extra.js', ], 'code_stub_library_files': [ '../../src/js/macros.py',