react-nitro-hermes 0.0.1-alpha.8 → 0.0.1-alpha.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (181) hide show
  1. package/hermes/CMakeLists.txt +874 -0
  2. package/hermes/android/HostObjectJniTest.cpp +178 -0
  3. package/hermes/android/build-logic/build.gradle.kts +31 -0
  4. package/hermes/android/build-logic/settings.gradle.kts +17 -0
  5. package/hermes/android/build-logic/src/main/kotlin/com/facebook/hermes/helpers/internal/SerializeHermesCompilerPackageJson.kt +33 -0
  6. package/hermes/android/build-logic/src/main/kotlin/com/facebook/hermes/plugins/internal/TestUtilsPlugin.kt +80 -0
  7. package/hermes/android/build-logic/src/main/kotlin/com/facebook/hermes/tasks/internal/CustomExecTask.kt +46 -0
  8. package/hermes/android/build-logic/src/main/kotlin/publish.gradle.kts +82 -0
  9. package/hermes/android/build.gradle.kts +332 -0
  10. package/hermes/android/cppruntime/build.gradle +72 -0
  11. package/hermes/android/cppruntime/src/main/AndroidManifest.xml +2 -0
  12. package/hermes/android/cppruntime/src/main/cpp/CMakeLists.txt +8 -0
  13. package/hermes/android/cppruntime/src/main/cpp/stub.cpp +12 -0
  14. package/hermes/android/cross-compile/swift-libicu.patch +13 -0
  15. package/hermes/android/cross-compile/toolchain-android-arm-api13-gnustl.cmake +13 -0
  16. package/hermes/android/cross-compile/toolchain-android-arm-api15-gnustl.cmake +14 -0
  17. package/hermes/android/gradle/libs.versions.toml +30 -0
  18. package/hermes/android/gradle/wrapper/gradle-wrapper.jar +0 -0
  19. package/hermes/android/gradle/wrapper/gradle-wrapper.properties +7 -0
  20. package/hermes/android/gradle.properties +3 -0
  21. package/hermes/android/gradlew +248 -0
  22. package/hermes/android/gradlew.bat +93 -0
  23. package/hermes/android/intltest/build.gradle +147 -0
  24. package/hermes/android/intltest/java/com/facebook/hermes/test/CMakeLists.txt +45 -0
  25. package/hermes/android/intltest/java/com/facebook/hermes/test/HermesEpilogue.cpp +68 -0
  26. package/hermes/android/intltest/java/com/facebook/hermes/test/HermesEpilogue.h +44 -0
  27. package/hermes/android/intltest/java/com/facebook/hermes/test/HermesEpilogue.java +45 -0
  28. package/hermes/android/intltest/java/com/facebook/hermes/test/HermesEpilogueTestData.java +32 -0
  29. package/hermes/android/intltest/java/com/facebook/hermes/test/HermesInstrumentationTest.java +150 -0
  30. package/hermes/android/intltest/java/com/facebook/hermes/test/HermesIntlAndroidTest.java +147 -0
  31. package/hermes/android/intltest/java/com/facebook/hermes/test/HermesIntlTest262.java +470 -0
  32. package/hermes/android/intltest/java/com/facebook/hermes/test/HermesRuntimeFactory.cpp +73 -0
  33. package/hermes/android/intltest/java/com/facebook/hermes/test/JSRuntime.cpp +90 -0
  34. package/hermes/android/intltest/java/com/facebook/hermes/test/JSRuntime.h +62 -0
  35. package/hermes/android/intltest/java/com/facebook/hermes/test/JSRuntime.java +155 -0
  36. package/hermes/android/intltest/java/com/facebook/hermes/test/MappedFileBuffer.cpp +48 -0
  37. package/hermes/android/intltest/java/com/facebook/hermes/test/MappedFileBuffer.h +36 -0
  38. package/hermes/android/intltest/java/com/facebook/hermes/test/OnLoad.cpp +13 -0
  39. package/hermes/android/intltest/java/com/facebook/hermes/test/OnLoadEpilogue.cpp +13 -0
  40. package/hermes/android/intltest/src/main/AndroidManifest.xml +2 -0
  41. package/hermes/android/ios-artifacts/build.gradle.kts +65 -0
  42. package/hermes/android/settings.gradle.kts +27 -0
  43. package/hermes/cmake/modules/Hermes.cmake +481 -0
  44. package/hermes/cmake/modules/Lit.cmake +96 -0
  45. package/hermes/doc/Branches.md +38 -0
  46. package/hermes/doc/BuildingAndRunning.md +121 -0
  47. package/hermes/doc/CodingStandards.md +112 -0
  48. package/hermes/doc/CrossCompilation.md +79 -0
  49. package/hermes/doc/Design.md +217 -0
  50. package/hermes/doc/Emscripten.md +156 -0
  51. package/hermes/doc/Features.md +143 -0
  52. package/hermes/doc/GCSafeCoding.md +563 -0
  53. package/hermes/doc/GenGC.md +300 -0
  54. package/hermes/doc/Hades.md +344 -0
  55. package/hermes/doc/HighLevelOptimizations.md +37 -0
  56. package/hermes/doc/IR.md +1306 -0
  57. package/hermes/doc/IntlAPIs.md +196 -0
  58. package/hermes/doc/JIT.md +999 -0
  59. package/hermes/doc/LazyEvalCompilation.md +84 -0
  60. package/hermes/doc/MemoryProfilers.md +316 -0
  61. package/hermes/doc/Modules.md +144 -0
  62. package/hermes/doc/Optimizer.md +83 -0
  63. package/hermes/doc/PerfProfiling.md +29 -0
  64. package/hermes/doc/ProhibitInvoke.md +329 -0
  65. package/hermes/doc/ReactNative.md +40 -0
  66. package/hermes/doc/ReactNativeIntegration.md +94 -0
  67. package/hermes/doc/RegExp.md +24 -0
  68. package/hermes/doc/SpecIncompat.md +85 -0
  69. package/hermes/doc/Strings.md +140 -0
  70. package/hermes/doc/TypedLanguage.md +432 -0
  71. package/hermes/doc/VM.md +174 -0
  72. package/hermes/doc/blog/2024-11-09-octane-benchmark-jit-progress.md +17 -0
  73. package/hermes/doc/blog/2024-12-19-static-hermes-update-dec-2024.md +47 -0
  74. package/hermes/doc/blog/2024-12-23-compiling-javascript-to-wasm.md +267 -0
  75. package/hermes/doc/blog/2025-06-09-jsi-runtime-data-apis.md +23 -0
  76. package/hermes/doc/blog/2025-07-15-static-h-performance-june-2025.md +18 -0
  77. package/hermes/doc/blog/2025-11-02-hermes-compilation-runtime-modes.md +23 -0
  78. package/hermes/doc/blog/2025-11-06-hermes-memory-modes.md +35 -0
  79. package/hermes/doc/blog/2025-11-24-json-parsing-performance.md +17 -0
  80. package/hermes/doc/blog/2025-12-02-iserialization.md +11 -0
  81. package/hermes/doc/blog/2025-12-12-new-way-to-contribute.md +68 -0
  82. package/hermes/doc/blog/2026-06-05-new-hermes-stable-release.md +51 -0
  83. package/hermes/doc/blog/README.md +25 -0
  84. package/hermes/doc/blog/images/2024-11-09-octane-pi3.jpeg +0 -0
  85. package/hermes/doc/blog/images/2024-11-09-octane-pi5.jpeg +0 -0
  86. package/hermes/doc/blog/images/2025-07-15-perf-hv32-interpreter.jpeg +0 -0
  87. package/hermes/doc/blog/images/2025-07-15-perf-hv32-jit.jpeg +0 -0
  88. package/hermes/doc/icu_license.txt +420 -0
  89. package/hermes/doc/img/heap_snapshot_retainers.png +0 -0
  90. package/hermes/doc/img/logo.svg +1 -0
  91. package/hermes/doc/img/object_captured_by_environment.png +0 -0
  92. package/hermes/doc/img/root_categories.png +0 -0
  93. package/hermes/doc/plans/ir-type/flow-type-system.md +324 -0
  94. package/hermes/doc/plans/ir-type/ir-type-system-v2-design.md +652 -0
  95. package/hermes/doc/plans/ir-type/ir-type-system.md +220 -0
  96. package/hermes/doc/plans/ir-type/ir-type-v2-implementation.md +1187 -0
  97. package/hermes/doc/plans/ir-type/memory.md +48 -0
  98. package/hermes/doc/plans/ir-type/phase1-steps.md +512 -0
  99. package/hermes/doc/plans/ir-type/progress.md +239 -0
  100. package/hermes/doc/plans/ir-type/typeinference-primitive-fastpath-design.md +203 -0
  101. package/hermes/doc/plans/ir-type/typeinference-primitive-fastpath-results.md +71 -0
  102. package/hermes/doc/superpowers/plans/2026-07-28-worker-arraybuffer-input.md +597 -0
  103. package/hermes/doc/superpowers/plans/2026-08-18-jitemitter-split.md +1149 -0
  104. package/hermes/doc/superpowers/plans/2026-08-20-jit-type-asserts.md +969 -0
  105. package/hermes/doc/superpowers/plans/2026-08-23-jit-shared-compiler-driver.md +478 -0
  106. package/hermes/doc/superpowers/plans/2026-08-23-x86-64-jit-skeleton.md +797 -0
  107. package/hermes/doc/superpowers/plans/2026-08-24-x86-64-jit-arith.md +444 -0
  108. package/hermes/doc/superpowers/plans/2026-08-24-x86-64-jit-calls.md +261 -0
  109. package/hermes/doc/superpowers/plans/2026-08-24-x86-64-jit-props.md +240 -0
  110. package/hermes/doc/superpowers/plans/2026-10-26-regexp-bytecode-sharing.md +2197 -0
  111. package/hermes/doc/superpowers/plans/2026-10-28-regexp-start-filter-and-exec-fast-paths.md +3981 -0
  112. package/hermes/doc/superpowers/specs/2026-07-28-worker-arraybuffer-input-design.md +206 -0
  113. package/hermes/doc/superpowers/specs/2026-08-18-jitemitter-split-design.md +530 -0
  114. package/hermes/doc/superpowers/specs/2026-08-20-jit-type-asserts-design.md +360 -0
  115. package/hermes/doc/superpowers/specs/2026-08-23-x86-64-jit-design.md +246 -0
  116. package/hermes/doc/superpowers/specs/2026-08-26-icu-free-normalize-design.md +355 -0
  117. package/hermes/doc/superpowers/specs/2026-08-27-icu-free-convert-to-case-design.md +305 -0
  118. package/hermes/doc/superpowers/specs/2026-08-27-icu-free-locale-compare-design.md +429 -0
  119. package/hermes/doc/superpowers/specs/2026-08-29-icu-free-date-format-design.md +297 -0
  120. package/hermes/doc/superpowers/specs/2026-10-26-regexp-bytecode-sharing-design.md +605 -0
  121. package/hermes/doc/superpowers/specs/2026-10-28-regexp-start-filter-and-exec-fast-paths-design.md +551 -0
  122. package/hermes/doc/typescript-stripping.md +90 -0
  123. package/hermes/external/CMakeLists.txt +20 -0
  124. package/hermes/utils/IntlGen/IntlGen.java +531 -0
  125. package/hermes/utils/bench_with_stats.py +827 -0
  126. package/hermes/utils/build-apple-framework.sh +323 -0
  127. package/hermes/utils/chrome_snapshot_parser.py +210 -0
  128. package/hermes/utils/cmake-dev-build.sh +18 -0
  129. package/hermes/utils/commons.sh +55 -0
  130. package/hermes/utils/dump-cpp-funcs.sh +3 -0
  131. package/hermes/utils/es5objects.js +198 -0
  132. package/hermes/utils/format.sh +145 -0
  133. package/hermes/utils/gen-promise-internal-bc.sh +66 -0
  134. package/hermes/utils/genUnicodeTable.py +2503 -0
  135. package/hermes/utils/hermes-lit/CMakeLists.txt +22 -0
  136. package/hermes/utils/hermes-lit/hermes-lit.in +15 -0
  137. package/hermes/utils/jit/README.md +134 -0
  138. package/hermes/utils/jit/jit-diff.sh +160 -0
  139. package/hermes/utils/jit/jit-dump.sh +193 -0
  140. package/hermes/utils/lit-expect-gen/generate.py +217 -0
  141. package/hermes/utils/promise/index.js +15 -0
  142. package/hermes/utils/promise/package.json +13 -0
  143. package/hermes/utils/promise/rollup.config.js +19 -0
  144. package/hermes/utils/promise/yarn.lock +247 -0
  145. package/hermes/utils/scripts/hermes/consts.js +26 -0
  146. package/hermes/utils/scripts/hermes/create-tarball.js +75 -0
  147. package/hermes/utils/scripts/hermes/get-hermes-version.js +57 -0
  148. package/hermes/utils/scripts/hermes/hermes-utils.js +122 -0
  149. package/hermes/utils/scripts/hermes/package.json +6 -0
  150. package/hermes/utils/scripts/hermes/prepare-artifacts.js +113 -0
  151. package/hermes/utils/scripts/hermes/publish-artifacts.js +109 -0
  152. package/hermes/utils/scripts/hermes/publish-npm.js +96 -0
  153. package/hermes/utils/scripts/hermes/scm-utils.js +41 -0
  154. package/hermes/utils/scripts/hermes/set-artifacts-version.js +64 -0
  155. package/hermes/utils/scripts/hermes/version-utils.js +98 -0
  156. package/hermes/utils/scripts/hermes/yarn.lock +240 -0
  157. package/hermes/utils/summarize_sizes.py +184 -0
  158. package/hermes/utils/symbolicate-nativecall-stats.py +112 -0
  159. package/hermes/utils/test_runner.py +13 -0
  160. package/hermes/utils/testsuite/README.facebook +3 -0
  161. package/hermes/utils/testsuite/README.md +69 -0
  162. package/hermes/utils/testsuite/cli.py +547 -0
  163. package/hermes/utils/testsuite/es_ast.py +337 -0
  164. package/hermes/utils/testsuite/external/LICENSE +28 -0
  165. package/hermes/utils/testsuite/external/README.facebook +8 -0
  166. package/hermes/utils/testsuite/external/__init__.py +0 -0
  167. package/hermes/utils/testsuite/external/_monkeyYaml.py +164 -0
  168. package/hermes/utils/testsuite/external/parse_test262.py +141 -0
  169. package/hermes/utils/testsuite/hermes.py +522 -0
  170. package/hermes/utils/testsuite/preprocess.py +365 -0
  171. package/hermes/utils/testsuite/progress.py +377 -0
  172. package/hermes/utils/testsuite/skiplist.json +4356 -0
  173. package/hermes/utils/testsuite/skiplist.py +270 -0
  174. package/hermes/utils/testsuite/test_run_defs.py +435 -0
  175. package/hermes/utils/testsuite/typing_defs.py +52 -0
  176. package/hermes/utils/testsuite/utils.py +214 -0
  177. package/hermes/utils/tidy.sh +22 -0
  178. package/hermes/utils/update-fbcode-hermes.sh +53 -0
  179. package/hermes/utils/updateErrorTest.py +193 -0
  180. package/hermes/utils/wasm-compile.sh +65 -0
  181. package/package.json +1 -1
