aboutsummaryrefslogtreecommitdiff
path: root/deps/v8/test/mjsunit/string-fromcharcode.js
diff options
context:
space:
mode:
Diffstat (limited to 'deps/v8/test/mjsunit/string-fromcharcode.js')
-rw-r--r--deps/v8/test/mjsunit/string-fromcharcode.js21
1 files changed, 21 insertions, 0 deletions
diff --git a/deps/v8/test/mjsunit/string-fromcharcode.js b/deps/v8/test/mjsunit/string-fromcharcode.js
index 1986dda0fb..631c04349f 100644
--- a/deps/v8/test/mjsunit/string-fromcharcode.js
+++ b/deps/v8/test/mjsunit/string-fromcharcode.js
@@ -25,8 +25,29 @@
// (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
+
// Test String.fromCharCode.
+// Test char codes larger than 0xffff.
+var expected = "";
+for (var i = 100; i < 500; i++) {
+ expected += String.fromCharCode(i);
+}
+
+function testCharCodeTruncation() {
+ var result = "";
+ for (var i = 0x100000 + 100; i < 0x100000 + 500; i++) {
+ result += String.fromCharCode(i);
+ }
+ assertEquals(String.fromCharCode(0xFFFF), String.fromCharCode(0xFFFFFFFF));
+ return result;
+}
+
+assertEquals(expected, testCharCodeTruncation());
+assertEquals(expected, testCharCodeTruncation());
+%OptimizeFunctionOnNextCall(testCharCodeTruncation);
+assertEquals(expected, testCharCodeTruncation());
// Test various receivers and arguments passed to String.fromCharCode.