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

Side by Side Diff: test/mjsunit/harmony/proxies-json.js

Issue 11363078: Add fast path for FastProperty objects in JSON.stringify. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: addressed comment. Created 8 years, 1 month 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/json-stringifier.h ('k') | test/mjsunit/json2.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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 }, 147 },
148 getOwnPropertyDescriptor: function(target, name) { 148 getOwnPropertyDescriptor: function(target, name) {
149 return { enumerable: true }; 149 return { enumerable: true };
150 } 150 }
151 } 151 }
152 152
153 var proxy6 = Proxy.create(handler6); 153 var proxy6 = Proxy.create(handler6);
154 testStringify('[1,null,true]', [1, proxy6, true]); 154 testStringify('[1,null,true]', [1, proxy6, true]);
155 testStringify('{"a":1,"c":true}', {a: 1, b: proxy6, c: true}); 155 testStringify('{"a":1,"c":true}', {a: 1, b: proxy6, c: true});
156 156
157 // Object containing a proxy that changes the parent's properties.
158 var handler7 = {
159 get: function(target, name) {
160 delete parent7.a;
161 delete parent7.c;
162 parent7.e = "5";
163 return name.toUpperCase();
164 },
165 enumerate: function(target) {
166 return ['a', 'b', 'c'];
167 },
168 getOwnPropertyDescriptor: function(target, name) {
169 return { enumerable: true };
170 }
171 }
172
173 var proxy7 = Proxy.create(handler7);
174 var parent7 = { a: "1", b: proxy7, c: "3", d: "4" };
175 assertEquals('{"a":"1","b":{"a":"A","b":"B","c":"C"},"d":"4"}',
176 JSON.stringify(parent7));
177 assertEquals('{"b":{"a":"A","b":"B","c":"C"},"d":"4","e":"5"}',
178 JSON.stringify(parent7));
OLDNEW
« no previous file with comments | « src/json-stringifier.h ('k') | test/mjsunit/json2.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698