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

Side by Side Diff: test/mjsunit/track-fields.js

Issue 14843023: Fix bugs in rewriting combined with attributes and accessors (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 7 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/objects.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 keyed_store(o20, "dbl", 100); 254 keyed_store(o20, "dbl", 100);
255 keyed_store(o20, "obj", 100); 255 keyed_store(o20, "obj", 100);
256 256
257 assertEquals(1, smi20); 257 assertEquals(1, smi20);
258 assertEquals(1.5, dbl20); 258 assertEquals(1.5, dbl20);
259 assertEquals(some_object20, obj20); 259 assertEquals(some_object20, obj20);
260 260
261 assertEquals(100, o20.smi); 261 assertEquals(100, o20.smi);
262 assertEquals(100, o20.dbl); 262 assertEquals(100, o20.dbl);
263 assertEquals(100, o20.dbl); 263 assertEquals(100, o20.dbl);
264
265 function attr_mismatch_obj(v, writable) {
266 var o = {};
267 o.some_value = v;
268 Object.defineProperty(o, "second_value", {value:10, writable:writable});
269 return o;
270 }
271
272 function is_writable(o, p) {
273 return Object.getOwnPropertyDescriptor(o,p).writable;
274 }
275
276 var writable = attr_mismatch_obj(10, true);
277 var non_writable1 = attr_mismatch_obj(10.5, false);
278 assertTrue(is_writable(writable,"second_value"));
279 assertFalse(is_writable(non_writable1,"second_value"));
280 writable.some_value = 20.5;
281 assertTrue(is_writable(writable,"second_value"));
282 var non_writable2 = attr_mismatch_obj(10.5, false);
283 assertTrue(%HaveSameMap(non_writable1, non_writable2));
284
285 function test_f(v) {
286 var o = {};
287 o.vbf = v;
288 o.func = test_f;
289 return o;
290 }
291
292 function test_fic(o) {
293 return o.vbf;
294 }
295
296 var ftest1 = test_f(10);
297 var ftest2 = test_f(10);
298 var ftest3 = test_f(10.5);
299 var ftest4 = test_f(10);
300 assertFalse(%HaveSameMap(ftest1, ftest3));
301 assertTrue(%HaveSameMap(ftest3, ftest4));
302 ftest2.func = is_writable;
303 test_fic(ftest1);
304 test_fic(ftest2);
305 test_fic(ftest3);
306 test_fic(ftest4);
307 assertTrue(%HaveSameMap(ftest1, ftest3));
308 assertTrue(%HaveSameMap(ftest3, ftest4));
OLDNEW
« no previous file with comments | « src/objects.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698