@@ -0,0 +1,470 @@
1
+ /*
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+
8
+ import static org.assertj.core.api.Assertions.assertThat;
9
+
10
+ import android.content.res.AssetManager;
11
+ import android.text.TextUtils;
12
+ import android.util.Log;
13
+ import androidx.test.platform.app.InstrumentationRegistry;
14
+ import androidx.test.runner.AndroidJUnit4;
15
+ import com.facebook.hermes.test.JSRuntime;
16
+ import java.io.BufferedReader;
17
+ import java.io.IOException;
18
+ import java.io.InputStream;
19
+ import java.io.InputStreamReader;
20
+ import java.util.ArrayList;
21
+ import java.util.Arrays;
22
+ import java.util.HashMap;
23
+ import java.util.HashSet;
24
+ import java.util.Map;
25
+ import java.util.Set;
26
+ import java.util.Stack;
27
+ import org.junit.Test;
28
+ import org.junit.runner.RunWith;
29
+
30
+ // Run "./gradlew :intltest:prepareTests" from the root to copy the test files to the
31
+ // APK assets.
32
+ @RunWith(AndroidJUnit4.class)
33
+ public class HermesIntlTest262 {
34
+
35
+ private static final String LOG_TAG = "HermesIntlTest";
36
+
37
+ protected void evalScriptFromAsset(JSRuntime rt, String filename) throws IOException {
38
+ AssetManager assets =
39
+ InstrumentationRegistry.getInstrumentation().getTargetContext().getAssets();
40
+ InputStream is = assets.open(filename);
41
+
42
+ BufferedReader r = new BufferedReader(new InputStreamReader(is));
43
+ StringBuilder total = new StringBuilder();
44
+ for (String line; (line = r.readLine()) != null; ) {
45
+ total.append(line).append('\n');
46
+ }
47
+
48
+ String script = total.toString();
49
+
50
+ rt.evaluateJavaScript(script);
51
+ }
52
+
53
+ protected void evaluateCommonScriptsFromAsset(JSRuntime rt) throws IOException {
54
+ evalScriptFromAsset(rt, "test262/harness/sta.js");
55
+ evalScriptFromAsset(rt, "test262/harness/assert.js");
56
+ evalScriptFromAsset(rt, "test262/harness/testIntl.js");
57
+ evalScriptFromAsset(rt, "test262/harness/propertyHelper.js");
58
+ evalScriptFromAsset(rt, "test262/harness/compareArray.js");
59
+ evalScriptFromAsset(rt, "test262/harness/dateConstants.js");
60
+ evalScriptFromAsset(rt, "test262/harness/isConstructor.js");
61
+ evalScriptFromAsset(rt, "test262/harness/testTypedArray.js");
62
+ }
63
+
64
+ @Test
65
+ public void test262Intl() throws IOException {
66
+ Set<String> skipList = getSkipList();
67
+ Stack<String> testFiles = new Stack<>();
68
+ testFiles.push("test262/test");
69
+ AssetManager assets =
70
+ InstrumentationRegistry.getInstrumentation().getTargetContext().getAssets();
71
+ ArrayList<String> ranTests = new ArrayList<>();
72
+ HashMap<String, String> failedTests = new HashMap<>();
73
+
74
+ while (!testFiles.isEmpty()) {
75
+ String path = testFiles.pop();
76
+ String[] contents = assets.list(path);
77
+ if (skipList.contains(path)) continue;
78
+ // If this is a subdirectory, add all of its contents to the list.
79
+ if (contents.length > 0) {
80
+ for (String filename : assets.list(path)) {
81
+ testFiles.push(path + "/" + filename);
82
+ }
83
+ Log.v(LOG_TAG, "Found subdirectory " + path);
84
+ continue;
85
+ }
86
+ Log.d(LOG_TAG, "Evaluating " + path);
87
+
88
+ try (JSRuntime rt = JSRuntime.makeHermesRuntime()) {
89
+ evaluateCommonScriptsFromAsset(rt);
90
+ try {
91
+ evalScriptFromAsset(rt, path);
92
+ ranTests.add(path);
93
+ } catch (com.facebook.jni.CppException ex) {
94
+ failedTests.put(path, ex.getMessage());
95
+ }
96
+ }
97
+ }
98
+
99
+ Log.v(LOG_TAG, "Passed Tests: " + TextUtils.join("\n", ranTests));
100
+
101
+ for (Map.Entry<String, String> entry : failedTests.entrySet()) {
102
+ Log.v(LOG_TAG, "Failed Tests: " + entry.getKey() + " : " + entry.getValue());
103
+ }
104
+
105
+ assertThat(failedTests.entrySet().isEmpty()).isEqualTo(true);
106
+ }
107
+
108
+ private Set<String> getSkipList() {
109
+ Set<String> skipList = new HashSet<>();
110
+
111
+ // Intl.getCanonicalLocales
112
+ skipList.addAll(
113
+ Arrays.asList(
114
+ "test262/test/intl402/Intl/getCanonicalLocales/Locale-object.js",
115
+ // ICU4J adds an extra 'yes' token to the unicode 'ca' extension.
116
+ "test262/test/intl402/Intl/getCanonicalLocales/canonicalized-tags.js",
117
+ // ICU4J don't do complex region replacement.
118
+ "test262/test/intl402/Intl/getCanonicalLocales/complex-region-subtag-replacement.js",
119
+ // ICU4J adds an extra 'yes' token to the unicode 'kf' extension
120
+ "test262/test/intl402/Intl/getCanonicalLocales/non-iana-canon.js",
121
+ // ICU4J doesn't do variant replacement.
122
+ "test262/test/intl402/Intl/getCanonicalLocales/preferred-variant.js",
123
+ // ICU4J doesn't canonicalize extensions.
124
+ "test262/test/intl402/Intl/getCanonicalLocales/transformed-ext-canonical.js",
125
+ "test262/test/intl402/Intl/getCanonicalLocales/transformed-ext-invalid.js",
126
+ "test262/test/intl402/Intl/getCanonicalLocales/unicode-ext-canonicalize-region.js",
127
+ "test262/test/intl402/Intl/getCanonicalLocales/unicode-ext-canonicalize-subdivision.js",
128
+ "test262/test/intl402/Intl/getCanonicalLocales/unicode-ext-canonicalize-yes-to-true.js",
129
+ "test262/test/intl402/Intl/getCanonicalLocales/unicode-ext-key-with-digit.js",
130
+ // ICU4J doesn't perform all grandfathered tag replacements.
131
+ "test262/test/intl402/Intl/getCanonicalLocales/grandfathered.js",
132
+ // ICU4J doesn't perform all grandfathered tag replacements.
133
+ // Note:: CLDR has a list of grandfathered/language/script/region/variant
134
+ // replacements that must happen along with the canonicalization.
135
+ // (https://github.com/unicode-org/cldr/blob/master/common/supplemental/supplementalMetadata.xml)
136
+ // But, typically, the implementation can't/shouldn't lookup cldr while
137
+ // canonicaliation as it can be costly.
138
+ // ICU typically hardcodes a small subset of translations in code .. for inst:
139
+ // https://github.com/unicode-org/icu/blob/12dc3772b1858c73bedd5cffdee0a5a41ce7c61a/ICU4J/main/classes/core/src/com/ibm/icu/impl/locale/LanguageTag.java#L43
140
+ // Which implies ICU APIs doesn't perform all translations based on spec.
141
+ // Note that our canonicalization implementaton for pre-24 platform attemps to do
142
+ // most of the translations, based on tables generated from CLDR.
143
+ // Another thing to note is that different version of android platform ships with
144
+ // different versions of ICU4J and CLDR. (
145
+ // https://developer.android.com/guide/topics/resources/internationalization )
146
+ // Which means, same locale id can potentially be localized to different canonical
147
+ // locale ids.
148
+ "test262/test/intl402/Intl/getCanonicalLocales/preferred-grandfathered.js",
149
+ // ICU4J canonicalization doesn't reject all the locales that are invalid based on spec.
150
+ "test262/test/intl402/Intl/getCanonicalLocales/invalid-tags.js",
151
+ // ICU4J canonicalization doesn't perform complex subtag replacements.
152
+ "test262/test/intl402/Intl/getCanonicalLocales/complex-language-subtag-replacement.js",
153
+ // We currently don't call the "has" trap in proxy.
154
+ "test262/test/intl402/Intl/getCanonicalLocales/has-property.js"));
155
+
156
+ // Intl.Collator
157
+ skipList.addAll(
158
+ Arrays.asList(
159
+ "test262/test/intl402/Collator/constructor-options-throwing-getters.js",
160
+ "test262/test/intl402/Collator/subclassing.js",
161
+ "test262/test/intl402/Collator/proto-from-ctor-realm.js",
162
+ "test262/test/intl402/Collator/prototype/compare/ignorePunctuation.js",
163
+ "test262/test/intl402/Collator/prototype/resolvedOptions/order.js"));
164
+
165
+ // Intl.DateTimeFormat
166
+ skipList.addAll(
167
+ Arrays.asList(
168
+ "test262/test/intl402/DateTimeFormat/taint-Object-prototype-date-time-components.js",
169
+ "test262/test/intl402/DateTimeFormat/constructor-options-order.js",
170
+ "test262/test/intl402/DateTimeFormat/constructor-options-order-timedate-style.js",
171
+ "test262/test/intl402/DateTimeFormat/timezone-canonicalized.js",
172
+ "test262/test/intl402/DateTimeFormat/timezone-utc.js",
173
+ // We dont' support dayPeriod, and fractionalSecondDigits.
174
+ "test262/test/intl402/DateTimeFormat/constructor-options-throwing-getters-dayPeriod.js",
175
+ "test262/test/intl402/DateTimeFormat/constructor-options-fractionalSecondDigits-valid.js",
176
+ "test262/test/intl402/DateTimeFormat/constructor-options-fractionalSecondDigits-invalid.js",
177
+ "test262/test/intl402/DateTimeFormat/constructor-options-dayPeriod-valid.js",
178
+ "test262/test/intl402/DateTimeFormat/constructor-options-order-fractionalSecondDigits.js",
179
+ "test262/test/intl402/DateTimeFormat/constructor-options-throwing-getters-fractionalSecondDigits.js",
180
+ "test262/test/intl402/DateTimeFormat/constructor-options-dayPeriod-invalid.js",
181
+ "test262/test/intl402/DateTimeFormat/constructor-options-order-dayPeriod.js",
182
+ "test262/test/intl402/DateTimeFormat/constructor-options-timeZoneName-valid.js",
183
+ "test262/test/intl402/DateTimeFormat/prototype/format/dayPeriod-narrow-en.js",
184
+ "test262/test/intl402/DateTimeFormat/prototype/format/dayPeriod-short-en.js",
185
+ "test262/test/intl402/DateTimeFormat/prototype/format/dayPeriod-long-en.js",
186
+ "test262/test/intl402/DateTimeFormat/prototype/format/fractionalSecondDigits.js",
187
+ "test262/test/intl402/DateTimeFormat/prototype/formatToParts/fractionalSecondDigits.js",
188
+ "test262/test/intl402/DateTimeFormat/prototype/formatToParts/dayPeriod-narrow-en.js",
189
+ "test262/test/intl402/DateTimeFormat/prototype/formatToParts/dayPeriod-long-en.js",
190
+ "test262/test/intl402/DateTimeFormat/prototype/formatToParts/dayPeriod-short-en.js",
191
+ "test262/test/intl402/DateTimeFormat/prototype/formatToParts/temporal-objects-resolved-time-zone.js",
192
+ "test262/test/intl402/DateTimeFormat/prototype/format/temporal-objects-resolved-time-zone.js",
193
+ "test262/test/intl402/DateTimeFormat/subclassing.js",
194
+ "test262/test/intl402/DateTimeFormat/proto-from-ctor-realm.js",
195
+ // TODO: Investigate why this fails.
196
+ "test262/test/intl402/DateTimeFormat/prototype/format/proleptic-gregorian-calendar.js",
197
+ "test262/test/intl402/DateTimeFormat/prototype/resolvedOptions/order.js",
198
+ "test262/test/intl402/DateTimeFormat/prototype/resolvedOptions/order-style.js",
199
+ "test262/test/intl402/DateTimeFormat/prototype/resolvedOptions/order-fractionalSecondDigits.js",
200
+ "test262/test/intl402/DateTimeFormat/prototype/resolvedOptions/hourCycle-dateStyle.js",
201
+ "test262/test/intl402/DateTimeFormat/prototype/resolvedOptions/hourCycle-timeStyle.js",
202
+ "test262/test/intl402/DateTimeFormat/prototype/resolvedOptions/order-dayPeriod.js",
203
+ "test262/test/intl402/DateTimeFormat/prototype/formatRange",
204
+ "test262/test/intl402/DateTimeFormat/prototype/formatRangeToParts",
205
+ "test262/test/intl402/DateTimeFormat/prototype/format/offset-timezone-gmt-same.js",
206
+ "test262/test/intl402/DateTimeFormat/prototype/format/temporal-zoneddatetime-not-supported.js",
207
+ "test262/test/intl402/DateTimeFormat/prototype/formatToParts/offset-timezone-correct.js",
208
+ "test262/test/intl402/DateTimeFormat/prototype/formatToParts/temporal-zoneddatetime-not-supported.js",
209
+ "test262/test/intl402/DateTimeFormat/prototype/resolvedOptions/hourCycle-default.js",
210
+ "test262/test/intl402/DateTimeFormat/prototype/resolvedOptions/offset-timezone-basic.js",
211
+ "test262/test/intl402/DateTimeFormat/prototype/resolvedOptions/offset-timezone-change.js",
212
+ "test262/test/intl402/DateTimeFormat/timezone-case-insensitive.js",
213
+ "test262/test/intl402/Intl/DateTimeFormat/prototype/formatRange/fails-on-distinct-temporal-types.js",
214
+ "test262/test/intl402/Intl/DateTimeFormat/prototype/formatRangeToParts/fails-on-distinct-temporal-types.js"));
215
+
216
+ // Intl.NumberFormat
217
+ skipList.addAll(
218
+ Arrays.asList(
219
+ // We currently don't call the "has" trap in proxy.
220
+ "test262/test/intl402/NumberFormat/constructor-locales-hasproperty.js",
221
+ // This test is not correct based on spec. With ths currency in test, the default
222
+ // minfractiondigits is 2, and the maxfractiondigita cannot be set to 1. Both Firefox
223
+ // and Chrome also fail the test.
224
+ "test262/test/intl402/NumberFormat/dft-currency-mnfd-range-check-mxfd.js",
225
+ // When strictly following spec, the currency checks comes before unit check and the
226
+ // test will throw RangeError on currency validation before reaching the cdoe which
227
+ // throws TypeError on seeing undefined unit. But, we have a part of option validation
228
+ // in C++ code which throws all TypeErrors, which results in the TypeError getting
229
+ // thrown.
230
+ "test262/test/intl402/NumberFormat/constructor-order.js",
231
+ // Didn't get correct minimumFractionDigts for currency AFN.
232
+ "test262/test/intl402/NumberFormat/currency-digits.js",
233
+ // We support only units directly known to
234
+ // https://developer.android.com/reference/android/icu/util/MeasureUnit
235
+ "test262/test/intl402/NumberFormat/constructor-unit.js",
236
+ "test262/test/intl402/NumberFormat/constructor-options-roundingMode-invalid.js",
237
+ "test262/test/intl402/NumberFormat/constructor-options-throwing-getters-rounding-mode.js",
238
+ "test262/test/intl402/NumberFormat/proto-from-ctor-realm.js",
239
+ "test262/test/intl402/NumberFormat/subclassing.js",
240
+ "test262/test/intl402/NumberFormat/prototype/resolvedOptions/roundingMode.js",
241
+ "test262/test/intl402/NumberFormat/prototype/resolvedOptions/order.js",
242
+ // Expected SameValue(«US$0.00», «+US$0.00») to be true
243
+ "test262/test/intl402/NumberFormat/prototype/format/signDisplay-currency-zh-TW.js",
244
+ // Expected SameValue(«-0», «0») to be true
245
+ "test262/test/intl402/NumberFormat/prototype/format/signDisplay-rounding.js",
246
+ // Expected SameValue(«0,00 $», «+0,00 $») to be true
247
+ "test262/test/intl402/NumberFormat/prototype/format/signDisplay-currency-de-DE.js",
248
+ // 0 (always) Expected SameValue(«0», «+0») to be true
249
+ "test262/test/intl402/NumberFormat/prototype/format/signDisplay-de-DE.js",
250
+ // 0 (always) Expected SameValue(«0», «+0») to be true
251
+ "test262/test/intl402/NumberFormat/prototype/format/signDisplay-ko-KR.js",
252
+ // Expected SameValue(«$0.00», «+$0.00») to be true
253
+ "test262/test/intl402/NumberFormat/prototype/format/signDisplay-currency-en-US.js",
254
+ // Expected SameValue(«$0.00», «+$0.00») to be true
255
+ "test262/test/intl402/NumberFormat/prototype/format/signDisplay-currency-ja-JP.js",
256
+ // -0.0001 (exceptZero) Expected SameValue(«-0», «0») to be true
257
+ "test262/test/intl402/NumberFormat/prototype/format/signDisplay-zh-TW.js",
258
+ // 0 (always) Expected SameValue(«0», «+0») to be true
259
+ "test262/test/intl402/NumberFormat/prototype/format/signDisplay-en-US.js",
260
+ // Expected SameValue(«US$0.00», «+US$0.00») to be true
261
+ "test262/test/intl402/NumberFormat/prototype/format/signDisplay-currency-ko-KR.js",
262
+ // 0 (always) Expected SameValue(«0», «+0») to be true
263
+ "test262/test/intl402/NumberFormat/prototype/format/signDisplay-ja-JP.js",
264
+ // Expected SameValue(«US$0.00», «+US$0.00») to be true
265
+ "test262/test/intl402/NumberFormat/prototype/format/signDisplay-currency-zh-TW.js",
266
+ // Expected SameValue(«-0», «0») to be true
267
+ "test262/test/intl402/NumberFormat/prototype/format/signDisplay-rounding.js",
268
+ // Expected SameValue(«0,00 $», «+0,00 $») to be true
269
+ "test262/test/intl402/NumberFormat/prototype/format/signDisplay-currency-de-DE.js",
270
+ // 0 (always) Expected SameValue(«0», «+0») to be true
271
+ "test262/test/intl402/NumberFormat/prototype/format/signDisplay-de-DE.js",
272
+ // 0 (always) Expected SameValue(«0», «+0») to be true
273
+ "test262/test/intl402/NumberFormat/prototype/format/signDisplay-ko-KR.js",
274
+ // Expected SameValue(«$0.00», «+$0.00») to be true
275
+ "test262/test/intl402/NumberFormat/prototype/format/signDisplay-currency-en-US.js",
276
+ // Expected SameValue(«$0.00», «+$0.00») to be true
277
+ "test262/test/intl402/NumberFormat/prototype/format/signDisplay-currency-ja-JP.js",
278
+ // Expected SameValue(«-0», «0») to be true
279
+ "test262/test/intl402/NumberFormat/prototype/format/signDisplay-zh-TW.js",
280
+ "test262/test/intl402/NumberFormat/prototype/format/signDisplay-en-US.js",
281
+ // Expected SameValue(«US$0.00», «+US$0.00») to be true
282
+ "test262/test/intl402/NumberFormat/prototype/format/signDisplay-currency-ko-KR.js",
283
+ "test262/test/intl402/NumberFormat/prototype/format/signDisplay-ja-JP.js",
284
+ "test262/test/intl402/NumberFormat/prototype/format/units.js",
285
+ "test262/test/intl402/NumberFormat/prototype/format/format-rounding-mode-trunc.js",
286
+ "test262/test/intl402/NumberFormat/prototype/format/format-rounding-mode-ceil.js",
287
+ "test262/test/intl402/NumberFormat/prototype/format/format-rounding-mode-floor.js",
288
+ "test262/test/intl402/NumberFormat/prototype/format/format-rounding-mode-half-floor.js",
289
+ "test262/test/intl402/NumberFormat/prototype/format/format-rounding-mode-half-even.js",
290
+ "test262/test/intl402/NumberFormat/prototype/format/format-rounding-mode-half-trunc.js",
291
+ "test262/test/intl402/NumberFormat/prototype/format/format-rounding-mode-half-ceil.js",
292
+ "test262/test/intl402/NumberFormat/prototype/format/format-rounding-mode-expand.js",
293
+ "test262/test/intl402/NumberFormat/prototype/format/format-rounding-mode-half-expand.js",
294
+ "test262/test/intl402/NumberFormat/prototype/format/engineering-scientific-zh-TW.js",
295
+ "test262/test/intl402/NumberFormat/prototype/format/unit-zh-TW.js",
296
+ "test262/test/intl402/NumberFormat/prototype/format/notation-compact-zh-TW.js",
297
+ "test262/test/intl402/NumberFormat/prototype/formatToParts/signDisplay-zh-TW.js",
298
+ "test262/test/intl402/NumberFormat/prototype/formatToParts/signDisplay-currency-de-DE.js",
299
+ "test262/test/intl402/NumberFormat/prototype/formatToParts/signDisplay-de-DE.js",
300
+ "test262/test/intl402/NumberFormat/prototype/formatToParts/signDisplay-currency-ko-KR.js",
301
+ "test262/test/intl402/NumberFormat/prototype/formatToParts/signDisplay-ko-KR.js",
302
+ "test262/test/intl402/NumberFormat/prototype/formatToParts/signDisplay-currency-en-US.js",
303
+ "test262/test/intl402/NumberFormat/prototype/formatToParts/signDisplay-currency-ja-JP.js",
304
+ "test262/test/intl402/NumberFormat/prototype/formatToParts/signDisplay-ja-JP.js",
305
+ "test262/test/intl402/NumberFormat/prototype/formatToParts/signDisplay-currency-zh-TW.js",
306
+ "test262/test/intl402/NumberFormat/prototype/formatToParts/signDisplay-en-US.js",
307
+ "test262/test/intl402/NumberFormat/prototype/formatToParts/unit.js",
308
+ "test262/test/intl402/NumberFormat/prototype/formatToParts/unit-ja-JP.js",
309
+ "test262/test/intl402/NumberFormat/prototype/formatToParts/unit-ko-KR.js",
310
+ "test262/test/intl402/NumberFormat/prototype/formatToParts/unit-de-DE.js",
311
+ "test262/test/intl402/NumberFormat/prototype/formatToParts/unit-en-US.js",
312
+ "test262/test/intl402/NumberFormat/prototype/formatToParts/unit-zh-TW.js",
313
+ "test262/test/intl402/NumberFormat/prototype/formatToParts/percent-en-US.js",
314
+ "test262/test/intl402/NumberFormat/prototype/formatToParts/engineering-scientific-zh-TW.js",
315
+ "test262/test/intl402/NumberFormat/prototype/formatToParts/notation-compact-zh-TW.js",
316
+ "test262/test/intl402/NumberFormat/constructor-option-read-order.js",
317
+ "test262/test/intl402/NumberFormat/constructor-options-throwing-getters-rounding-increment.js",
318
+ "test262/test/intl402/NumberFormat/constructor-options-throwing-getters-rounding-priority.js",
319
+ "test262/test/intl402/NumberFormat/constructor-options-throwing-getters-trailing-zero-display.js",
320
+ "test262/test/intl402/NumberFormat/constructor-roundingIncrement-invalid.js",
321
+ "test262/test/intl402/NumberFormat/constructor-roundingIncrement.js",
322
+ "test262/test/intl402/NumberFormat/constructor-signDisplay-negative.js",
323
+ "test262/test/intl402/NumberFormat/constructor-trailingZeroDisplay-invalid.js",
324
+ "test262/test/intl402/NumberFormat/constructor-trailingZeroDisplay.js",
325
+ "test262/test/intl402/NumberFormat/prototype/format/format-rounding-increment-10.js",
326
+ "test262/test/intl402/NumberFormat/prototype/format/format-rounding-increment-100.js",
327
+ "test262/test/intl402/NumberFormat/prototype/format/format-rounding-increment-1000.js",
328
+ "test262/test/intl402/NumberFormat/prototype/format/format-rounding-increment-2.js",
329
+ "test262/test/intl402/NumberFormat/prototype/format/format-rounding-increment-20.js",
330
+ "test262/test/intl402/NumberFormat/prototype/format/format-rounding-increment-200.js",
331
+ "test262/test/intl402/NumberFormat/prototype/format/format-rounding-increment-2000.js",
332
+ "test262/test/intl402/NumberFormat/prototype/format/format-rounding-increment-25.js",
333
+ "test262/test/intl402/NumberFormat/prototype/format/format-rounding-increment-250.js",
334
+ "test262/test/intl402/NumberFormat/prototype/format/format-rounding-increment-2500.js",
335
+ "test262/test/intl402/NumberFormat/prototype/format/format-rounding-increment-5.js",
336
+ "test262/test/intl402/NumberFormat/prototype/format/format-rounding-increment-50.js",
337
+ "test262/test/intl402/NumberFormat/prototype/format/format-rounding-increment-500.js",
338
+ "test262/test/intl402/NumberFormat/prototype/format/format-rounding-increment-5000.js",
339
+ "test262/test/intl402/NumberFormat/prototype/format/format-rounding-priority-less-precision.js",
340
+ "test262/test/intl402/NumberFormat/prototype/format/format-rounding-priority-more-precision.js",
341
+ "test262/test/intl402/NumberFormat/prototype/format/signDisplay-negative-currency-de-DE.js",
342
+ "test262/test/intl402/NumberFormat/prototype/format/signDisplay-negative-currency-en-US.js",
343
+ "test262/test/intl402/NumberFormat/prototype/format/signDisplay-negative-currency-ja-JP.js",
344
+ "test262/test/intl402/NumberFormat/prototype/format/signDisplay-negative-currency-ko-KR.js",
345
+ "test262/test/intl402/NumberFormat/prototype/format/signDisplay-negative-currency-zh-TW.js",
346
+ "test262/test/intl402/NumberFormat/prototype/format/signDisplay-negative-de-DE.js",
347
+ "test262/test/intl402/NumberFormat/prototype/format/signDisplay-negative-en-US.js",
348
+ "test262/test/intl402/NumberFormat/prototype/format/signDisplay-negative-ja-JP.js",
349
+ "test262/test/intl402/NumberFormat/prototype/format/signDisplay-negative-ko-KR.js",
350
+ "test262/test/intl402/NumberFormat/prototype/format/signDisplay-negative-zh-TW.js",
351
+ "test262/test/intl402/NumberFormat/prototype/format/useGrouping-extended-de-DE.js",
352
+ "test262/test/intl402/NumberFormat/prototype/format/useGrouping-extended-en-IN.js",
353
+ "test262/test/intl402/NumberFormat/prototype/format/useGrouping-extended-en-US.js",
354
+ "test262/test/intl402/NumberFormat/prototype/format/value-decimal-string.js",
355
+ "test262/test/intl402/NumberFormat/prototype/formatRange/builtin.js",
356
+ "test262/test/intl402/NumberFormat/prototype/formatRange/en-US.js",
357
+ "test262/test/intl402/NumberFormat/prototype/formatRange/invoked-as-func.js",
358
+ "test262/test/intl402/NumberFormat/prototype/formatRange/length.js",
359
+ "test262/test/intl402/NumberFormat/prototype/formatRange/name.js",
360
+ "test262/test/intl402/NumberFormat/prototype/formatRange/nan-arguments-throws.js",
361
+ "test262/test/intl402/NumberFormat/prototype/formatRange/prop-desc.js",
362
+ "test262/test/intl402/NumberFormat/prototype/formatRange/pt-PT.js",
363
+ "test262/test/intl402/NumberFormat/prototype/formatRange/x-greater-than-y-not-throws.js",
364
+ "test262/test/intl402/NumberFormat/prototype/formatRangeToParts/builtin.js",
365
+ "test262/test/intl402/NumberFormat/prototype/formatRangeToParts/en-US.js",
366
+ "test262/test/intl402/NumberFormat/prototype/formatRangeToParts/invoked-as-func.js",
367
+ "test262/test/intl402/NumberFormat/prototype/formatRangeToParts/length.js",
368
+ "test262/test/intl402/NumberFormat/prototype/formatRangeToParts/name.js",
369
+ "test262/test/intl402/NumberFormat/prototype/formatRangeToParts/nan-arguments-throws.js",
370
+ "test262/test/intl402/NumberFormat/prototype/formatRangeToParts/prop-desc.js",
371
+ "test262/test/intl402/NumberFormat/prototype/formatRangeToParts/x-greater-than-y-not-throws.js",
372
+ "test262/test/intl402/NumberFormat/prototype/formatToParts/signDisplay-negative-currency-de-DE.js",
373
+ "test262/test/intl402/NumberFormat/prototype/formatToParts/signDisplay-negative-currency-en-US.js",
374
+ "test262/test/intl402/NumberFormat/prototype/formatToParts/signDisplay-negative-currency-ja-JP.js",
375
+ "test262/test/intl402/NumberFormat/prototype/formatToParts/signDisplay-negative-currency-ko-KR.js",
376
+ "test262/test/intl402/NumberFormat/prototype/formatToParts/signDisplay-negative-currency-zh-TW.js",
377
+ "test262/test/intl402/NumberFormat/prototype/formatToParts/signDisplay-negative-de-DE.js",
378
+ "test262/test/intl402/NumberFormat/prototype/formatToParts/signDisplay-negative-en-US.js",
379
+ "test262/test/intl402/NumberFormat/prototype/formatToParts/signDisplay-negative-ja-JP.js",
380
+ "test262/test/intl402/NumberFormat/prototype/formatToParts/signDisplay-negative-ko-KR.js",
381
+ "test262/test/intl402/NumberFormat/prototype/formatToParts/signDisplay-negative-zh-TW.js",
382
+ "test262/test/intl402/NumberFormat/prototype/resolvedOptions/basic.js",
383
+ "test262/test/intl402/NumberFormat/prototype/resolvedOptions/return-keys-order-default.js",
384
+ "test262/test/intl402/NumberFormat/test-option-roundingPriority-mixed-options.js",
385
+ "test262/test/intl402/NumberFormat/test-option-roundingPriority.js",
386
+ "test262/test/intl402/NumberFormat/test-option-useGrouping-extended.js",
387
+ "test262/test/intl402/NumberFormat/test-option-useGrouping.js",
388
+ "test262/test/intl402/NumberFormat/throws-for-maximumFractionDigits-over-limit.js",
389
+ "test262/test/intl402/NumberFormat/throws-for-minimumFractionDigits-over-limit.js"));
390
+
391
+ // Misc
392
+ skipList.addAll(
393
+ Arrays.asList( // We don't throw TypeError from java code yet.
394
+ "test262/test/intl402/Array/prototype/toLocaleString/throws-same-exceptions-as-NumberFormat.js",
395
+ "test262/test/intl402/Number/prototype/toLocaleString/throws-same-exceptions-as-NumberFormat.js",
396
+ "test262/test/built-ins/Array/prototype/toLocaleString/primitive_this_value_getter.js",
397
+ "test262/test/built-ins/Array/prototype/toLocaleString/primitive_this_value.js",
398
+ "test262/test/intl402/Intl/supportedValuesOf"));
399
+
400
+ if (android.os.Build.VERSION.SDK_INT < 24) {
401
+ skipList.addAll(
402
+ Arrays.asList(
403
+ "test262/test/intl402/Intl/getCanonicalLocales/unicode-ext-canonicalize-calendar.js",
404
+ "test262/test/intl402/Intl/getCanonicalLocales/unicode-ext-canonicalize-col-strength.js",
405
+ "test262/test/intl402/NumberFormat/prototype/format/unit-ko-KR.js",
406
+ "test262/test/intl402/NumberFormat/prototype/format/unit-de-DE.js",
407
+ "test262/test/intl402/NumberFormat/prototype/format/format-fraction-digits-precision.js",
408
+ "test262/test/intl402/NumberFormat/prototype/format/percent-formatter.js",
409
+ "test262/test/intl402/NumberFormat/prototype/format/format-fraction-digits.js",
410
+ "test262/test/intl402/NumberFormat/prototype/format/unit-ja-JP.js",
411
+ "test262/test/intl402/NumberFormat/prototype/formatToParts/default-parameter.js",
412
+ "test262/test/intl402/Intl/getCanonicalLocales/unicode-ext-canonicalize-calendar.js",
413
+ "test262/test/intl402/Intl/getCanonicalLocales/unicode-ext-canonicalize-col-strength.js",
414
+ "test262/test/intl402/DateTimeFormat/constructor-options-toobject.js",
415
+ "test262/test/intl402/DateTimeFormat/ignore-invalid-unicode-ext-values.js",
416
+ "test262/test/intl402/DateTimeFormat/prototype/format/related-year-zh.js",
417
+ "test262/test/intl402/DateTimeFormat/prototype/formatToParts/pattern-on-calendar.js",
418
+ "test262/test/intl402/DateTimeFormat/prototype/formatToParts/related-year.js",
419
+ "test262/test/intl402/DateTimeFormat/prototype/formatToParts/related-year-zh.js",
420
+ "test262/test/intl402/DateTimeFormat/prototype/resolvedOptions/basic.js"));
421
+ }
422
+
423
+ // ICU:56 CLDR:28 UniCode: 8.0
424
+ if (android.os.Build.VERSION.SDK_INT < 26) {
425
+ skipList.addAll(Arrays.asList("unicode-ext-canonicalize-measurement-system.js"));
426
+ }
427
+
428
+ // Requires Android 9 (API level 28) ICU: 60.2 CLDR: 32.0.1 UniCode: 10.0
429
+ // (https://developer.android.com/guide/topics/resources/internationalization)
430
+ if (android.os.Build.VERSION.SDK_INT < 28) {
431
+ skipList.addAll(
432
+ Arrays.asList(
433
+ "test262/test/intl402/Intl/getCanonicalLocales/unicode-ext-canonicalize-timezone.js",
434
+ "test262/test/intl402/NumberFormat/prototype/format/notation-compact-ko-KR.js",
435
+ "test262/test/intl402/NumberFormat/prototype/format/notation-compact-en-US.js",
436
+ "test262/test/intl402/NumberFormat/prototype/format/notation-compact-ja-JP.js"));
437
+ }
438
+
439
+ // Requires Android 10 (API level 29) ICU: 63.2 CLDR: 34 UniCode: 11.0
440
+ // (https://developer.android.com/guide/topics/resources/internationalization)
441
+ if (android.os.Build.VERSION.SDK_INT < 29) {
442
+ skipList.addAll(
443
+ Arrays.asList(
444
+ "test262/test/intl402/NumberFormat/constructor-unitDisplay.js",
445
+ "test262/test/intl402/NumberFormat/prototype/format/format-significant-digits.js",
446
+ "test262/test/intl402/NumberFormat/prototype/format/unit-en-US.js",
447
+ "test262/test/intl402/NumberFormat/prototype/format/notation-compact-de-DE.js",
448
+ "test262/test/intl402/NumberFormat/prototype/format/format-significant-digits-precision.js"));
449
+ }
450
+ if (android.os.Build.VERSION.SDK_INT < 30) {
451
+ skipList.addAll(
452
+ Arrays.asList(
453
+ "test262/test/intl402/NumberFormat/prototype/format/engineering-scientific-de-DE.js",
454
+ "test262/test/intl402/NumberFormat/prototype/format/engineering-scientific-ja-JP.js",
455
+ "test262/test/intl402/NumberFormat/prototype/format/numbering-systems.js",
456
+ "test262/test/intl402/NumberFormat/prototype/format/engineering-scientific-ko-KR.js",
457
+ "test262/test/intl402/NumberFormat/prototype/format/engineering-scientific-en-US.js",
458
+ "test262/test/intl402/NumberFormat/prototype/formatToParts/engineering-scientific-ko-KR.js",
459
+ "test262/test/intl402/NumberFormat/prototype/formatToParts/notation-compact-zh-TW.js",
460
+ "test262/test/intl402/NumberFormat/prototype/formatToParts/engineering-scientific-en-US.js",
461
+ "test262/test/intl402/NumberFormat/prototype/formatToParts/notation-compact-de-DE.js",
462
+ "test262/test/intl402/NumberFormat/prototype/formatToParts/engineering-scientific-de-DE.js",
463
+ "test262/test/intl402/NumberFormat/prototype/formatToParts/notation-compact-en-US.js",
464
+ "test262/test/intl402/NumberFormat/prototype/formatToParts/engineering-scientific-ja-JP.js",
465
+ "test262/test/intl402/NumberFormat/prototype/formatToParts/notation-compact-ja-JP.js",
466
+ "test262/test/intl402/NumberFormat/prototype/formatToParts/notation-compact-ko-KR.js"));
467
+ }
468
+ return skipList;
469
+ }
470
+ }
@@ -0,0 +1,73 @@
1
+ /*
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+
8
+ #include "JSRuntime.h"
9
+
10
+ #include <hermes/CompileJS.h>
11
+ #include <hermes/hermes.h>
12
+
13
+ #include <MappedFileBuffer.h>
14
+
15
+ #include <string>
16
+
17
+ namespace facebook {
18
+ namespace jsi {
19
+ namespace jni {
20
+
21
+ jni::local_ref<JSRuntime::jhybridobject> JSRuntime::makeHermesRuntime(
22
+ jni::alias_ref<jclass>,
23
+ bool shouldRecordGCStats) {
24
+ return newObjectCxxArgs(
25
+ hermes::makeHermesRuntime(
26
+ ::hermes::vm::RuntimeConfig::Builder()
27
+ .withIntl(true)
28
+ .withGCConfig(
29
+ ::hermes::vm::GCConfig::Builder()
30
+ .withShouldRecordStats(shouldRecordGCStats)
31
+ .build())
32
+ .build()));
33
+ }
34
+
35
+ jni::local_ref<JSRuntime::jhybridobject>
36
+ JSRuntime::makeHermesRuntimeWithHeapSpec(
37
+ jni::alias_ref<jclass>,
38
+ jlong initHeapSize,
39
+ jlong maxHeapSize,
40
+ bool shouldRecordGCStats) {
41
+ return newObjectCxxArgs(
42
+ hermes::makeHermesRuntime(
43
+ ::hermes::vm::RuntimeConfig::Builder()
44
+ .withGCConfig(
45
+ ::hermes::vm::GCConfig::Builder()
46
+ .withInitHeapSize(initHeapSize)
47
+ .withMaxHeapSize(maxHeapSize)
48
+ .withShouldRecordStats(shouldRecordGCStats)
49
+ .build())
50
+ .build()));
51
+ }
52
+
53
+ jni::local_ref<jbyteArray> JSRuntime::compileJavaScript(
54
+ jni::alias_ref<jclass>,
55
+ jni::alias_ref<jbyteArray> bytes) {
56
+ auto bytesPrimArr = bytes->pin();
57
+ std::string str(
58
+ reinterpret_cast<char *>(bytesPrimArr.get()), bytesPrimArr.size());
59
+ bytesPrimArr.release();
60
+ std::string bytecode;
61
+ ::hermes::compileJS(str, bytecode);
62
+ if (bytecode.empty()) {
63
+ throw std::invalid_argument("Invalid source code given");
64
+ }
65
+ jni::local_ref<jbyteArray> result = jni::make_byte_array(bytecode.size());
66
+ result->setRegion(
67
+ 0, bytecode.size(), reinterpret_cast<const jbyte *>(bytecode.data()));
68
+ return result;
69
+ }
70
+
71
+ } // namespace jni
72
+ } // namespace jsi
73
+ } // namespace facebook
@@ -0,0 +1,90 @@
1
+ /*
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+
8
+ #include "JSRuntime.h"
9
+
10
+ #include <jsi/instrumentation.h>
11
+
12
+ #include "MappedFileBuffer.h"
13
+
14
+ namespace facebook {
15
+ namespace jsi {
16
+ namespace jni {
17
+
18
+ void JSRuntime::registerNatives() {
19
+ javaClassLocal()->registerNatives({
20
+ makeNativeMethod("makeHermesRuntime", JSRuntime::makeHermesRuntime),
21
+ makeNativeMethod(
22
+ "makeHermesRuntimeWithHeapSpec",
23
+ JSRuntime::makeHermesRuntimeWithHeapSpec),
24
+ makeNativeMethod("compileJavaScript", JSRuntime::compileJavaScript),
25
+ makeNativeMethod("evaluateJavaScript", JSRuntime::evaluateJavaScript),
26
+ makeNativeMethod(
27
+ "evaluateJavaScriptFile", JSRuntime::evaluateJavaScriptFile),
28
+ makeNativeMethod(
29
+ "getGlobalNumberProperty", JSRuntime::getGlobalNumberProperty),
30
+ makeNativeMethod(
31
+ "getGlobalStringProperty", JSRuntime::getGlobalStringProperty),
32
+ makeNativeMethod(
33
+ "setGlobalNumberProperty", JSRuntime::setGlobalNumberProperty),
34
+ makeNativeMethod(
35
+ "setGlobalStringProperty", JSRuntime::setGlobalStringProperty),
36
+ makeNativeMethod("callFunction", JSRuntime::callFunction),
37
+ makeNativeMethod("getRecordedGCStats", JSRuntime::getRecordedGCStats),
38
+ });
39
+ }
40
+
41
+ void JSRuntime::evaluateJavaScript(jni::alias_ref<jbyteArray> bytes) {
42
+ auto bytesPrimArr = bytes->pin();
43
+ std::string str(
44
+ reinterpret_cast<char *>(bytesPrimArr.get()), bytesPrimArr.size());
45
+ bytesPrimArr.release();
46
+ runtime_->evaluateJavaScript(std::make_unique<jsi::StringBuffer>(str), "");
47
+ }
48
+
49
+ void JSRuntime::evaluateJavaScriptFile(std::string fileName) {
50
+ runtime_->evaluateJavaScript(
51
+ std::make_unique<MappedFileBuffer>(fileName), fileName);
52
+ }
53
+
54
+ jint JSRuntime::getGlobalNumberProperty(std::string propName) {
55
+ return runtime_->global().getProperty(*runtime_, propName.c_str()).asNumber();
56
+ }
57
+
58
+ std::string JSRuntime::getGlobalStringProperty(std::string propName) {
59
+ return runtime_->global()
60
+ .getProperty(*runtime_, propName.c_str())
61
+ .asString(*runtime_)
62
+ .utf8(*runtime_);
63
+ }
64
+
65
+ void JSRuntime::setGlobalNumberProperty(std::string propName, jint val) {
66
+ return runtime_->global().setProperty(*runtime_, propName.c_str(), val);
67
+ }
68
+
69
+ void JSRuntime::setGlobalStringProperty(std::string propName, std::string val) {
70
+ return runtime_->global().setProperty(
71
+ *runtime_, propName.c_str(), val.c_str());
72
+ }
73
+
74
+ void JSRuntime::callFunction(std::string functionName) {
75
+ jsi::Function function =
76
+ runtime_->global().getPropertyAsFunction(*runtime_, functionName.c_str());
77
+
78
+ function.call(*runtime_);
79
+ }
80
+
81
+ std::string JSRuntime::getRecordedGCStats() {
82
+ return runtime_->instrumentation().getRecordedGCStats();
83
+ }
84
+
85
+ JSRuntime::JSRuntime(std::unique_ptr<jsi::Runtime> runtime)
86
+ : runtime_{std::move(runtime)} {}
87
+
88
+ } // namespace jni
89
+ } // namespace jsi
90
+ } // namespace facebook