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

Unified Diff: test/promises-aplus/lib/adapter.js

Issue 196733002: Add Promises/A+ Compliance Test Suite. (Closed) Base URL: git://github.com/v8/v8.git@master
Patch Set: Created 6 years, 9 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
Index: test/promises-aplus/lib/adapter.js
diff --git a/test/mjsunit/compiler/alloc-number-debug.js b/test/promises-aplus/lib/adapter.js
similarity index 80%
copy from test/mjsunit/compiler/alloc-number-debug.js
copy to test/promises-aplus/lib/adapter.js
index ccfcc0c185a6d29c0acfc3c217276434b71f130a..d99913a138fdc346927e1d2835aed0975e7fe2d0 100644
--- a/test/mjsunit/compiler/alloc-number-debug.js
+++ b/test/promises-aplus/lib/adapter.js
@@ -25,20 +25,17 @@
// (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
+var global = this.global || {};
-// Try to get a GC because of a heap number allocation while we
-// have live values (o) in a register.
-function f(o) {
- var x = 1.5;
- var y = 2.5;
- for (var i = 1; i < 3; i += 1) {
- %SetAllocationTimeout(1, 0, false);
- o.val = x + y + i;
- %SetAllocationTimeout(-1, -1, true);
+global.adapter = {
+ resolved: function(value) { return Promise.resolve(value); },
+ rejected: function(reason) { return Promise.reject(reason); },
+ deferred: function() {
+ var resolve, reject;
+ var promise = new Promise(function(res, rej) {
+ resolve = res;
+ reject = rej;
+ });
+ return {promise: promise, resolve: resolve, reject: reject};
}
- return o;
-}
-
-var o = { val: 0 };
-f(o);
+};

Powered by Google App Engine
This is Rietveld 408576698