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

Side by Side Diff: src/json.js

Issue 27491002: Cosmetic: Add macros for NaN, undefined and Infinity to native js code. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 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 | Annotate | Revision Log
« no previous file with comments | « src/i18n.js ('k') | src/liveedit-debugger.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 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 return JSON_NUMBER_TO_STRING(value); 174 return JSON_NUMBER_TO_STRING(value);
175 } else if (IS_STRING_WRAPPER(value)) { 175 } else if (IS_STRING_WRAPPER(value)) {
176 return %QuoteJSONString(ToString(value)); 176 return %QuoteJSONString(ToString(value));
177 } else if (IS_BOOLEAN_WRAPPER(value)) { 177 } else if (IS_BOOLEAN_WRAPPER(value)) {
178 return %_ValueOf(value) ? "true" : "false"; 178 return %_ValueOf(value) ? "true" : "false";
179 } else { 179 } else {
180 return SerializeObject(value, replacer, stack, indent, gap); 180 return SerializeObject(value, replacer, stack, indent, gap);
181 } 181 }
182 } 182 }
183 // Undefined or a callable object. 183 // Undefined or a callable object.
184 return void 0; 184 return UNDEFINED;
185 } 185 }
186 186
187 187
188 function JSONStringify(value, replacer, space) { 188 function JSONStringify(value, replacer, space) {
189 if (%_ArgumentsLength() == 1) { 189 if (%_ArgumentsLength() == 1) {
190 return %BasicJSONStringify(value); 190 return %BasicJSONStringify(value);
191 } 191 }
192 if (IS_OBJECT(space)) { 192 if (IS_OBJECT(space)) {
193 // Unwrap 'space' if it is wrapped 193 // Unwrap 'space' if it is wrapped
194 if (IS_NUMBER_WRAPPER(space)) { 194 if (IS_NUMBER_WRAPPER(space)) {
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 SetUpJSON(); 229 SetUpJSON();
230 230
231 231
232 // ------------------------------------------------------------------- 232 // -------------------------------------------------------------------
233 // JSON Builtins 233 // JSON Builtins
234 234
235 function JSONSerializeAdapter(key, object) { 235 function JSONSerializeAdapter(key, object) {
236 var holder = {}; 236 var holder = {};
237 holder[key] = object; 237 holder[key] = object;
238 // No need to pass the actual holder since there is no replacer function. 238 // No need to pass the actual holder since there is no replacer function.
239 return JSONSerialize(key, holder, void 0, new InternalArray(), "", ""); 239 return JSONSerialize(key, holder, UNDEFINED, new InternalArray(), "", "");
240 } 240 }
OLDNEW
« no previous file with comments | « src/i18n.js ('k') | src/liveedit-debugger.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698