Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(677)

Unified Diff: src/promise.js

Issue 281753004: Drop thenable coercion cache (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Test Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « include/v8.h ('k') | test/mjsunit/es6/regress/regress-cr372788.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/promise.js
diff --git a/src/promise.js b/src/promise.js
index fa650eaf0e983d31d988dc7093d11398ea515091..f4c60d66cacc9538b8aa7d7133481251b3833b0e 100644
--- a/src/promise.js
+++ b/src/promise.js
@@ -204,31 +204,22 @@ function PromiseThen(onResolve, onReject) {
);
}
-PromiseCoerce.table = new $WeakMap;
-
function PromiseCoerce(constructor, x) {
if (!IsPromise(x) && IS_SPEC_OBJECT(x)) {
var then;
try {
then = x.then;
} catch(r) {
- var promise = %_CallFunction(constructor, r, PromiseRejected);
- PromiseCoerce.table.set(x, promise);
- return promise;
+ return %_CallFunction(constructor, r, PromiseRejected);
}
- if (typeof then === 'function') {
- if (PromiseCoerce.table.has(x)) {
- return PromiseCoerce.table.get(x);
- } else {
- var deferred = %_CallFunction(constructor, PromiseDeferred);
- PromiseCoerce.table.set(x, deferred.promise);
- try {
- %_CallFunction(x, deferred.resolve, deferred.reject, then);
- } catch(r) {
- deferred.reject(r);
- }
- return deferred.promise;
+ if (IS_SPEC_FUNCTION(then)) {
+ var deferred = %_CallFunction(constructor, PromiseDeferred);
+ try {
+ %_CallFunction(x, deferred.resolve, deferred.reject, then);
+ } catch(r) {
+ deferred.reject(r);
}
+ return deferred.promise;
}
}
return x;
« no previous file with comments | « include/v8.h ('k') | test/mjsunit/es6/regress/regress-cr372788.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698