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); |
+}; |