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

Side by Side Diff: src/json.js

Issue 990883002: Hide Math function implementations in a closure. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: remove printf and unnecessary test case change. Created 5 years, 9 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/harmony-string.js ('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 "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
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
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 }
OLDNEW
« no previous file with comments | « src/harmony-string.js ('k') | src/macros.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698