Index: src/js/string.js |
diff --git a/src/js/string.js b/src/js/string.js |
index ef5928ebc2777183a907936532f3dcc3e0ebbcc1..a4019784e8ec1239ded42118be62df9eb6bd204c 100644 |
--- a/src/js/string.js |
+++ b/src/js/string.js |
@@ -559,28 +559,14 @@ function StringTrimRight() { |
// ECMA-262, section 15.5.3.2 |
-function StringFromCharCode(code) { |
- var n = %_ArgumentsLength(); |
- if (n === 1) return %_StringCharFromCode(code & 0xffff); |
- |
- var one_byte = %NewString(n, NEW_ONE_BYTE_STRING); |
- var i; |
- for (i = 0; i < n; i++) { |
- code = %_Arguments(i) & 0xffff; |
- if (code > 0xff) break; |
- %_OneByteSeqStringSetChar(i, code, one_byte); |
- } |
- if (i == n) return one_byte; |
- one_byte = %TruncateString(one_byte, i); |
- |
- var two_byte = %NewString(n - i, NEW_TWO_BYTE_STRING); |
- %_TwoByteSeqStringSetChar(0, code, two_byte); |
- i++; |
- for (var j = 1; i < n; i++, j++) { |
- code = %_Arguments(i) & 0xffff; |
- %_TwoByteSeqStringSetChar(j, code, two_byte); |
- } |
- return one_byte + two_byte; |
+function StringFromCharCode(_) { // length == 1 |
+ "use strict"; |
+ var s = ""; |
+ var n = arguments.length; |
+ for (var i = 0; i < n; ++i) { |
+ s += %_StringCharFromCode(arguments[i] & 0xffff); |
+ } |
+ return s; |
} |