OLD | NEW |
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 |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 if (IS_OBJECT(space)) { | 210 if (IS_OBJECT(space)) { |
211 // Unwrap 'space' if it is wrapped | 211 // Unwrap 'space' if it is wrapped |
212 if (IS_NUMBER_WRAPPER(space)) { | 212 if (IS_NUMBER_WRAPPER(space)) { |
213 space = ToNumber(space); | 213 space = ToNumber(space); |
214 } else if (IS_STRING_WRAPPER(space)) { | 214 } else if (IS_STRING_WRAPPER(space)) { |
215 space = TO_STRING(space); | 215 space = TO_STRING(space); |
216 } | 216 } |
217 } | 217 } |
218 var gap; | 218 var gap; |
219 if (IS_NUMBER(space)) { | 219 if (IS_NUMBER(space)) { |
220 space = MathMax(0, MathMin($toInteger(space), 10)); | 220 space = MathMax(0, MathMin(TO_INTEGER(space), 10)); |
221 gap = %_SubString(" ", 0, space); | 221 gap = %_SubString(" ", 0, space); |
222 } else if (IS_STRING(space)) { | 222 } else if (IS_STRING(space)) { |
223 if (space.length > 10) { | 223 if (space.length > 10) { |
224 gap = %_SubString(space, 0, 10); | 224 gap = %_SubString(space, 0, 10); |
225 } else { | 225 } else { |
226 gap = space; | 226 gap = space; |
227 } | 227 } |
228 } else { | 228 } else { |
229 gap = ""; | 229 gap = ""; |
230 } | 230 } |
(...skipping 16 matching lines...) Expand all Loading... |
247 function JsonSerializeAdapter(key, object) { | 247 function JsonSerializeAdapter(key, object) { |
248 var holder = {}; | 248 var holder = {}; |
249 holder[key] = object; | 249 holder[key] = object; |
250 // No need to pass the actual holder since there is no replacer function. | 250 // No need to pass the actual holder since there is no replacer function. |
251 return JSONSerialize(key, holder, UNDEFINED, new InternalArray(), "", ""); | 251 return JSONSerialize(key, holder, UNDEFINED, new InternalArray(), "", ""); |
252 } | 252 } |
253 | 253 |
254 %InstallToContext(["json_serialize_adapter", JsonSerializeAdapter]); | 254 %InstallToContext(["json_serialize_adapter", JsonSerializeAdapter]); |
255 | 255 |
256 }) | 256 }) |
OLD | NEW |