Index: sdk/lib/_internal/lib/js_primitives.dart |
diff --git a/sdk/lib/_internal/lib/js_primitives.dart b/sdk/lib/_internal/lib/js_primitives.dart |
index 3315040636019394590ae862bc595a16975ce4a6..86a405eb2918b94f6ebfc910db87bf4e9d2dd0b3 100644 |
--- a/sdk/lib/_internal/lib/js_primitives.dart |
+++ b/sdk/lib/_internal/lib/js_primitives.dart |
@@ -9,6 +9,10 @@ library dart2js._js_primitives; |
import 'dart:_foreign_helper' show |
JS; |
+import 'dart:_interceptors' show |
+ JSExtendableArray, |
+ JSFixedArray; |
+ |
/** |
* This is the low-level method that is used to implement [print]. It is |
* possible to override this function from JavaScript by defining a function in |
@@ -48,3 +52,16 @@ void printString(String string) { |
// avoid using Dart [:throw:] and Dart [toString]. |
JS('void', 'throw "Unable to print message: " + String(#)', string); |
} |
+ |
+List newGrowableList(length) { |
+ return JS('JSExtendableArray', r'new Array(#)', length); |
+} |
+ |
+List newFixedList(length) { |
+ return markFixedList(JS('', r'new Array(#)', length)); |
+} |
+ |
+List markFixedList(List list) { |
+ JS('void', r'#.fixed$length = #', list, true); |
+ return JS('JSFixedArray', '#', list); |
+} |