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

Side by Side Diff: src/json.js

Issue 7356013: Implement Object.prototype.hasOwnProperty in generated code. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years, 5 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
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 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 } 241 }
242 242
243 243
244 function BasicSerializeObject(value, stack, builder) { 244 function BasicSerializeObject(value, stack, builder) {
245 if (!%PushIfAbsent(stack, value)) { 245 if (!%PushIfAbsent(stack, value)) {
246 throw MakeTypeError('circular_structure', $Array()); 246 throw MakeTypeError('circular_structure', $Array());
247 } 247 }
248 builder.push("{"); 248 builder.push("{");
249 var first = true; 249 var first = true;
250 for (var p in value) { 250 for (var p in value) {
251 if (%HasLocalProperty(value, p)) { 251 if (%HasOwnProperty(value, p)) {
252 if (!first) { 252 if (!first) {
253 builder.push(%QuoteJSONStringComma(p)); 253 builder.push(%QuoteJSONStringComma(p));
254 } else { 254 } else {
255 builder.push(%QuoteJSONString(p)); 255 builder.push(%QuoteJSONString(p));
256 } 256 }
257 builder.push(":"); 257 builder.push(":");
258 var before = builder.length; 258 var before = builder.length;
259 BasicJSONSerialize(p, value[p], stack, builder); 259 BasicJSONSerialize(p, value[p], stack, builder);
260 if (before == builder.length) { 260 if (before == builder.length) {
261 builder.pop(); 261 builder.pop();
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
338 } 338 }
339 339
340 function SetupJSON() { 340 function SetupJSON() {
341 InstallFunctions($JSON, DONT_ENUM, $Array( 341 InstallFunctions($JSON, DONT_ENUM, $Array(
342 "parse", JSONParse, 342 "parse", JSONParse,
343 "stringify", JSONStringify 343 "stringify", JSONStringify
344 )); 344 ));
345 } 345 }
346 346
347 SetupJSON(); 347 SetupJSON();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698