Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1198)

Unified Diff: src/js/prologue.js

Issue 2715223003: Revert "[SAB] Move Atomics builtins to C++" (Closed)
Patch Set: another CL to revert Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/js/harmony-atomics.js ('k') | src/runtime/runtime.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/js/prologue.js
diff --git a/src/js/prologue.js b/src/js/prologue.js
index 59949344656b14a13069ff1f44cb05da9add3eb7..4b40d9a0fd0f289bb58db9e94c56bd75e496df0c 100644
--- a/src/js/prologue.js
+++ b/src/js/prologue.js
@@ -12,18 +12,33 @@
// Utils
var imports = UNDEFINED;
+var imports_from_experimental = UNDEFINED;
var exports_container = %ExportFromRuntime({});
+var typed_array_setup = UNDEFINED;
+
+// Register context value to be initialized with a typed array in
+// Genesis::InitializeBuiltinTypedArrays.
+function SetupTypedArray(f) {
+ f.next = typed_array_setup;
+ typed_array_setup = f;
+}
// Export to other scripts.
+// In normal natives, this exports functions to other normal natives.
+// In experimental natives, this exports to other experimental natives and
+// to normal natives that import using utils.ImportFromExperimental.
function Export(f) {
f(exports_container);
}
-// Import from other scripts. The actual importing happens in PostNatives so
-// that we can import from scripts executed later. However, that means that
-// the import is not available until the very end. If the import needs to be
-// available immediately, use ImportNow.
+// Import from other scripts. The actual importing happens in PostNatives and
+// PostExperimental so that we can import from scripts executed later. However,
+// that means that the import is not available until the very end. If the
+// import needs to be available immediate, use ImportNow.
+// In normal natives, this imports from other normal natives.
+// In experimental natives, this imports from other experimental natives and
+// whitelisted exports from normal natives.
function Import(f) {
f.next = imports;
imports = f;
@@ -38,6 +53,14 @@ function ImportNow(name) {
}
+// In normal natives, import from experimental natives.
+// Not callable from experimental natives.
+function ImportFromExperimental(f) {
+ f.next = imports_from_experimental;
+ imports_from_experimental = f;
+}
+
+
function SetFunctionName(f, name, prefix) {
if (IS_SYMBOL(name)) {
name = "[" + %SymbolDescription(name) + "]";
@@ -142,13 +165,82 @@ function PostNatives(utils) {
imports(exports_container);
}
+ // Whitelist of exports from normal natives to experimental natives and debug.
+ var expose_list = [
+ "FormatDateToParts",
+ "MapEntries",
+ "MapIteratorNext",
+ "MaxSimple",
+ "MinSimple",
+ "SetIteratorNext",
+ "SetValues",
+ "ToLocaleLowerCaseI18N",
+ "ToLocaleUpperCaseI18N",
+ "ToLowerCaseI18N",
+ "ToUpperCaseI18N",
+ // From runtime:
+ "promise_result_symbol",
+ "promise_state_symbol",
+ "reflect_apply",
+ "to_string_tag_symbol",
+ ];
+
+ var filtered_exports = {};
+ %OptimizeObjectForAddingMultipleProperties(
+ filtered_exports, expose_list.length);
+ for (var key of expose_list) {
+ filtered_exports[key] = exports_container[key];
+ }
+ %ToFastProperties(filtered_exports);
+ exports_container = filtered_exports;
+
+ utils.PostNatives = UNDEFINED;
+ utils.ImportFromExperimental = UNDEFINED;
+}
+
+
+function PostExperimentals(utils) {
+ %CheckIsBootstrapping();
+ for ( ; !IS_UNDEFINED(imports); imports = imports.next) {
+ imports(exports_container);
+ }
+ for ( ; !IS_UNDEFINED(imports_from_experimental);
+ imports_from_experimental = imports_from_experimental.next) {
+ imports_from_experimental(exports_container);
+ }
+
+ utils.Export = UNDEFINED;
+ utils.PostDebug = UNDEFINED;
+ utils.PostExperimentals = UNDEFINED;
+ typed_array_setup = UNDEFINED;
+}
+
+
+function PostDebug(utils) {
+ for ( ; !IS_UNDEFINED(imports); imports = imports.next) {
+ imports(exports_container);
+ }
+
exports_container = UNDEFINED;
+
utils.Export = UNDEFINED;
utils.Import = UNDEFINED;
utils.ImportNow = UNDEFINED;
- utils.PostNatives = UNDEFINED;
+ utils.PostDebug = UNDEFINED;
+ utils.PostExperimentals = UNDEFINED;
+ typed_array_setup = UNDEFINED;
+}
+
+
+function InitializeBuiltinTypedArrays(utils, rng_state, rempio2result) {
+ var setup_list = typed_array_setup;
+
+ for ( ; !IS_UNDEFINED(setup_list); setup_list = setup_list.next) {
+ setup_list(rng_state, rempio2result);
+ }
}
+
// -----------------------------------------------------------------------
%OptimizeObjectForAddingMultipleProperties(utils, 14);
@@ -156,6 +248,7 @@ function PostNatives(utils) {
utils.Import = Import;
utils.ImportNow = ImportNow;
utils.Export = Export;
+utils.ImportFromExperimental = ImportFromExperimental;
utils.SetFunctionName = SetFunctionName;
utils.InstallConstants = InstallConstants;
utils.InstallFunctions = InstallFunctions;
@@ -163,6 +256,8 @@ utils.InstallGetter = InstallGetter;
utils.OverrideFunction = OverrideFunction;
utils.SetUpLockedPrototype = SetUpLockedPrototype;
utils.PostNatives = PostNatives;
+utils.PostExperimentals = PostExperimentals;
+utils.PostDebug = PostDebug;
%ToFastProperties(utils);
« no previous file with comments | « src/js/harmony-atomics.js ('k') | src/runtime/runtime.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698