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 1378533002: [es6] Introduce %ToInteger and %ToLength. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 2 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/hydrogen.cc ('k') | src/macros.py » ('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
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
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 })
OLDNEW
« no previous file with comments | « src/hydrogen.cc ('k') | src/macros.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698