| Index: test/mjsunit/regress/regress-2193.js
|
| diff --git a/test/mjsunit/object-is.js b/test/mjsunit/regress/regress-2193.js
|
| similarity index 61%
|
| copy from test/mjsunit/object-is.js
|
| copy to test/mjsunit/regress/regress-2193.js
|
| index b9fdc8442068b4d7c50c06cb0eb8a134b8e9a7f3..50509bfcbd8ae1e05c64696195252206dd626365 100644
|
| --- a/test/mjsunit/object-is.js
|
| +++ b/test/mjsunit/regress/regress-2193.js
|
| @@ -25,23 +25,34 @@
|
| // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
| // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
| -// Test both the Harmony egal operator and it's function equivalent.
|
| +// Flags: --allow-natives-syntax --cache-optimized-code
|
|
|
| -function TestEgal(expected, x, y) {
|
| - // TODO(mstarzinger): Once we have the egal operator, we can test it here.
|
| - assertSame(expected, Object.is(x, y));
|
| -}
|
| -
|
| -var test_set = [ {}, [], 1/0, -1/0, "s", 0, 0/-1, null, undefined ];
|
| -print(test_set);
|
| -for (var i = 0; i < test_set.length; i++) {
|
| - for (var j = 0; j < test_set.length; j++) {
|
| - if (i == j) {
|
| - assertSame(test_set[i], test_set[j]);
|
| - TestEgal(true, test_set[i], test_set[j]);
|
| +function bozo() {};
|
| +function MakeClosure() {
|
| + return function f(use_literals) {
|
| + if (use_literals) {
|
| + return [1,2,3,3,4,5,6,7,8,9,bozo];
|
| } else {
|
| - TestEgal(false, test_set[i], test_set[j]);
|
| - TestEgal(false, test_set[j], test_set[i]);
|
| + return 0;
|
| }
|
| }
|
| }
|
| +
|
| +// Create two closures that share the same literal boilerplates.
|
| +var closure1 = MakeClosure();
|
| +var closure2 = MakeClosure();
|
| +var expected = [1,2,3,3,4,5,6,7,8,9,bozo];
|
| +
|
| +// Make sure we generate optimized code for the first closure after
|
| +// warming it up properly so that the literals boilerplate is generated
|
| +// and the optimized code uses CreateArrayLiteralShallow runtime call.
|
| +assertEquals(0, closure1(false));
|
| +assertEquals(expected, closure1(true));
|
| +%OptimizeFunctionOnNextCall(closure1);
|
| +assertEquals(expected, closure1(true));
|
| +
|
| +// Optimize the second closure, which should reuse the optimized code
|
| +// from the first closure with the same literal boilerplates.
|
| +assertEquals(0, closure2(false));
|
| +%OptimizeFunctionOnNextCall(closure2);
|
| +assertEquals(expected, closure2(true));
|
|
|