| Index: test/mjsunit/compiler/inline-closures.js
|
| diff --git a/test/mjsunit/regress/regress-171641.js b/test/mjsunit/compiler/inline-closures.js
|
| similarity index 75%
|
| copy from test/mjsunit/regress/regress-171641.js
|
| copy to test/mjsunit/compiler/inline-closures.js
|
| index 8db6781821325f8f6253eb2df4abb2b362b001c0..69161e505e5f28c25c0d5a8a87d48e0cedf6c389 100644
|
| --- a/test/mjsunit/regress/regress-171641.js
|
| +++ b/test/mjsunit/compiler/inline-closures.js
|
| @@ -27,14 +27,23 @@
|
|
|
| // Flags: --allow-natives-syntax
|
|
|
| -function foo(k, p) {
|
| - for (var i = 0; i < 1; i++) {
|
| - p = Math.min(p, i);
|
| +// Test inlining of multiple closures derived from one shared function.
|
| +
|
| +function mkClosure(continuation) {
|
| + return function(value) {
|
| + if (continuation == 'g') return this.g(value);
|
| + if (continuation == 'h') return this.h(value);
|
| + return value.value;
|
| }
|
| - m = Math.floor((k | 0) / p);
|
| }
|
|
|
| -foo(0, 1);
|
| -foo(0, 1);
|
| -%OptimizeFunctionOnNextCall(foo);
|
| -foo(0, 1);
|
| +var object = {};
|
| +object.f = mkClosure('g');
|
| +object.g = mkClosure('h');
|
| +object.h = mkClosure('x');
|
| +
|
| +assertSame(1, object.f({value:1}));
|
| +assertSame(2, object.f({value:2}));
|
| +%OptimizeFunctionOnNextCall(object.f);
|
| +assertSame(3, object.f({value:3}));
|
| +assertSame(undefined, object.f({}));
|
|
|