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

Unified Diff: src/prologue.js

Issue 1287203006: Native context: Fix issue when running prologue.js before runtime.js (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 | « no previous file | src/runtime/runtime.h » ('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 d41146fb5bdef0d61c515bcab233fcf909aaa0eb..3153db6e157aba04288fabef4ff7f6e2d6cf6b42 100644
--- a/src/prologue.js
+++ b/src/prologue.js
@@ -23,7 +23,7 @@ var exports_to_runtime = UNDEFINED;
function Export(f) {
f.next = exports;
exports = f;
-};
+}
// Export to the native context for calls from the runtime.
@@ -39,7 +39,7 @@ function ExportToRuntime(f) {
function Import(f) {
f.next = imports;
imports = f;
-};
+}
// In normal natives, import from experimental natives.
@@ -47,7 +47,7 @@ function Import(f) {
function ImportFromExperimental(f) {
f.next = imports_from_experimental;
imports_from_experimental = f;
-};
+}
function SetFunctionName(f, name, prefix) {
@@ -76,7 +76,17 @@ function InstallConstants(object, constants) {
function InstallFunctions(object, attributes, functions) {
- %InstallFunctionsFromArray(object, attributes, functions);
+ %CheckIsBootstrapping();
+ %OptimizeObjectForAddingMultipleProperties(object, functions.length >> 1);
+ for (var i = 0; i < functions.length; i += 2) {
+ var key = functions[i];
+ var f = functions[i + 1];
+ SetFunctionName(f, key);
+ %FunctionRemovePrototype(f);
+ %AddNamedProperty(object, key, f, attributes);
+ %SetNativeFlag(f);
+ }
+ %ToFastProperties(object);
}
@@ -192,7 +202,7 @@ function PostNatives(utils) {
utils.PostNatives = UNDEFINED;
utils.ImportFromExperimental = UNDEFINED;
-};
+}
function PostExperimentals(utils) {
@@ -221,7 +231,7 @@ function PostExperimentals(utils) {
utils.PostDebug = UNDEFINED;
utils.Import = UNDEFINED;
utils.Export = UNDEFINED;
-};
+}
function PostDebug(utils) {
@@ -236,24 +246,26 @@ function PostDebug(utils) {
utils.PostExperimentals = UNDEFINED;
utils.Import = UNDEFINED;
utils.Export = UNDEFINED;
-};
+}
// -----------------------------------------------------------------------
-InstallFunctions(utils, NONE, [
- "Import", Import,
- "Export", Export,
- "ExportToRuntime", ExportToRuntime,
- "ImportFromExperimental", ImportFromExperimental,
- "SetFunctionName", SetFunctionName,
- "InstallConstants", InstallConstants,
- "InstallFunctions", InstallFunctions,
- "InstallGetter", InstallGetter,
- "InstallGetterSetter", InstallGetterSetter,
- "SetUpLockedPrototype", SetUpLockedPrototype,
- "PostNatives", PostNatives,
- "PostExperimentals", PostExperimentals,
- "PostDebug", PostDebug,
-]);
+%OptimizeObjectForAddingMultipleProperties(utils, 13);
+
+utils.Import = Import;
+utils.Export = Export;
+utils.ExportToRuntime = ExportToRuntime;
+utils.ImportFromExperimental = ImportFromExperimental;
+utils.SetFunctionName = SetFunctionName;
+utils.InstallConstants = InstallConstants;
+utils.InstallFunctions = InstallFunctions;
+utils.InstallGetter = InstallGetter;
+utils.InstallGetterSetter = InstallGetterSetter;
+utils.SetUpLockedPrototype = SetUpLockedPrototype;
+utils.PostNatives = PostNatives;
+utils.PostExperimentals = PostExperimentals;
+utils.PostDebug = PostDebug;
+
+%ToFastProperties(utils);
})
« no previous file with comments | « no previous file | src/runtime/runtime.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698