Index: test/mjsunit/regress/regress-convert-hole2.js |
diff --git a/test/mjsunit/regress/regress-int32-truncation.js b/test/mjsunit/regress/regress-convert-hole2.js |
similarity index 57% |
copy from test/mjsunit/regress/regress-int32-truncation.js |
copy to test/mjsunit/regress/regress-convert-hole2.js |
index dec4ac1195a6c4928d84eac8cc8dc9496bf66600..b434ed3996b298a5198527fd0f999485da5507e6 100644 |
--- a/test/mjsunit/regress/regress-int32-truncation.js |
+++ b/test/mjsunit/regress/regress-convert-hole2.js |
@@ -24,38 +24,63 @@ |
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
// (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 --notrack-allocation-sites |
-// Flags: --allow-natives-syntax |
+// Test adding undefined from hole in double-holey to string. |
+var a = [1.5, , 1.8]; |
-function f(i, b) { |
- var a = 0; |
- if (b) { |
- var c = 1 << i; |
- a = c + c; |
- } |
- var x = a >> 3; |
- return a; |
+function f(a, i, l) { |
+ var v = a[i]; |
+ return l + v; |
} |
-f(1, false); |
-f(1, true); |
+assertEquals("test1.5", f(a, 0, "test")); |
+assertEquals("test1.5", f(a, 0, "test")); |
%OptimizeFunctionOnNextCall(f); |
-assertEquals((1 << 30) * 2, f(30, true)); |
- |
+assertEquals("testundefined", f(a, 1, "test")); |
-var global = 1; |
- |
-function f2(b) { |
- var a = 0; |
+// Test double-hole going through a phi to a string-add. |
+function f2(b, a1, a2) { |
+ var v; |
if (b) { |
- a = global; |
+ v = a1[0]; |
+ } else { |
+ v = a2[0]; |
} |
- var x = a >> 3; |
- return a; |
+ x = v * 2; |
+ return "test" + v + x; |
} |
-f2(false); |
-f2(true); |
+f2(true, [1.4,1.8,,1.9], [1.4,1.8,,1.9]); |
+f2(true, [1.4,1.8,,1.9], [1.4,1.8,,1.9]); |
+f2(false, [1.4,1.8,,1.9], [1.4,1.8,,1.9]); |
+f2(false, [1.4,1.8,,1.9], [1.4,1.8,,1.9]); |
%OptimizeFunctionOnNextCall(f2); |
-global = 2.5; |
-assertEquals(global, f2(true)); |
+assertEquals("testundefinedNaN", f2(false, [,1.8,,1.9], [,1.9,,1.9])); |
+ |
+// Test converting smi-hole to double-hole. |
+function t_smi(a) { |
+ a[0] = 1.5; |
+} |
+ |
+t_smi([1,,3]); |
+t_smi([1,,3]); |
+t_smi([1,,3]); |
+%OptimizeFunctionOnNextCall(t_smi); |
+var ta = [1,,3]; |
+t_smi(ta); |
+ta.__proto__ = [6,6,6]; |
+assertEquals([1.5,6,3], ta); |
+ |
+// Test converting double-hole to tagged-hole. |
+function t(b) { |
+ b[1] = {}; |
+} |
+ |
+t([1.4, 1.6,,1.8, NaN]); |
+t([1.4, 1.6,,1.8, NaN]); |
+%OptimizeFunctionOnNextCall(t); |
+var a = [1.6, 1.8,,1.9, NaN]; |
+t(a); |
+a.__proto__ = [6,6,6,6,6]; |
+assertEquals([1.6, {}, 6, 1.9, NaN], a); |