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

Unified Diff: src/prologue.js

Issue 1143993003: Use shared container to manage imports/exports. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: fixed test for no-snap Created 5 years, 7 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
new file mode 100644
index 0000000000000000000000000000000000000000..93f562270d5a87992744d0c0b714df6b30cc3ce3
--- /dev/null
+++ b/src/prologue.js
@@ -0,0 +1,57 @@
+// Copyright 2015 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+(function(global, utils) {
+
+"use strict";
+
+%CheckIsBootstrapping();
+
+// -----------------------------------------------------------------------
+// Utils
+
+var imports = UNDEFINED;
+var exports = UNDEFINED;
+
+
+utils.Export = function Export(f) {
+ f.next = exports;
+ exports = f;
+};
+
+
+utils.Import = function Import(f) {
+ f.next = imports;
+ imports = f;
+};
+
+// -----------------------------------------------------------------------
+// To be called by bootstrapper
+
+utils.PostNatives = function() {
+ %CheckIsBootstrapping();
+
+ var container = {};
+ for ( ; !IS_UNDEFINED(exports); exports = exports.next) exports(container);
+ for ( ; !IS_UNDEFINED(imports); imports = imports.next) imports(container);
+
+ var expose_to_experimental = [
+ "MathMax",
+ "MathMin",
+ ];
+ var experimental = {};
+ %OptimizeObjectForAddingMultipleProperties(
+ experimental, expose_to_experimental.length);
+ for (var key of expose_to_experimental) experimental[key] = container[key];
+ %ToFastProperties(experimental);
+ container = UNDEFINED;
+
+ utils.Export = UNDEFINED;
+ utils.PostNatives = UNDEFINED;
+ utils.Import = function ImportFromExperimental(f) {
+ f(experimental);
+ };
+};
+
+})
« 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