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

Side by Side Diff: test/mjsunit/regress-3135.js

Issue 184443002: Evict from optimized code map in sync with removing from optimized functions list. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 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 | Annotate | Revision Log
« no previous file with comments | « src/runtime.cc ('k') | test/mjsunit/regress-330046.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 // Properties are serialized once.
6 assertEquals('{"x":1}', JSON.stringify({ x : 1 }, ["x", 1, "x", 1]));
7 assertEquals('{"1":1}', JSON.stringify({ 1 : 1 }, ["x", 1, "x", 1]));
8 assertEquals('{"1":1}', JSON.stringify({ 1 : 1 }, ["1", 1, "1", 1]));
9 assertEquals('{"1":1}', JSON.stringify({ 1 : 1 }, [1, "1", 1, "1"]));
10
11 // Properties are visited at most once.
12 var fired = 0;
13 var getter_obj = { get x() { fired++; return 2; } };
14 assertEquals('{"x":2}', JSON.stringify(getter_obj, ["x", "y", "x"]));
15 assertEquals(1, fired);
16
17 // Order of the replacer array is followed.
18 assertEquals('{"y":4,"x":3}', JSON.stringify({ x : 3, y : 4}, ["y", "x"]));
19 assertEquals('{"y":4,"1":2,"x":3}',
20 JSON.stringify({ x : 3, y : 4, 1 : 2 }, ["y", 1, "x"]));
21
22 // __proto__ is ignored and doesn't break anything.
23 var a = { x : 8 };
24 a.__proto__ = { x : 7 };
25 assertEquals('{"x":8}', JSON.stringify(a, ["__proto__", "x", "__proto__"]));
26
27 // Arrays are not affected by the replacer array.
28 assertEquals("[9,8,7]", JSON.stringify([9, 8, 7], [1, 1]));
29 var mixed_arr = [11,12,13];
30 mixed_arr.x = 10;
31 assertEquals('[11,12,13]', JSON.stringify(mixed_arr, [1, 0, 1]));
32
33 // Array elements of objects are affected.
34 var mixed_obj = { x : 3 };
35 mixed_obj[0] = 6;
36 mixed_obj[1] = 5;
37 assertEquals('{"1":5,"0":6}', JSON.stringify(mixed_obj, [1, 0, 1]));
38
39 // Nested object.
40 assertEquals('{"z":{"x":3},"x":1}',
41 JSON.stringify({ x: 1, y:2, z: {x:3, b:4}}, ["z","x"]));
42
43 // Objects in the replacer array are ignored.
44 assertEquals('{}',
45 JSON.stringify({ x : 1, "1": 1 }, [{}]));
46 assertEquals('{}',
47 JSON.stringify({ x : 1, "1": 1 }, [true, undefined, null]));
48 assertEquals('{}',
49 JSON.stringify({ x : 1, "1": 1 },
50 [{ toString: function() { return "x";} }]));
51 assertEquals('{}',
52 JSON.stringify({ x : 1, "1": 1 },
53 [{ valueOf: function() { return 1;} }]));
OLDNEW
« no previous file with comments | « src/runtime.cc ('k') | test/mjsunit/regress-330046.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698