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

Unified Diff: src/json.js

Issue 14125004: Move global code for builtins into setup functions. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Even more. Created 7 years, 8 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
Index: src/json.js
diff --git a/src/json.js b/src/json.js
index e94d3c8e3e907f081891f2517b91de7de13b3f89..048153b5d411503f247b6b9927a439c1b273c5f4 100644
--- a/src/json.js
+++ b/src/json.js
@@ -25,8 +25,15 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+// This file relies on the fact that the following declarations have been made
+// in runtime.js:
+// var $Array = global.Array;
+// var $String = global.String;
+
var $JSON = global.JSON;
+// -------------------------------------------------------------------
+
function Revive(holder, name, reviver) {
var val = holder[name];
if (IS_OBJECT(val)) {
@@ -207,20 +214,24 @@ function JSONStringify(value, replacer, space) {
}
+function JSONSerializeAdapter(key, object) {
+ var holder = {};
+ holder[key] = object;
+ // No need to pass the actual holder since there is no replacer function.
+ return JSONSerialize(key, holder, void 0, new InternalArray(), "", "");
+}
+
+
+// -------------------------------------------------------------------
+
function SetUpJSON() {
%CheckIsBootstrapping();
+
+ // Set up non-enumerable properties of the JSON object.
InstallFunctions($JSON, DONT_ENUM, $Array(
"parse", JSONParse,
"stringify", JSONStringify
));
}
-
-function JSONSerializeAdapter(key, object) {
- var holder = {};
- holder[key] = object;
- // No need to pass the actual holder since there is no replacer function.
- return JSONSerialize(key, holder, void 0, new InternalArray(), "", "");
-}
-
SetUpJSON();

Powered by Google App Engine
This is Rietveld 408576698