| 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 "use strict"; | 5 "use strict"; |
| 6 | 6 |
| 7 // This file relies on the fact that the following declarations have been made | 7 // This file relies on the fact that the following declarations have been made |
| 8 // in runtime.js: | 8 // in runtime.js: |
| 9 // var $Array = global.Array; | 9 // var $Array = global.Array; |
| 10 // var $String = global.String; | 10 // var $String = global.String; |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 if (IS_OBJECT(space)) { | 171 if (IS_OBJECT(space)) { |
| 172 // Unwrap 'space' if it is wrapped | 172 // Unwrap 'space' if it is wrapped |
| 173 if (IS_NUMBER_WRAPPER(space)) { | 173 if (IS_NUMBER_WRAPPER(space)) { |
| 174 space = ToNumber(space); | 174 space = ToNumber(space); |
| 175 } else if (IS_STRING_WRAPPER(space)) { | 175 } else if (IS_STRING_WRAPPER(space)) { |
| 176 space = ToString(space); | 176 space = ToString(space); |
| 177 } | 177 } |
| 178 } | 178 } |
| 179 var gap; | 179 var gap; |
| 180 if (IS_NUMBER(space)) { | 180 if (IS_NUMBER(space)) { |
| 181 space = MathMax(0, MathMin(ToInteger(space), 10)); | 181 space = $max(0, $min(ToInteger(space), 10)); |
| 182 gap = %_SubString(" ", 0, space); | 182 gap = %_SubString(" ", 0, space); |
| 183 } else if (IS_STRING(space)) { | 183 } else if (IS_STRING(space)) { |
| 184 if (space.length > 10) { | 184 if (space.length > 10) { |
| 185 gap = %_SubString(space, 0, 10); | 185 gap = %_SubString(space, 0, 10); |
| 186 } else { | 186 } else { |
| 187 gap = space; | 187 gap = space; |
| 188 } | 188 } |
| 189 } else { | 189 } else { |
| 190 gap = ""; | 190 gap = ""; |
| 191 } | 191 } |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 234 | 234 |
| 235 // ------------------------------------------------------------------- | 235 // ------------------------------------------------------------------- |
| 236 // JSON Builtins | 236 // JSON Builtins |
| 237 | 237 |
| 238 function JSONSerializeAdapter(key, object) { | 238 function JSONSerializeAdapter(key, object) { |
| 239 var holder = {}; | 239 var holder = {}; |
| 240 holder[key] = object; | 240 holder[key] = object; |
| 241 // No need to pass the actual holder since there is no replacer function. | 241 // No need to pass the actual holder since there is no replacer function. |
| 242 return JSONSerialize(key, holder, UNDEFINED, new InternalArray(), "", ""); | 242 return JSONSerialize(key, holder, UNDEFINED, new InternalArray(), "", ""); |
| 243 } | 243 } |
| OLD | NEW |