2017-05-17 12:24:24 +00:00
|
|
|
// Copyright 2017 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
|
|
|
|
|
|
|
|
var array = [[{}], [1.1]];
|
|
|
|
|
|
|
|
function transition() {
|
2019-06-12 14:00:50 +00:00
|
|
|
for (var i = 0; i < array.length; i++) {
|
2017-05-17 12:24:24 +00:00
|
|
|
var arr = array[i];
|
|
|
|
arr[0] = {};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-06-12 14:00:50 +00:00
|
|
|
var double_arr2 = [1.1, 2.2];
|
2017-05-17 12:24:24 +00:00
|
|
|
|
|
|
|
var flag = 0;
|
|
|
|
function swap() {
|
2019-06-12 14:00:50 +00:00
|
|
|
try {
|
|
|
|
} catch (e) {
|
|
|
|
} // Prevent Crankshaft from inlining this.
|
2017-05-17 12:24:24 +00:00
|
|
|
if (flag == 1) {
|
|
|
|
array[1] = double_arr2;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
var expected = 6.176516726456e-312;
|
2019-06-12 14:00:50 +00:00
|
|
|
function f() {
|
2017-05-17 12:24:24 +00:00
|
|
|
swap();
|
|
|
|
double_arr2[0] = 1;
|
|
|
|
transition();
|
|
|
|
double_arr2[1] = expected;
|
2019-06-12 14:00:50 +00:00
|
|
|
};
|
|
|
|
%PrepareFunctionForOptimization(f);
|
|
|
|
for (var i = 0; i < 3; i++) {
|
2017-05-17 12:24:24 +00:00
|
|
|
f();
|
|
|
|
}
|
|
|
|
%OptimizeFunctionOnNextCall(f);
|
|
|
|
flag = 1;
|
|
|
|
f();
|
|
|
|
assertEquals(expected, double_arr2[1]);
|