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

Unified Diff: src/prologue.js

Issue 1293493003: Do not export natives to runtime via js builtins object. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 4 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/object-observe.js ('k') | src/promise.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/prologue.js
diff --git a/src/prologue.js b/src/prologue.js
index 28c797617fd7f6b9008455a2fd299ab0ceb0ce94..e58a25ffdf01b2e10a9e7da41843e0812228c631 100644
--- a/src/prologue.js
+++ b/src/prologue.js
@@ -14,7 +14,7 @@
var imports = UNDEFINED;
var exports = UNDEFINED;
var imports_from_experimental = UNDEFINED;
-
+var exports_to_runtime = UNDEFINED;
// Export to other scripts.
// In normal natives, this exports functions to other normal natives.
@@ -26,6 +26,12 @@ function Export(f) {
};
+// Export to the native context for calls from the runtime.
+function ExportToRuntime(f) {
+ f.next = exports_to_runtime;
+ exports_to_runtime = f;
+}
+
// Import from other scripts.
// In normal natives, this imports from other normal natives.
// In experimental natives, this imports from other experimental natives and
@@ -152,6 +158,13 @@ function PostNatives(utils) {
for ( ; !IS_UNDEFINED(exports); exports = exports.next) exports(container);
for ( ; !IS_UNDEFINED(imports); imports = imports.next) imports(container);
+ var runtime_container = {};
+ for ( ; !IS_UNDEFINED(exports_to_runtime);
+ exports_to_runtime = exports_to_runtime.next) {
+ exports_to_runtime(runtime_container);
+ }
+ %ImportToRuntime(runtime_container);
+
// Whitelist of exports from normal natives to experimental natives.
var expose_to_experimental = [
"ArrayToString",
@@ -205,6 +218,12 @@ function PostExperimentals(utils) {
imports_from_experimental = imports_from_experimental.next) {
imports_from_experimental(experimental_exports);
}
+ var runtime_container = {};
+ for ( ; !IS_UNDEFINED(exports_to_runtime);
+ exports_to_runtime = exports_to_runtime.next) {
+ exports_to_runtime(runtime_container);
+ }
+ %ImportExperimentalToRuntime(runtime_container);
experimental_exports = UNDEFINED;
@@ -234,6 +253,7 @@ function PostDebug(utils) {
InstallFunctions(utils, NONE, [
"Import", Import,
"Export", Export,
+ "ExportToRuntime", ExportToRuntime,
"ImportFromExperimental", ImportFromExperimental,
"SetFunctionName", SetFunctionName,
"InstallConstants", InstallConstants,
@@ -246,4 +266,13 @@ InstallFunctions(utils, NONE, [
"PostDebug", PostDebug,
]);
+// TODO(yangguo): run prologue.js before runtime.js
+ExportToRuntime(function(to) {
+ to.ToNumber = $toNumber;
+ to.ToString = $toString;
+ to.ToDetailString = $toDetailString;
+ to.ToInteger = $toInteger;
+ to.ToLength = $toLength;
+});
+
})
« no previous file with comments | « src/object-observe.js ('k') | src/promise.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698