Commit b2a257f9 authored by littledan's avatar littledan Committed by Commit bot

Remove --promise-extra flag

This flag was shipped on in 52, so it's due for removal. The patch includes
removing the deprecated and unused-in-Blink API Promise::Chain, and many
test updates.

R=adamk@chromium.org
BUG=v8:4633

Review-Url: https://codereview.chromium.org/2267033002
Cr-Commit-Position: refs/heads/master@{#38804}
parent ad82a405
......@@ -431,7 +431,6 @@ action("js2c_experimental") {
"src/js/harmony-atomics.js",
"src/js/harmony-simd.js",
"src/js/harmony-string-padding.js",
"src/js/promise-extra.js",
]
outputs = [
......
......@@ -3408,12 +3408,6 @@ class V8_EXPORT Promise : public Object {
* an argument. If the promise is already resolved/rejected, the handler is
* invoked at the end of turn.
*/
V8_DEPRECATED("Use maybe version of Then",
Local<Promise> Chain(Local<Function> handler));
V8_DEPRECATED("Use Then",
V8_WARN_UNUSED_RESULT MaybeLocal<Promise> Chain(
Local<Context> context, Local<Function> handler));
V8_DEPRECATED("Use maybe version",
Local<Promise> Catch(Local<Function> handler));
V8_WARN_UNUSED_RESULT MaybeLocal<Promise> Catch(Local<Context> context,
......
......@@ -6707,36 +6707,6 @@ void Promise::Resolver::Reject(Local<Value> value) {
}
namespace {
MaybeLocal<Promise> DoChain(Value* value, Local<Context> context,
Local<Function> handler) {
PREPARE_FOR_EXECUTION(context, Promise, Chain, Promise);
auto self = Utils::OpenHandle(value);
i::Handle<i::Object> argv[] = {Utils::OpenHandle(*handler)};
i::Handle<i::Object> result;
has_pending_exception = !i::Execution::Call(isolate, isolate->promise_chain(),
self, arraysize(argv), argv)
.ToHandle(&result);
RETURN_ON_FAILED_EXECUTION(Promise);
RETURN_ESCAPED(Local<Promise>::Cast(Utils::ToLocal(result)));
}
} // namespace
MaybeLocal<Promise> Promise::Chain(Local<Context> context,
Local<Function> handler) {
return DoChain(this, context, handler);
}
Local<Promise> Promise::Chain(Local<Function> handler) {
auto context = ContextFromHeapObject(Utils::OpenHandle(this));
RETURN_TO_LOCAL_UNCHECKED(DoChain(this, context, handler), Promise);
}
MaybeLocal<Promise> Promise::Catch(Local<Context> context,
Local<Function> handler) {
PREPARE_FOR_EXECUTION(context, Promise, Catch, Promise);
......
......@@ -209,7 +209,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, "")
DECLARE_FEATURE_INITIALIZATION(intl_extra, "")
#undef DECLARE_FEATURE_INITIALIZATION
......@@ -2177,7 +2176,6 @@ void Genesis::InitializeExperimentalGlobal() {
HARMONY_INPROGRESS(FEATURE_INITIALIZE_GLOBAL)
HARMONY_STAGED(FEATURE_INITIALIZE_GLOBAL)
HARMONY_SHIPPING(FEATURE_INITIALIZE_GLOBAL)
FEATURE_INITIALIZE_GLOBAL(promise_extra, "")
FEATURE_INITIALIZE_GLOBAL(intl_extra, "")
#undef FEATURE_INITIALIZE_GLOBAL
}
......@@ -2763,7 +2761,6 @@ EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_regexp_lookbehind)
EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_regexp_named_captures)
EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_regexp_property)
EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_function_sent)
EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(promise_extra)
EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(intl_extra)
EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_explicit_tailcalls)
EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_tailcalls)
......@@ -3351,8 +3348,6 @@ bool Genesis::InstallExperimentalNatives() {
static const char* harmony_regexp_named_captures_natives[] = {nullptr};
static const char* harmony_regexp_property_natives[] = {nullptr};
static const char* harmony_function_sent_natives[] = {nullptr};
static const char* promise_extra_natives[] = {"native promise-extra.js",
nullptr};
static const char* intl_extra_natives[] = {"native intl-extra.js", nullptr};
static const char* harmony_object_values_entries_natives[] = {nullptr};
static const char* harmony_object_own_property_descriptors_natives[] = {
......@@ -3387,7 +3382,6 @@ bool Genesis::InstallExperimentalNatives() {
HARMONY_STAGED(INSTALL_EXPERIMENTAL_NATIVES);
HARMONY_SHIPPING(INSTALL_EXPERIMENTAL_NATIVES);
INSTALL_EXPERIMENTAL_NATIVES(intl_extra, "");
INSTALL_EXPERIMENTAL_NATIVES(promise_extra, "");
#undef INSTALL_EXPERIMENTAL_NATIVES
}
......
......@@ -81,7 +81,6 @@ enum ContextLookupFlags {
V(OBJECT_VALUE_OF, JSFunction, object_value_of) \
V(OBJECT_TO_STRING, JSFunction, object_to_string) \
V(PROMISE_CATCH_INDEX, JSFunction, promise_catch) \
V(PROMISE_CHAIN_INDEX, JSFunction, promise_chain) \
V(PROMISE_CREATE_INDEX, JSFunction, promise_create) \
V(PROMISE_FUNCTION_INDEX, JSFunction, promise_function) \
V(PROMISE_HAS_USER_DEFINED_REJECT_HANDLER_INDEX, JSFunction, \
......
......@@ -184,10 +184,6 @@ DEFINE_BOOL(harmony, false, "enable all completed harmony features")
DEFINE_BOOL(harmony_shipping, true, "enable all shipped harmony features")
DEFINE_IMPLICATION(es_staging, harmony)
DEFINE_BOOL(promise_extra, false, "additional V8 Promise functions")
// Removing extra Promise functions is shipped
DEFINE_NEG_VALUE_IMPLICATION(harmony_shipping, promise_extra, true)
DEFINE_BOOL(intl_extra, false, "additional V8 Intl functions")
// Removing extra Intl functions is shipped
DEFINE_NEG_VALUE_IMPLICATION(harmony_shipping, intl_extra, true)
......
......@@ -199,9 +199,6 @@ function PostNatives(utils) {
"NewPromiseCapability",
"NumberIsInteger",
"PerformPromiseThen",
"PromiseChain",
"PromiseDefer",
"PromiseAccept",
"PromiseCastResolved",
"PromiseThen",
"RegExpSubclassExecJS",
......
// 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 PromiseDefer = utils.ImportNow("PromiseDefer");
var PromiseAccept = utils.ImportNow("PromiseAccept");
utils.InstallFunctions(GlobalPromise.prototype, DONT_ENUM, [
"chain", PromiseChain,
]);
utils.InstallFunctions(GlobalPromise, DONT_ENUM, [
"defer", PromiseDefer,
"accept", PromiseAccept,
]);
})
......@@ -346,18 +346,6 @@ function NewPromiseCapability(C) {
return result;
}
// Unspecified V8-specific legacy function
function PromiseDefer() {
%IncrementUseCounter(kPromiseDefer);
return NewPromiseCapability(this);
}
// Unspecified V8-specific legacy function
function PromiseAccept(x) {
%IncrementUseCounter(kPromiseAccept);
return %_Call(PromiseResolve, this, x);
}
// ES#sec-promise.reject
// Promise.reject ( x )
function PromiseReject(r) {
......@@ -443,13 +431,6 @@ function PromiseThen(onResolve, onReject) {
return PerformPromiseThen(this, onResolve, onReject, resultCapability);
}
// Unspecified V8-specific legacy function
// Chain is left around for now as an alias for then
function PromiseChain(onResolve, onReject) {
%IncrementUseCounter(kPromiseChain);
return %_Call(PromiseThen, this, onResolve, onReject);
}
// ES#sec-promise.prototype.catch
// Promise.prototype.catch ( onRejected )
function PromiseCatch(onReject) {
......@@ -615,7 +596,6 @@ utils.InstallFunctions(GlobalPromise.prototype, DONT_ENUM, [
%InstallToContext([
"promise_catch", PromiseCatch,
"promise_chain", PromiseChain,
"promise_create", PromiseCreate,
"promise_has_user_defined_reject_handler", PromiseHasUserDefinedRejectHandler,
"promise_reject", RejectPromise,
......@@ -634,15 +614,7 @@ utils.InstallFunctions(extrasUtils, 0, [
"rejectPromise", RejectPromise
]);
// TODO(v8:4567): Allow experimental natives to remove function prototype
[PromiseChain, PromiseDefer, PromiseAccept].forEach(
fn => %FunctionRemovePrototype(fn));
utils.Export(function(to) {
to.PromiseChain = PromiseChain;
to.PromiseDefer = PromiseDefer;
to.PromiseAccept = PromiseAccept;
to.PromiseCastResolved = PromiseCastResolved;
to.PromiseThen = PromiseThen;
......
......@@ -2195,7 +2195,6 @@
'js/harmony-atomics.js',
'js/harmony-simd.js',
'js/harmony-string-padding.js',
'js/promise-extra.js',
'js/harmony-async-await.js'
],
'libraries_bin_file': '<(SHARED_INTERMEDIATE_DIR)/libraries.bin',
......
......@@ -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.
......@@ -12,6 +12,6 @@ Debug.setBreakOnUncaughtException();
Debug.setListener(function(event, exec_state, event_data, data) { });
var p = new Promise(function(resolve, reject) { resolve(); });
var q = p.chain(function() {
var q = p.then(function() {
new Promise(function(resolve, reject) { resolve(); });
});
......@@ -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.
......@@ -17,7 +17,7 @@ var p = new Promise(function(resolve, reject) {
resolve(reject);
});
var q = p.chain(
var q = p.then(
function(value) {
assertEquals(["resolve", "end main"], log);
value(new Error("reject"));
......
......@@ -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.
......@@ -18,7 +18,7 @@ var p = new Promise(function(resolve, reject) {
resolve();
});
var q = p.chain(
var q = p.then(
function(value) {
log.push("reject");
return Promise.reject(new Error("reject"));
......
......@@ -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.
......@@ -14,7 +14,7 @@ var p = new Promise(function(resolve, reject) {
resolve();
});
var q = p.chain(
var q = p.then(
function() {
q.catch(function(e) {
assertEquals("caught", e.message);
......
......@@ -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.
......@@ -14,7 +14,7 @@ var p = new Promise(function(resolve, reject) {
resolve();
});
var q = p.chain(
var q = p.then(
function() {
return Promise.reject(Error("caught reject"));
});
......
......@@ -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.
......@@ -18,7 +18,7 @@ var p = new Promise(function(resolve, reject) {
resolve();
});
var q = p.chain(
var q = p.then(
function() {
log.push("reject");
return Promise.reject(new Error("uncaught reject"));
......
......@@ -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.
......@@ -18,7 +18,7 @@ var p = new Promise(function(resolve, reject) {
resolve();
});
var q = p.chain(
var q = p.then(
function() {
log.push("reject");
return Promise.reject(Error("uncaught reject")); // event
......
......@@ -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
......@@ -28,7 +28,7 @@ function MyPromise(resolver) {
MyPromise.prototype = new Promise(function() {});
p.constructor = MyPromise;
var q = p.chain(
var q = p.then(
function() {
log.push("reject caught");
return Promise.reject(new Error("caught"));
......
......@@ -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.
......@@ -33,7 +33,7 @@ function MyPromise(resolver) {
MyPromise.prototype = new Promise(function() {});
p.constructor = MyPromise;
var q = p.chain(
var q = p.then(
function() {
log.push("reject caught");
return Promise.reject(new Error("caught"));
......
......@@ -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
......@@ -28,7 +28,7 @@ function MyPromise(resolver) {
MyPromise.prototype = new Promise(function() {});
p.constructor = MyPromise;
var q = p.chain(
var q = p.then(
function() {
log.push("reject caught");
return Promise.reject(new Error("caught"));
......
......@@ -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.
......@@ -18,7 +18,7 @@ var p = new Promise(function(resolve, reject) {
resolve();
});
var q = p.chain(
var q = p.then(
function() {
log.push("throw");
throw new Error("caught");
......
......@@ -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.
......@@ -14,7 +14,7 @@ var p = new Promise(function(resolve, reject) {
resolve();
});
var q = p.chain(
var q = p.then(
function() {
q.catch(function(e) {
assertEquals("caught", e.message);
......
......@@ -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.
......@@ -14,7 +14,7 @@ var p = new Promise(function(resolve, reject) {
resolve();
});
var q = p.chain(
var q = p.then(
function() {
throw new Error("caught throw");
});
......
......@@ -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, first
......@@ -19,7 +19,7 @@ var p = new Promise(function(resolve, reject) {
resolve();
});
var q = p.chain(
var q = p.then(
function() {
log.push("throw");
try {
......
......@@ -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.
......@@ -18,7 +18,7 @@ var p = new Promise(function(resolve, reject) {
resolve();
});
var q = p.chain(
var q = p.then(
function() {
log.push("throw");
throw new Error("uncaught"); // event
......
......@@ -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.
......@@ -18,7 +18,7 @@ var p = new Promise(function(resolve, reject) {
resolve();
});
var q = p.chain(
var q = p.then(
function() {
log.push("throw");
throw new Error("uncaught"); // event
......
......@@ -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
......@@ -34,7 +34,7 @@ MyPromise.prototype = new Promise(function() {});
MyPromise.__proto__ = Promise;
p.constructor = MyPromise;
var q = p.chain(
var q = p.then(
function() {
log.push("throw caught");
throw new Error("caught"); // event
......
......@@ -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, {
......@@ -16,4 +14,3 @@ class P extends Promise {}
P.all([Promise.resolve('ok')]);
P.race([Promise.resolve('ok')]);
P.defer();
This diff is collapsed.
......@@ -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;
......@@ -38,7 +38,7 @@ for (var i = 0; i < 3; ++i) {
assertEquals(0, x);
(function check() {
Promise.resolve().chain(function() {
Promise.resolve().then(function() {
// Delay check until all handlers have run.
if (y < 3) check(); else assertEquals(6, x);
}).catch(function(e) { %AbortJS("FAILURE: " + e) });
......
......@@ -518,7 +518,7 @@
##############################################################################
['system == windows', {
# TODO(mstarzinger): Too slow with turbo fan.
'big-object-literal': [PASS, ['mode == debug', SKIP]],
'big-object-literal': [SKIP],
'math-floor-of-div': [PASS, ['mode == debug', SKIP]],
'math-floor-of-div-nosudiv': [PASS, ['mode == debug', SKIP]],
'unicodelctest': [PASS, ['mode == debug', SKIP]],
......
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