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

Side by Side Diff: src/json.js

Issue 1318043002: Native context: do not put public symbols and flags on the js builtins object. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: fix and rebase Created 5 years, 3 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 unified diff | Download patch
« no previous file with comments | « src/iterator-prototype.js ('k') | src/math.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2009 the V8 project authors. All rights reserved. 1 // Copyright 2009 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 (function(global, utils) { 5 (function(global, utils) {
6 6
7 "use strict"; 7 "use strict";
8 8
9 %CheckIsBootstrapping(); 9 %CheckIsBootstrapping();
10 10
11 // ------------------------------------------------------------------- 11 // -------------------------------------------------------------------
12 // Imports 12 // Imports
13 13
14 var GlobalJSON = global.JSON; 14 var GlobalJSON = global.JSON;
15 var InternalArray = utils.InternalArray; 15 var InternalArray = utils.InternalArray;
16 var MathMax; 16 var MathMax;
17 var MathMin; 17 var MathMin;
18 var ObjectHasOwnProperty; 18 var ObjectHasOwnProperty;
19 var ToNumber; 19 var ToNumber;
20 var ToString; 20 var ToString;
21 var toStringTagSymbol = utils.ImportNow("to_string_tag_symbol");
21 22
22 utils.Import(function(from) { 23 utils.Import(function(from) {
23 MathMax = from.MathMax; 24 MathMax = from.MathMax;
24 MathMin = from.MathMin; 25 MathMin = from.MathMin;
25 ObjectHasOwnProperty = from.ObjectHasOwnProperty; 26 ObjectHasOwnProperty = from.ObjectHasOwnProperty;
26 ToNumber = from.ToNumber; 27 ToNumber = from.ToNumber;
27 ToString = from.ToString; 28 ToString = from.ToString;
28 }); 29 });
29 30
30 // ------------------------------------------------------------------- 31 // -------------------------------------------------------------------
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 gap = space; 228 gap = space;
228 } 229 }
229 } else { 230 } else {
230 gap = ""; 231 gap = "";
231 } 232 }
232 return JSONSerialize('', {'': value}, replacer, new InternalArray(), "", gap); 233 return JSONSerialize('', {'': value}, replacer, new InternalArray(), "", gap);
233 } 234 }
234 235
235 // ------------------------------------------------------------------- 236 // -------------------------------------------------------------------
236 237
237 %AddNamedProperty(GlobalJSON, symbolToStringTag, "JSON", READ_ONLY | DONT_ENUM); 238 %AddNamedProperty(GlobalJSON, toStringTagSymbol, "JSON", READ_ONLY | DONT_ENUM);
238 239
239 // Set up non-enumerable properties of the JSON object. 240 // Set up non-enumerable properties of the JSON object.
240 utils.InstallFunctions(GlobalJSON, DONT_ENUM, [ 241 utils.InstallFunctions(GlobalJSON, DONT_ENUM, [
241 "parse", JSONParse, 242 "parse", JSONParse,
242 "stringify", JSONStringify 243 "stringify", JSONStringify
243 ]); 244 ]);
244 245
245 // ------------------------------------------------------------------- 246 // -------------------------------------------------------------------
246 // JSON Builtins 247 // JSON Builtins
247 248
248 function JsonSerializeAdapter(key, object) { 249 function JsonSerializeAdapter(key, object) {
249 var holder = {}; 250 var holder = {};
250 holder[key] = object; 251 holder[key] = object;
251 // No need to pass the actual holder since there is no replacer function. 252 // No need to pass the actual holder since there is no replacer function.
252 return JSONSerialize(key, holder, UNDEFINED, new InternalArray(), "", ""); 253 return JSONSerialize(key, holder, UNDEFINED, new InternalArray(), "", "");
253 } 254 }
254 255
255 %InstallToContext(["json_serialize_adapter", JsonSerializeAdapter]); 256 %InstallToContext(["json_serialize_adapter", JsonSerializeAdapter]);
256 257
257 }) 258 })
OLDNEW
« no previous file with comments | « src/iterator-prototype.js ('k') | src/math.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698