| Index: test/mjsunit/compiler/immutable-load-inline.js
|
| diff --git a/test/mjsunit/regress/regress-3183.js b/test/mjsunit/compiler/immutable-load-inline.js
|
| similarity index 54%
|
| copy from test/mjsunit/regress/regress-3183.js
|
| copy to test/mjsunit/compiler/immutable-load-inline.js
|
| index 0c915b0aec6890faba6d70026f1b465fcd9ee36e..5ebf3fabdf344e324dc851cdabbbf53f23ca173c 100644
|
| --- a/test/mjsunit/regress/regress-3183.js
|
| +++ b/test/mjsunit/compiler/immutable-load-inline.js
|
| @@ -25,72 +25,63 @@
|
| // (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
|
| +// Flags: --allow-natives-syntax --noalways-opt
|
|
|
| -(function DeoptimizeArgCallFunctionGeneric() {
|
| - var a = [];
|
| +function GrandGrandParent() {}
|
| +GrandGrandParent.prototype = Object.freeze({constant: 2});
|
|
|
| - function f1(method, array, elem, deopt) {
|
| - assertEquals('push', method);
|
| - }
|
| +function GrandParent() {}
|
| +GrandParent.prototype = Object.create(GrandGrandParent.prototype);
|
|
|
| - function f2() { }
|
| +function Parent() {}
|
| +Parent.prototype = Object.create(GrandParent.prototype);
|
|
|
| - function bar(x, deopt, f) {
|
| - f('push', a, [x], deopt + 0);
|
| - }
|
| +function Child() {}
|
| +Child.prototype = Object.create(Parent.prototype);
|
|
|
| - function foo() { return bar(arguments[0], arguments[1], arguments[2]); }
|
| - function baz(f, deopt) { return foo("x", deopt, f); }
|
| +Child.prototype.method1 = function() {
|
| + return this.constant * this.constant;
|
| +};
|
|
|
| - baz(f1, 0);
|
| - baz(f2, 0);
|
| - %OptimizeFunctionOnNextCall(baz);
|
| - baz(f1, "deopt");
|
| -})();
|
|
|
| +var a = new Child();
|
| +assertEquals(a.method1(), 4);
|
| +a.method1();
|
| +%OptimizeFunctionOnNextCall(a.method1);
|
| +assertEquals(a.method1(), 4);
|
| +assertEquals(a.method1(), 4);
|
|
|
| -(function DeoptimizeArgGlobalFunctionGeneric() {
|
| - var a = [];
|
| +// Immutable properties cannot be shadowed so the only way
|
| +// is to snip the whole chain
|
| +a.__proto__.__proto__ = {constant: 4};
|
|
|
| - var f1;
|
| +assertEquals(a.method1(), 16);
|
| +assertEquals(a.method1(), 16);
|
| +%OptimizeFunctionOnNextCall(a.method1);
|
| +assertEquals(a.method1(), 16);
|
| +assertEquals(a.method1(), 16);
|
|
|
| - f1 = function(method, array, elem, deopt) {
|
| - assertEquals('push', method);
|
| - }
|
| +var ceil = Math.ceil;
|
| +function GetMathPi() {
|
| + return ceil(Math.PI * Math.PI);
|
| +}
|
|
|
| - function bar(x, deopt, f) {
|
| - f1('push', a, [x], deopt + 0);
|
| - }
|
| +assertEquals(GetMathPi(), 10);
|
| +GetMathPi();
|
|
|
| - function foo() { return bar(arguments[0], arguments[1]); }
|
| - function baz(deopt) { return foo("x", deopt); }
|
| +%OptimizeFunctionOnNextCall(GetMathPi);
|
|
|
| - baz(0);
|
| - baz(0);
|
| - %OptimizeFunctionOnNextCall(baz);
|
| - baz("deopt");
|
| -})();
|
| +assertEquals(GetMathPi(), 10);
|
| +assertEquals(GetMathPi(), 10);
|
|
|
|
|
| -(function DeoptimizeArgCallFunctionRuntime() {
|
| - var a = [];
|
|
|
| - var f1;
|
| +new Function("Math = {PI: 1}")();
|
|
|
| - f1 = function(method, array, elem, deopt) {
|
| - assertEquals('push', method);
|
| - }
|
| +assertEquals(GetMathPi(), 1);
|
| +assertEquals(GetMathPi(), 1);
|
|
|
| - function bar(x, deopt) {
|
| - %_CallFunction(null, 'push', [x][0], ((deopt + 0), 1), f1);
|
| - }
|
| +%OptimizeFunctionOnNextCall(GetMathPi);
|
|
|
| - function foo() { return bar(arguments[0], arguments[1]); }
|
| - function baz(deopt) { return foo(0, deopt); }
|
| -
|
| - baz(0);
|
| - baz(0);
|
| - %OptimizeFunctionOnNextCall(baz);
|
| - baz("deopt");
|
| -})();
|
| +assertEquals(GetMathPi(), 1);
|
| +assertEquals(GetMathPi(), 1);
|
|
|