Index: sdk/lib/_internal/compiler/implementation/lib/js_helper.dart |
diff --git a/sdk/lib/_internal/compiler/implementation/lib/js_helper.dart b/sdk/lib/_internal/compiler/implementation/lib/js_helper.dart |
index ea31fe24088f2941034de76a538745bf5acd89e5..7d838f891fecb121f1c7180ee638838f08abae08 100644 |
--- a/sdk/lib/_internal/compiler/implementation/lib/js_helper.dart |
+++ b/sdk/lib/_internal/compiler/implementation/lib/js_helper.dart |
@@ -535,7 +535,22 @@ class Primitives { |
static num dateNow() => JS('num', r'Date.now()'); |
- static stringFromCodePoints(codePoints) { |
+ // This is to fix http://dartbug.com/6919 |
floitsch
2012/11/26 12:01:28
Please add a little bit of context, so that you do
erikcorry
2012/12/03 12:37:24
Done.
|
+ static String _doFromCharCode(List<int> array) { |
floitsch
2012/11/26 12:01:28
_fromCharCodeApply
?
erikcorry
2012/12/03 12:37:24
Done.
|
+ String acc = ""; |
floitsch
2012/11/26 12:01:28
result
erikcorry
2012/12/03 12:37:24
Done.
|
+ const kMaxApply = 500; |
+ int end = array.length; |
+ for (var i = 0; i < end; i += kMaxApply) { |
+ var subarray = end <= kMaxApply ? array : |
floitsch
2012/11/26 12:01:28
nit: I would prefer having an "if" there.
erikcorry
2012/12/03 12:37:24
Done.
|
+ JS('List<int>', r'array.slice(#, #)', |
sra1
2012/12/03 16:22:44
JS('=List', ...)
The result of Array.prototype.sl
|
+ i, i + kMaxApply < end ? i + kMaxApply: end); |
+ acc = JS('String', '# + String.fromCharCode.apply(#, #)', |
+ acc, null, subarray); |
+ } |
+ return acc; |
+ } |
+ |
+ static String stringFromCodePoints(codePoints) { |
List<int> a = <int>[]; |
for (var i in codePoints) { |
if (i is !int) throw new ArgumentError(i); |
@@ -548,7 +563,7 @@ class Primitives { |
throw new ArgumentError(i); |
} |
} |
- return JS('String', r'String.fromCharCode.apply(#, #)', null, a); |
+ _doFromCharCode(a); |
} |
static String stringFromCharCodes(charCodes) { |
@@ -557,7 +572,7 @@ class Primitives { |
if (i < 0) throw new ArgumentError(i); |
if (i > 0xffff) return stringFromCodePoints(charCodes); |
} |
- return JS('String', r'String.fromCharCode.apply(#, #)', null, charCodes); |
+ _doFromCharCode(a); |
} |
static String getTimeZoneName(receiver) { |