Index: test/mjsunit/regress/regress-seqstrsetchar-ex1.js |
diff --git a/test/mjsunit/array-non-smi-length.js b/test/mjsunit/regress/regress-seqstrsetchar-ex1.js |
similarity index 66% |
copy from test/mjsunit/array-non-smi-length.js |
copy to test/mjsunit/regress/regress-seqstrsetchar-ex1.js |
index 23a25ee797bd68690ad2a7ce26a9135e23b486e2..047751328c5476852485bfa7fc0f3fde9758be2d 100644 |
--- a/test/mjsunit/array-non-smi-length.js |
+++ b/test/mjsunit/regress/regress-seqstrsetchar-ex1.js |
@@ -27,20 +27,34 @@ |
// Flags: --allow-natives-syntax |
-function TestNonSmiArrayLength() { |
- function f(a) { |
- return a.length+1; |
- } |
+// stubbed version of ToNumber |
+function ToNumber(x) { |
+ return 311; |
+} |
- var a = []; |
- a.length = 0xFFFF; |
- assertSame(0x10000, f(a)); |
- assertSame(0x10000, f(a)); |
+// Reduced version of String.fromCharCode; |
+// does not actually do the same calculation but exhibits untagging bug |
+function StringFromCharCode(code) { |
+ var n = %_ArgumentsLength(); |
+ var one_byte = %NewString(n, true); |
+ var i; |
+ for (i = 0; i < n; i++) { |
+ var code = %_Arguments(i); |
+ if (!%_IsSmi(code)) code = ToNumber(code) & 0xffff; |
+ if (code > 0xff) break; |
+ } |
- %OptimizeFunctionOnNextCall(f); |
- a.length = 0xFFFFFFFF; |
- assertSame(0x100000000, f(a)); |
+ var two_byte = %NewString(n - i, false); |
+ for (var j = 0; i < n; i++, j++) { |
+ var code = %_Arguments(i); |
+ %_TwoByteSeqStringSetChar(two_byte, j, code); |
+ } |
+ return one_byte + two_byte; |
} |
-TestNonSmiArrayLength(); |
+StringFromCharCode(0xFFF, 0xFFF); |
+StringFromCharCode(0x7C, 0x7C); |
+%OptimizeFunctionOnNextCall(StringFromCharCode); |
+StringFromCharCode(0x7C, 0x7C); |
+StringFromCharCode(0xFFF, 0xFFF); |