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

Side by Side Diff: src/json.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 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 var $jsonSerializeAdapter; 5 var $jsonSerializeAdapter;
6 6
7 (function(global, shared, exports) { 7 (function(global, utils) {
8 8
9 "use strict"; 9 "use strict";
10 10
11 %CheckIsBootstrapping(); 11 %CheckIsBootstrapping();
12 12
13 // ------------------------------------------------------------------- 13 // -------------------------------------------------------------------
14 // Imports 14 // Imports
15 15
16 var GlobalJSON = global.JSON; 16 var GlobalJSON = global.JSON;
17 var InternalArray = shared.InternalArray; 17 var InternalArray = utils.InternalArray;
18
19 var MathMax;
20 var MathMin;
21
22 utils.Import(function(from) {
23 MathMax = from.MathMax;
24 MathMin = from.MathMin;
25 });
18 26
19 // ------------------------------------------------------------------- 27 // -------------------------------------------------------------------
20 28
21 function Revive(holder, name, reviver) { 29 function Revive(holder, name, reviver) {
22 var val = holder[name]; 30 var val = holder[name];
23 if (IS_OBJECT(val)) { 31 if (IS_OBJECT(val)) {
24 if (IS_ARRAY(val)) { 32 if (IS_ARRAY(val)) {
25 var length = val.length; 33 var length = val.length;
26 for (var i = 0; i < length; i++) { 34 for (var i = 0; i < length; i++) {
27 var newElement = Revive(val, %_NumberToString(i), reviver); 35 var newElement = Revive(val, %_NumberToString(i), reviver);
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 if (IS_OBJECT(space)) { 184 if (IS_OBJECT(space)) {
177 // Unwrap 'space' if it is wrapped 185 // Unwrap 'space' if it is wrapped
178 if (IS_NUMBER_WRAPPER(space)) { 186 if (IS_NUMBER_WRAPPER(space)) {
179 space = $toNumber(space); 187 space = $toNumber(space);
180 } else if (IS_STRING_WRAPPER(space)) { 188 } else if (IS_STRING_WRAPPER(space)) {
181 space = $toString(space); 189 space = $toString(space);
182 } 190 }
183 } 191 }
184 var gap; 192 var gap;
185 if (IS_NUMBER(space)) { 193 if (IS_NUMBER(space)) {
186 space = $max(0, $min($toInteger(space), 10)); 194 space = MathMax(0, MathMin($toInteger(space), 10));
187 gap = %_SubString(" ", 0, space); 195 gap = %_SubString(" ", 0, space);
188 } else if (IS_STRING(space)) { 196 } else if (IS_STRING(space)) {
189 if (space.length > 10) { 197 if (space.length > 10) {
190 gap = %_SubString(space, 0, 10); 198 gap = %_SubString(space, 0, 10);
191 } else { 199 } else {
192 gap = space; 200 gap = space;
193 } 201 }
194 } else { 202 } else {
195 gap = ""; 203 gap = "";
196 } 204 }
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 // JSON Builtins 241 // JSON Builtins
234 242
235 $jsonSerializeAdapter = function(key, object) { 243 $jsonSerializeAdapter = function(key, object) {
236 var holder = {}; 244 var holder = {};
237 holder[key] = object; 245 holder[key] = object;
238 // No need to pass the actual holder since there is no replacer function. 246 // No need to pass the actual holder since there is no replacer function.
239 return JSONSerialize(key, holder, UNDEFINED, new InternalArray(), "", ""); 247 return JSONSerialize(key, holder, UNDEFINED, new InternalArray(), "", "");
240 } 248 }
241 249
242 }) 250 })
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