| Index: test/mjsunit/regress/string-set-char-deopt.js
|
| diff --git a/test/mjsunit/compiler/property-static.js b/test/mjsunit/regress/string-set-char-deopt.js
|
| similarity index 59%
|
| copy from test/mjsunit/compiler/property-static.js
|
| copy to test/mjsunit/regress/string-set-char-deopt.js
|
| index 07021340cd7aa94440638f925eeed921ee78c9c7..9f6d43453840e41d73c4a4f5702346d0fe6e16fa 100644
|
| --- a/test/mjsunit/compiler/property-static.js
|
| +++ b/test/mjsunit/regress/string-set-char-deopt.js
|
| @@ -1,4 +1,4 @@
|
| -// Copyright 2013 the V8 project authors. All rights reserved.
|
| +// Copyright 2014 the V8 project authors. All rights reserved.
|
| // Redistribution and use in source and binary forms, with or without
|
| // modification, are permitted provided that the following conditions are
|
| // met:
|
| @@ -27,43 +27,59 @@
|
|
|
| // Flags: --allow-natives-syntax
|
|
|
| -// Test usage of static type information for loads that would otherwise
|
| -// turn into polymorphic or generic loads.
|
| -
|
| -// Prepare a highly polymorphic load to be used by all tests.
|
| -Object.prototype.load = function() { return this.property; };
|
| -Object.prototype.load.call({ A:0, property:10 });
|
| -Object.prototype.load.call({ A:0, B:0, property:11 });
|
| -Object.prototype.load.call({ A:0, B:0, C:0, property:12 });
|
| -Object.prototype.load.call({ A:0, B:0, C:0, D:0, property:13 });
|
| -Object.prototype.load.call({ A:0, B:0, C:0, D:0, E:0, property:14 });
|
| -Object.prototype.load.call({ A:0, B:0, C:0, D:0, E:0, F:0, property:15 });
|
| -
|
| -// Test for object literals.
|
| -(function() {
|
| - function f(x) {
|
| - var object = { property:x };
|
| - return object.load();
|
| +(function OneByteSeqStringSetCharDeoptOsr() {
|
| + function deopt() {
|
| + %DeoptimizeFunction(f);
|
| }
|
|
|
| - assertSame(1, f(1));
|
| - assertSame(2, f(2));
|
| + function f(string, osr) {
|
| + var world = " world";
|
| + %_OneByteSeqStringSetChar(string, 0, (deopt(), 0x48));
|
| +
|
| + if (osr) while (%GetOptimizationStatus(f) == 2) {}
|
| +
|
| + return string + world;
|
| + }
|
| +
|
| + assertEquals("Hello " + "world", f("hello", false));
|
| + %OptimizeFunctionOnNextCall(f);
|
| + assertEquals("Hello " + "world", f("hello", true));
|
| +})();
|
| +
|
| +
|
| +(function OneByteSeqStringSetCharDeopt() {
|
| + function deopt() {
|
| + %DeoptimizeFunction(f);
|
| + }
|
| +
|
| + function g(x) {
|
| + }
|
| +
|
| + function f(string) {
|
| + g(%_OneByteSeqStringSetChar(string, 0, (deopt(), 0x48)));
|
| + return string;
|
| + }
|
| +
|
| + assertEquals("Hell" + "o", f("hello"));
|
| %OptimizeFunctionOnNextCall(f);
|
| - assertSame(3, f(3));
|
| + assertEquals("Hell" + "o", f("hello"));
|
| })();
|
|
|
| -// Test for inlined constructors.
|
| -(function() {
|
| - function c(x) {
|
| - this.property = x;
|
| +
|
| +(function TwoByteSeqStringSetCharDeopt() {
|
| + function deopt() {
|
| + %DeoptimizeFunction(f);
|
| + }
|
| +
|
| + function g(x) {
|
| }
|
| - function f(x) {
|
| - var object = new c(x);
|
| - return object.load();
|
| +
|
| + function f(string) {
|
| + g(%_TwoByteSeqStringSetChar(string, 0, (deopt(), 0x48)));
|
| + return string;
|
| }
|
|
|
| - assertSame(1, f(1));
|
| - assertSame(2, f(2));
|
| + assertEquals("Hell" + "o", f("\u20ACello"));
|
| %OptimizeFunctionOnNextCall(f);
|
| - assertSame(3, f(3));
|
| + assertEquals("Hell" + "o", f("\u20ACello"));
|
| })();
|
|
|