summaryrefslogtreecommitdiff
path: root/deps/v8/test/mjsunit/compiler/promise-prototype-finally.js
diff options
context:
space:
mode:
Diffstat (limited to 'deps/v8/test/mjsunit/compiler/promise-prototype-finally.js')
-rw-r--r--deps/v8/test/mjsunit/compiler/promise-prototype-finally.js41
1 files changed, 41 insertions, 0 deletions
diff --git a/deps/v8/test/mjsunit/compiler/promise-prototype-finally.js b/deps/v8/test/mjsunit/compiler/promise-prototype-finally.js
new file mode 100644
index 0000000000..6060f7b857
--- /dev/null
+++ b/deps/v8/test/mjsunit/compiler/promise-prototype-finally.js
@@ -0,0 +1,41 @@
+// Copyright 2018 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.
+
+// Flags: --allow-natives-syntax
+
+(function() {
+ const p = Promise.resolve(1);
+ function foo(p) { return p.finally(); }
+ foo(p);
+ foo(p);
+ %OptimizeFunctionOnNextCall(foo);
+ foo(p);
+})();
+
+(function() {
+ const p = Promise.resolve(1);
+ function foo(p) { return p.finally(x => x); }
+ foo(p);
+ foo(p);
+ %OptimizeFunctionOnNextCall(foo);
+ foo(p);
+})();
+
+(function() {
+ const p = Promise.resolve(1);
+ function foo(p, f) { return p.finally(f); }
+ foo(p, x => x);
+ foo(p, x => x);
+ %OptimizeFunctionOnNextCall(foo);
+ foo(p, x => x);
+})();
+
+(function() {
+ const p = Promise.resolve(1);
+ function foo(p, f) { return p.finally(f).finally(f); }
+ foo(p, x => x);
+ foo(p, x => x);
+ %OptimizeFunctionOnNextCall(foo);
+ foo(p, x => x);
+})();