Re^3-land "Ship promises and weak collections"
R=jochen@chromium.org BUG= Review URL: https://codereview.chromium.org/266243003 git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@21173 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
parent
ec2b42fd7b
commit
ae0a36ee32
@ -5769,7 +5769,7 @@ Local<Object> Array::CloneElementAt(uint32_t index) {
|
|||||||
|
|
||||||
bool Value::IsPromise() const {
|
bool Value::IsPromise() const {
|
||||||
i::Handle<i::Object> val = Utils::OpenHandle(this);
|
i::Handle<i::Object> val = Utils::OpenHandle(this);
|
||||||
if (!i::FLAG_harmony_promises || !val->IsJSObject()) return false;
|
if (!val->IsJSObject()) return false;
|
||||||
i::Handle<i::JSObject> obj = i::Handle<i::JSObject>::cast(val);
|
i::Handle<i::JSObject> obj = i::Handle<i::JSObject>::cast(val);
|
||||||
i::Isolate* isolate = obj->GetIsolate();
|
i::Isolate* isolate = obj->GetIsolate();
|
||||||
LOG_API(isolate, "IsPromise");
|
LOG_API(isolate, "IsPromise");
|
||||||
|
@ -121,7 +121,7 @@ char* Bootstrapper::AllocateAutoDeletedArray(int bytes) {
|
|||||||
void Bootstrapper::TearDown() {
|
void Bootstrapper::TearDown() {
|
||||||
if (delete_these_non_arrays_on_tear_down_ != NULL) {
|
if (delete_these_non_arrays_on_tear_down_ != NULL) {
|
||||||
int len = delete_these_non_arrays_on_tear_down_->length();
|
int len = delete_these_non_arrays_on_tear_down_->length();
|
||||||
ASSERT(len < 20); // Don't use this mechanism for unbounded allocations.
|
ASSERT(len < 24); // Don't use this mechanism for unbounded allocations.
|
||||||
for (int i = 0; i < len; i++) {
|
for (int i = 0; i < len; i++) {
|
||||||
delete delete_these_non_arrays_on_tear_down_->at(i);
|
delete delete_these_non_arrays_on_tear_down_->at(i);
|
||||||
delete_these_non_arrays_on_tear_down_->at(i) = NULL;
|
delete_these_non_arrays_on_tear_down_->at(i) = NULL;
|
||||||
@ -1078,6 +1078,18 @@ void Genesis::InitializeGlobal(Handle<GlobalObject> inner_global,
|
|||||||
native_context()->set_data_view_fun(*data_view_fun);
|
native_context()->set_data_view_fun(*data_view_fun);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
{ // -- W e a k M a p
|
||||||
|
InstallFunction(global, "WeakMap", JS_WEAK_MAP_TYPE, JSWeakMap::kSize,
|
||||||
|
isolate->initial_object_prototype(),
|
||||||
|
Builtins::kIllegal, true, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
{ // -- W e a k S e t
|
||||||
|
InstallFunction(global, "WeakSet", JS_WEAK_SET_TYPE, JSWeakSet::kSize,
|
||||||
|
isolate->initial_object_prototype(),
|
||||||
|
Builtins::kIllegal, true, true);
|
||||||
|
}
|
||||||
|
|
||||||
{ // --- arguments_boilerplate_
|
{ // --- arguments_boilerplate_
|
||||||
// Make sure we can recognize argument objects at runtime.
|
// Make sure we can recognize argument objects at runtime.
|
||||||
// This is done by introducing an anonymous function with
|
// This is done by introducing an anonymous function with
|
||||||
@ -1336,19 +1348,6 @@ void Genesis::InitializeExperimentalGlobal() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (FLAG_harmony_weak_collections) {
|
|
||||||
{ // -- W e a k M a p
|
|
||||||
InstallFunction(global, "WeakMap", JS_WEAK_MAP_TYPE, JSWeakMap::kSize,
|
|
||||||
isolate()->initial_object_prototype(),
|
|
||||||
Builtins::kIllegal, true, true);
|
|
||||||
}
|
|
||||||
{ // -- W e a k S e t
|
|
||||||
InstallFunction(global, "WeakSet", JS_WEAK_SET_TYPE, JSWeakSet::kSize,
|
|
||||||
isolate()->initial_object_prototype(),
|
|
||||||
Builtins::kIllegal, true, true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (FLAG_harmony_generators) {
|
if (FLAG_harmony_generators) {
|
||||||
// Create generator meta-objects and install them on the builtins object.
|
// Create generator meta-objects and install them on the builtins object.
|
||||||
Handle<JSObject> builtins(native_context()->builtins());
|
Handle<JSObject> builtins(native_context()->builtins());
|
||||||
@ -1536,6 +1535,7 @@ bool Genesis::CompileScriptCached(Isolate* isolate,
|
|||||||
void Genesis::InstallNativeFunctions() {
|
void Genesis::InstallNativeFunctions() {
|
||||||
HandleScope scope(isolate());
|
HandleScope scope(isolate());
|
||||||
INSTALL_NATIVE(JSFunction, "CreateDate", create_date_fun);
|
INSTALL_NATIVE(JSFunction, "CreateDate", create_date_fun);
|
||||||
|
|
||||||
INSTALL_NATIVE(JSFunction, "ToNumber", to_number_fun);
|
INSTALL_NATIVE(JSFunction, "ToNumber", to_number_fun);
|
||||||
INSTALL_NATIVE(JSFunction, "ToString", to_string_fun);
|
INSTALL_NATIVE(JSFunction, "ToString", to_string_fun);
|
||||||
INSTALL_NATIVE(JSFunction, "ToDetailString", to_detail_string_fun);
|
INSTALL_NATIVE(JSFunction, "ToDetailString", to_detail_string_fun);
|
||||||
@ -1543,6 +1543,7 @@ void Genesis::InstallNativeFunctions() {
|
|||||||
INSTALL_NATIVE(JSFunction, "ToInteger", to_integer_fun);
|
INSTALL_NATIVE(JSFunction, "ToInteger", to_integer_fun);
|
||||||
INSTALL_NATIVE(JSFunction, "ToUint32", to_uint32_fun);
|
INSTALL_NATIVE(JSFunction, "ToUint32", to_uint32_fun);
|
||||||
INSTALL_NATIVE(JSFunction, "ToInt32", to_int32_fun);
|
INSTALL_NATIVE(JSFunction, "ToInt32", to_int32_fun);
|
||||||
|
|
||||||
INSTALL_NATIVE(JSFunction, "GlobalEval", global_eval_fun);
|
INSTALL_NATIVE(JSFunction, "GlobalEval", global_eval_fun);
|
||||||
INSTALL_NATIVE(JSFunction, "Instantiate", instantiate_fun);
|
INSTALL_NATIVE(JSFunction, "Instantiate", instantiate_fun);
|
||||||
INSTALL_NATIVE(JSFunction, "ConfigureTemplateInstance",
|
INSTALL_NATIVE(JSFunction, "ConfigureTemplateInstance",
|
||||||
@ -1551,6 +1552,14 @@ void Genesis::InstallNativeFunctions() {
|
|||||||
INSTALL_NATIVE(JSObject, "functionCache", function_cache);
|
INSTALL_NATIVE(JSObject, "functionCache", function_cache);
|
||||||
INSTALL_NATIVE(JSFunction, "ToCompletePropertyDescriptor",
|
INSTALL_NATIVE(JSFunction, "ToCompletePropertyDescriptor",
|
||||||
to_complete_property_descriptor);
|
to_complete_property_descriptor);
|
||||||
|
|
||||||
|
INSTALL_NATIVE(JSFunction, "IsPromise", is_promise);
|
||||||
|
INSTALL_NATIVE(JSFunction, "PromiseCreate", promise_create);
|
||||||
|
INSTALL_NATIVE(JSFunction, "PromiseResolve", promise_resolve);
|
||||||
|
INSTALL_NATIVE(JSFunction, "PromiseReject", promise_reject);
|
||||||
|
INSTALL_NATIVE(JSFunction, "PromiseChain", promise_chain);
|
||||||
|
INSTALL_NATIVE(JSFunction, "PromiseCatch", promise_catch);
|
||||||
|
|
||||||
INSTALL_NATIVE(JSFunction, "NotifyChange", observers_notify_change);
|
INSTALL_NATIVE(JSFunction, "NotifyChange", observers_notify_change);
|
||||||
INSTALL_NATIVE(JSFunction, "EnqueueSpliceRecord", observers_enqueue_splice);
|
INSTALL_NATIVE(JSFunction, "EnqueueSpliceRecord", observers_enqueue_splice);
|
||||||
INSTALL_NATIVE(JSFunction, "BeginPerformSplice",
|
INSTALL_NATIVE(JSFunction, "BeginPerformSplice",
|
||||||
@ -1570,15 +1579,6 @@ void Genesis::InstallExperimentalNativeFunctions() {
|
|||||||
INSTALL_NATIVE(JSFunction, "RunMicrotasks", run_microtasks);
|
INSTALL_NATIVE(JSFunction, "RunMicrotasks", run_microtasks);
|
||||||
INSTALL_NATIVE(JSFunction, "EnqueueMicrotask", enqueue_microtask);
|
INSTALL_NATIVE(JSFunction, "EnqueueMicrotask", enqueue_microtask);
|
||||||
|
|
||||||
if (FLAG_harmony_promises) {
|
|
||||||
INSTALL_NATIVE(JSFunction, "IsPromise", is_promise);
|
|
||||||
INSTALL_NATIVE(JSFunction, "PromiseCreate", promise_create);
|
|
||||||
INSTALL_NATIVE(JSFunction, "PromiseResolve", promise_resolve);
|
|
||||||
INSTALL_NATIVE(JSFunction, "PromiseReject", promise_reject);
|
|
||||||
INSTALL_NATIVE(JSFunction, "PromiseChain", promise_chain);
|
|
||||||
INSTALL_NATIVE(JSFunction, "PromiseCatch", promise_catch);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (FLAG_harmony_proxies) {
|
if (FLAG_harmony_proxies) {
|
||||||
INSTALL_NATIVE(JSFunction, "DerivedHasTrap", derived_has_trap);
|
INSTALL_NATIVE(JSFunction, "DerivedHasTrap", derived_has_trap);
|
||||||
INSTALL_NATIVE(JSFunction, "DerivedGetTrap", derived_get_trap);
|
INSTALL_NATIVE(JSFunction, "DerivedGetTrap", derived_get_trap);
|
||||||
@ -1999,8 +1999,6 @@ bool Genesis::InstallExperimentalNatives() {
|
|||||||
INSTALL_EXPERIMENTAL_NATIVE(i, symbols, "symbol.js")
|
INSTALL_EXPERIMENTAL_NATIVE(i, symbols, "symbol.js")
|
||||||
INSTALL_EXPERIMENTAL_NATIVE(i, proxies, "proxy.js")
|
INSTALL_EXPERIMENTAL_NATIVE(i, proxies, "proxy.js")
|
||||||
INSTALL_EXPERIMENTAL_NATIVE(i, collections, "collection.js")
|
INSTALL_EXPERIMENTAL_NATIVE(i, collections, "collection.js")
|
||||||
INSTALL_EXPERIMENTAL_NATIVE(i, weak_collections, "weak_collection.js")
|
|
||||||
INSTALL_EXPERIMENTAL_NATIVE(i, promises, "promise.js")
|
|
||||||
INSTALL_EXPERIMENTAL_NATIVE(i, generators, "generator.js")
|
INSTALL_EXPERIMENTAL_NATIVE(i, generators, "generator.js")
|
||||||
INSTALL_EXPERIMENTAL_NATIVE(i, iteration, "array-iterator.js")
|
INSTALL_EXPERIMENTAL_NATIVE(i, iteration, "array-iterator.js")
|
||||||
INSTALL_EXPERIMENTAL_NATIVE(i, strings, "harmony-string.js")
|
INSTALL_EXPERIMENTAL_NATIVE(i, strings, "harmony-string.js")
|
||||||
|
@ -152,12 +152,9 @@ DEFINE_bool(harmony_modules, false,
|
|||||||
"enable harmony modules (implies block scoping)")
|
"enable harmony modules (implies block scoping)")
|
||||||
DEFINE_bool(harmony_symbols, false,
|
DEFINE_bool(harmony_symbols, false,
|
||||||
"enable harmony symbols (a.k.a. private names)")
|
"enable harmony symbols (a.k.a. private names)")
|
||||||
DEFINE_bool(harmony_promises, false, "enable harmony promises")
|
|
||||||
DEFINE_bool(harmony_proxies, false, "enable harmony proxies")
|
DEFINE_bool(harmony_proxies, false, "enable harmony proxies")
|
||||||
DEFINE_bool(harmony_collections, false,
|
DEFINE_bool(harmony_collections, false,
|
||||||
"enable harmony collections (sets, maps, weak sets, weak maps)")
|
"enable harmony collections (sets, maps)")
|
||||||
DEFINE_bool(harmony_weak_collections, false,
|
|
||||||
"enable only harmony weak collections (weak sets and maps)")
|
|
||||||
DEFINE_bool(harmony_generators, false, "enable harmony generators")
|
DEFINE_bool(harmony_generators, false, "enable harmony generators")
|
||||||
DEFINE_bool(harmony_iteration, false, "enable harmony iteration (for-of)")
|
DEFINE_bool(harmony_iteration, false, "enable harmony iteration (for-of)")
|
||||||
DEFINE_bool(harmony_numeric_literals, false,
|
DEFINE_bool(harmony_numeric_literals, false,
|
||||||
@ -177,14 +174,10 @@ DEFINE_implication(harmony, harmony_iteration)
|
|||||||
DEFINE_implication(harmony, harmony_numeric_literals)
|
DEFINE_implication(harmony, harmony_numeric_literals)
|
||||||
DEFINE_implication(harmony, harmony_strings)
|
DEFINE_implication(harmony, harmony_strings)
|
||||||
DEFINE_implication(harmony, harmony_arrays)
|
DEFINE_implication(harmony, harmony_arrays)
|
||||||
DEFINE_implication(harmony_collections, harmony_weak_collections)
|
|
||||||
DEFINE_implication(harmony_promises, harmony_weak_collections)
|
|
||||||
DEFINE_implication(harmony_modules, harmony_scoping)
|
DEFINE_implication(harmony_modules, harmony_scoping)
|
||||||
|
|
||||||
DEFINE_implication(harmony, es_staging)
|
DEFINE_implication(harmony, es_staging)
|
||||||
DEFINE_implication(es_staging, harmony_maths)
|
DEFINE_implication(es_staging, harmony_maths)
|
||||||
DEFINE_implication(es_staging, harmony_promises)
|
|
||||||
DEFINE_implication(es_staging, harmony_weak_collections)
|
|
||||||
|
|
||||||
// Flags for experimental implementation features.
|
// Flags for experimental implementation features.
|
||||||
DEFINE_bool(packed_arrays, true, "optimizes arrays that have no holes")
|
DEFINE_bool(packed_arrays, true, "optimizes arrays that have no holes")
|
||||||
|
@ -10,7 +10,22 @@
|
|||||||
// var $WeakMap = global.WeakMap
|
// var $WeakMap = global.WeakMap
|
||||||
|
|
||||||
|
|
||||||
var $Promise = Promise;
|
var $Promise = function Promise(resolver) {
|
||||||
|
if (resolver === promiseRaw) return;
|
||||||
|
if (!%_IsConstructCall()) throw MakeTypeError('not_a_promise', [this]);
|
||||||
|
if (!IS_SPEC_FUNCTION(resolver))
|
||||||
|
throw MakeTypeError('resolver_not_a_function', [resolver]);
|
||||||
|
var promise = PromiseInit(this);
|
||||||
|
try {
|
||||||
|
%DebugPromiseHandlePrologue(function() { return promise });
|
||||||
|
resolver(function(x) { PromiseResolve(promise, x) },
|
||||||
|
function(r) { PromiseReject(promise, r) });
|
||||||
|
} catch (e) {
|
||||||
|
PromiseReject(promise, e);
|
||||||
|
} finally {
|
||||||
|
%DebugPromiseHandleEpilogue();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------
|
//-------------------------------------------------------------------
|
||||||
@ -28,23 +43,6 @@ function IsPromise(x) {
|
|||||||
return IS_SPEC_OBJECT(x) && %HasLocalProperty(x, promiseStatus);
|
return IS_SPEC_OBJECT(x) && %HasLocalProperty(x, promiseStatus);
|
||||||
}
|
}
|
||||||
|
|
||||||
function Promise(resolver) {
|
|
||||||
if (resolver === promiseRaw) return;
|
|
||||||
if (!%_IsConstructCall()) throw MakeTypeError('not_a_promise', [this]);
|
|
||||||
if (typeof resolver !== 'function')
|
|
||||||
throw MakeTypeError('resolver_not_a_function', [resolver]);
|
|
||||||
var promise = PromiseInit(this);
|
|
||||||
try {
|
|
||||||
%DebugPromiseHandlePrologue(function() { return promise });
|
|
||||||
resolver(function(x) { PromiseResolve(promise, x) },
|
|
||||||
function(r) { PromiseReject(promise, r) });
|
|
||||||
} catch (e) {
|
|
||||||
PromiseReject(promise, e);
|
|
||||||
} finally {
|
|
||||||
%DebugPromiseHandleEpilogue();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function PromiseSet(promise, status, value, onResolve, onReject) {
|
function PromiseSet(promise, status, value, onResolve, onReject) {
|
||||||
SET_PRIVATE(promise, promiseStatus, status);
|
SET_PRIVATE(promise, promiseStatus, status);
|
||||||
SET_PRIVATE(promise, promiseValue, value);
|
SET_PRIVATE(promise, promiseValue, value);
|
||||||
@ -78,7 +76,7 @@ function PromiseReject(promise, r) {
|
|||||||
function PromiseNopResolver() {}
|
function PromiseNopResolver() {}
|
||||||
|
|
||||||
function PromiseCreate() {
|
function PromiseCreate() {
|
||||||
return new Promise(PromiseNopResolver)
|
return new $Promise(PromiseNopResolver)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -87,7 +85,7 @@ function PromiseCreate() {
|
|||||||
function PromiseDeferred() {
|
function PromiseDeferred() {
|
||||||
if (this === $Promise) {
|
if (this === $Promise) {
|
||||||
// Optimized case, avoid extra closure.
|
// Optimized case, avoid extra closure.
|
||||||
var promise = PromiseInit(new Promise(promiseRaw));
|
var promise = PromiseInit(new $Promise(promiseRaw));
|
||||||
return {
|
return {
|
||||||
promise: promise,
|
promise: promise,
|
||||||
resolve: function(x) { PromiseResolve(promise, x) },
|
resolve: function(x) { PromiseResolve(promise, x) },
|
||||||
@ -106,7 +104,7 @@ function PromiseDeferred() {
|
|||||||
function PromiseResolved(x) {
|
function PromiseResolved(x) {
|
||||||
if (this === $Promise) {
|
if (this === $Promise) {
|
||||||
// Optimized case, avoid extra closure.
|
// Optimized case, avoid extra closure.
|
||||||
return PromiseSet(new Promise(promiseRaw), +1, x);
|
return PromiseSet(new $Promise(promiseRaw), +1, x);
|
||||||
} else {
|
} else {
|
||||||
return new this(function(resolve, reject) { resolve(x) });
|
return new this(function(resolve, reject) { resolve(x) });
|
||||||
}
|
}
|
||||||
@ -115,7 +113,7 @@ function PromiseResolved(x) {
|
|||||||
function PromiseRejected(r) {
|
function PromiseRejected(r) {
|
||||||
if (this === $Promise) {
|
if (this === $Promise) {
|
||||||
// Optimized case, avoid extra closure.
|
// Optimized case, avoid extra closure.
|
||||||
return PromiseSet(new Promise(promiseRaw), -1, r);
|
return PromiseSet(new $Promise(promiseRaw), -1, r);
|
||||||
} else {
|
} else {
|
||||||
return new this(function(resolve, reject) { reject(r) });
|
return new this(function(resolve, reject) { reject(r) });
|
||||||
}
|
}
|
||||||
@ -190,10 +188,8 @@ function PromiseHandle(value, handler, deferred) {
|
|||||||
// Multi-unwrapped chaining with thenable coercion.
|
// Multi-unwrapped chaining with thenable coercion.
|
||||||
|
|
||||||
function PromiseThen(onResolve, onReject) {
|
function PromiseThen(onResolve, onReject) {
|
||||||
onResolve =
|
onResolve = IS_SPEC_FUNCTION(onResolve) ? onResolve : PromiseIdResolveHandler;
|
||||||
IS_NULL_OR_UNDEFINED(onResolve) ? PromiseIdResolveHandler : onResolve;
|
onReject = IS_SPEC_FUNCTION(onReject) ? onReject : PromiseIdRejectHandler;
|
||||||
onReject =
|
|
||||||
IS_NULL_OR_UNDEFINED(onReject) ? PromiseIdRejectHandler : onReject;
|
|
||||||
var that = this;
|
var that = this;
|
||||||
var constructor = this.constructor;
|
var constructor = this.constructor;
|
||||||
return %_CallFunction(
|
return %_CallFunction(
|
||||||
|
@ -22338,8 +22338,6 @@ TEST(EventLogging) {
|
|||||||
|
|
||||||
|
|
||||||
TEST(Promises) {
|
TEST(Promises) {
|
||||||
i::FLAG_harmony_promises = true;
|
|
||||||
|
|
||||||
LocalContext context;
|
LocalContext context;
|
||||||
v8::Isolate* isolate = context->GetIsolate();
|
v8::Isolate* isolate = context->GetIsolate();
|
||||||
v8::HandleScope scope(isolate);
|
v8::HandleScope scope(isolate);
|
||||||
|
@ -36,7 +36,6 @@ namespace {
|
|||||||
class HarmonyIsolate {
|
class HarmonyIsolate {
|
||||||
public:
|
public:
|
||||||
HarmonyIsolate() {
|
HarmonyIsolate() {
|
||||||
i::FLAG_harmony_promises = true;
|
|
||||||
isolate_ = Isolate::New();
|
isolate_ = Isolate::New();
|
||||||
isolate_->Enter();
|
isolate_->Enter();
|
||||||
}
|
}
|
||||||
|
@ -59,7 +59,7 @@ for (i = 0; i < scripts.length; i++) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// This has to be updated if the number of native scripts change.
|
// This has to be updated if the number of native scripts change.
|
||||||
assertTrue(named_native_count == 17 || named_native_count == 18);
|
assertTrue(named_native_count == 19 || named_native_count == 20);
|
||||||
// Only the 'gc' extension is loaded.
|
// Only the 'gc' extension is loaded.
|
||||||
assertEquals(1, extension_count);
|
assertEquals(1, extension_count);
|
||||||
// This script and mjsunit.js has been loaded. If using d8, d8 loads
|
// This script and mjsunit.js has been loaded. If using d8, d8 loads
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
// Flags: --harmony-observation --harmony-promises --allow-natives-syntax
|
// Flags: --allow-natives-syntax
|
||||||
|
|
||||||
var ordering = [];
|
var ordering = [];
|
||||||
function reset() {
|
function reset() {
|
@ -25,7 +25,7 @@
|
|||||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
// Flags: --harmony-promises --allow-natives-syntax
|
// Flags: --allow-natives-syntax
|
||||||
|
|
||||||
var asyncAssertsExpected = 0;
|
var asyncAssertsExpected = 0;
|
||||||
|
|
||||||
@ -396,6 +396,30 @@ function assertAsyncDone(iteration) {
|
|||||||
assertAsyncRan()
|
assertAsyncRan()
|
||||||
})();
|
})();
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
var deferred = Promise.defer()
|
||||||
|
var p1 = deferred.promise
|
||||||
|
var p2 = p1.then(1, 2)
|
||||||
|
p2.then(
|
||||||
|
function(x) { assertAsync(x === 5, "then/resolve-non-function") },
|
||||||
|
assertUnreachable
|
||||||
|
)
|
||||||
|
deferred.resolve(5)
|
||||||
|
assertAsyncRan()
|
||||||
|
})();
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
var deferred = Promise.defer()
|
||||||
|
var p1 = deferred.promise
|
||||||
|
var p2 = p1.then(1, 2)
|
||||||
|
p2.then(
|
||||||
|
assertUnreachable,
|
||||||
|
function(x) { assertAsync(x === 5, "then/reject-non-function") }
|
||||||
|
)
|
||||||
|
deferred.reject(5)
|
||||||
|
assertAsyncRan()
|
||||||
|
})();
|
||||||
|
|
||||||
(function() {
|
(function() {
|
||||||
var deferred = Promise.defer()
|
var deferred = Promise.defer()
|
||||||
var p1 = deferred.promise
|
var p1 = deferred.promise
|
||||||
|
@ -25,8 +25,6 @@
|
|||||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
// Flags: --harmony-weak-collections
|
|
||||||
|
|
||||||
var key = {};
|
var key = {};
|
||||||
var map = new WeakMap;
|
var map = new WeakMap;
|
||||||
Object.preventExtensions(key);
|
Object.preventExtensions(key);
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
// Flags: --allow-natives-syntax --harmony-weak-collections
|
// Flags: --allow-natives-syntax
|
||||||
|
|
||||||
var key1 = {};
|
var key1 = {};
|
||||||
var key2 = {};
|
var key2 = {};
|
||||||
|
@ -25,8 +25,6 @@
|
|||||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
// Flags: --harmony-weak-collections
|
|
||||||
|
|
||||||
(function test1() {
|
(function test1() {
|
||||||
var wm1 = new WeakMap();
|
var wm1 = new WeakMap();
|
||||||
wm1.set(Object.prototype, 23);
|
wm1.set(Object.prototype, 23);
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
// Flags: --harmony-weak-collections --expose-gc --allow-natives-syntax
|
// Flags: --expose-gc --allow-natives-syntax
|
||||||
|
|
||||||
|
|
||||||
// Note: this test is superseded by harmony/collections.js.
|
// Note: this test is superseded by harmony/collections.js.
|
||||||
@ -225,7 +225,7 @@ function TestPrototype(C) {
|
|||||||
assertTrue(C.prototype instanceof Object);
|
assertTrue(C.prototype instanceof Object);
|
||||||
assertEquals({
|
assertEquals({
|
||||||
value: {},
|
value: {},
|
||||||
writable: true, // TODO(2793): This should be non-writable.
|
writable: false,
|
||||||
enumerable: false,
|
enumerable: false,
|
||||||
configurable: false
|
configurable: false
|
||||||
}, Object.getOwnPropertyDescriptor(C, "prototype"));
|
}, Object.getOwnPropertyDescriptor(C, "prototype"));
|
||||||
|
@ -25,8 +25,7 @@
|
|||||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
// Flags: --harmony-observation --harmony-proxies
|
// Flags: --harmony-proxies --harmony-collections
|
||||||
// Flags: --harmony-collections --harmony-weak-collections
|
|
||||||
// Flags: --harmony-symbols --allow-natives-syntax
|
// Flags: --harmony-symbols --allow-natives-syntax
|
||||||
|
|
||||||
var allObservers = [];
|
var allObservers = [];
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
// Flags: --harmony-collections --harmony-weak-collections
|
// Flags: --harmony-collections
|
||||||
// Flags: --expose-gc --allow-natives-syntax
|
// Flags: --expose-gc --allow-natives-syntax
|
||||||
|
|
||||||
|
|
||||||
@ -290,19 +290,20 @@ assertEquals("WeakSet", WeakSet.name);
|
|||||||
|
|
||||||
|
|
||||||
// Test prototype property of Set, Map, WeakMap and WeakSet.
|
// Test prototype property of Set, Map, WeakMap and WeakSet.
|
||||||
function TestPrototype(C) {
|
// TODO(2793): Should all be non-writable, and the extra flag removed.
|
||||||
|
function TestPrototype(C, writable) {
|
||||||
assertTrue(C.prototype instanceof Object);
|
assertTrue(C.prototype instanceof Object);
|
||||||
assertEquals({
|
assertEquals({
|
||||||
value: {},
|
value: {},
|
||||||
writable: true, // TODO(2793): This should be non-writable.
|
writable: writable,
|
||||||
enumerable: false,
|
enumerable: false,
|
||||||
configurable: false
|
configurable: false
|
||||||
}, Object.getOwnPropertyDescriptor(C, "prototype"));
|
}, Object.getOwnPropertyDescriptor(C, "prototype"));
|
||||||
}
|
}
|
||||||
TestPrototype(Set);
|
TestPrototype(Set, true);
|
||||||
TestPrototype(Map);
|
TestPrototype(Map, true);
|
||||||
TestPrototype(WeakMap);
|
TestPrototype(WeakMap, false);
|
||||||
TestPrototype(WeakSet);
|
TestPrototype(WeakSet, false);
|
||||||
|
|
||||||
|
|
||||||
// Test constructor property of the Set, Map, WeakMap and WeakSet prototype.
|
// Test constructor property of the Set, Map, WeakMap and WeakSet prototype.
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
// Flags: --harmony-symbols --harmony-collections --harmony-weak-collections
|
// Flags: --harmony-symbols --harmony-collections
|
||||||
// Flags: --expose-gc --allow-natives-syntax
|
// Flags: --expose-gc --allow-natives-syntax
|
||||||
|
|
||||||
var symbols = []
|
var symbols = []
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
// Flags: --harmony-proxies --harmony-collections --harmony-weak-collections
|
// Flags: --harmony-proxies --harmony-collections
|
||||||
|
|
||||||
|
|
||||||
// Helper.
|
// Helper.
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
// Flags: --harmony-observation --allow-natives-syntax
|
// Flags: --allow-natives-syntax
|
||||||
//
|
//
|
||||||
// Test passes if it does not crash.
|
// Test passes if it does not crash.
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
// Flags: --harmony-symbols --harmony-collections --harmony-weak-collections
|
// Flags: --harmony-symbols --harmony-collections
|
||||||
// Flags: --expose-gc --allow-natives-syntax
|
// Flags: --expose-gc --allow-natives-syntax
|
||||||
|
|
||||||
var symbols = []
|
var symbols = []
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
// Flags: --harmony_symbols --harmony-weak-collections
|
// Flags: --harmony-symbols
|
||||||
|
|
||||||
var v0 = new WeakMap;
|
var v0 = new WeakMap;
|
||||||
var v1 = {};
|
var v1 = {};
|
||||||
|
@ -28,7 +28,5 @@
|
|||||||
|
|
||||||
[
|
[
|
||||||
[ALWAYS, {
|
[ALWAYS, {
|
||||||
# http://crbug.com/347455
|
|
||||||
'2.2.7': FAIL
|
|
||||||
}], # ALWAYS
|
}], # ALWAYS
|
||||||
]
|
]
|
||||||
|
@ -30,9 +30,6 @@
|
|||||||
# BUG(237872). TODO(bmeurer): Investigate.
|
# BUG(237872). TODO(bmeurer): Investigate.
|
||||||
'string-replacement-outofmemory': [FAIL],
|
'string-replacement-outofmemory': [FAIL],
|
||||||
|
|
||||||
# TODO(rossberg): Awaiting spec resolution (https://bugs.ecmascript.org/show_bug.cgi?id=2566)
|
|
||||||
'fast/js/Promise-then': [FAIL],
|
|
||||||
|
|
||||||
##############################################################################
|
##############################################################################
|
||||||
# Flaky tests.
|
# Flaky tests.
|
||||||
# BUG(v8:2989).
|
# BUG(v8:2989).
|
||||||
|
@ -1096,6 +1096,8 @@
|
|||||||
'../../src/regexp.js',
|
'../../src/regexp.js',
|
||||||
'../../src/arraybuffer.js',
|
'../../src/arraybuffer.js',
|
||||||
'../../src/typedarray.js',
|
'../../src/typedarray.js',
|
||||||
|
'../../src/weak_collection.js',
|
||||||
|
'../../src/promise.js',
|
||||||
'../../src/object-observe.js',
|
'../../src/object-observe.js',
|
||||||
'../../src/macros.py',
|
'../../src/macros.py',
|
||||||
],
|
],
|
||||||
@ -1104,8 +1106,6 @@
|
|||||||
'../../src/symbol.js',
|
'../../src/symbol.js',
|
||||||
'../../src/proxy.js',
|
'../../src/proxy.js',
|
||||||
'../../src/collection.js',
|
'../../src/collection.js',
|
||||||
'../../src/weak_collection.js',
|
|
||||||
'../../src/promise.js',
|
|
||||||
'../../src/generator.js',
|
'../../src/generator.js',
|
||||||
'../../src/array-iterator.js',
|
'../../src/array-iterator.js',
|
||||||
'../../src/harmony-string.js',
|
'../../src/harmony-string.js',
|
||||||
|
Loading…
Reference in New Issue
Block a user