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

Side by Side Diff: test/mjsunit/strong/literals.js

Issue 1143813002: Reland "[strong] Object literals create strong objects" (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix handlification bug Created 5 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
« no previous file with comments | « src/runtime/runtime-literals.cc ('k') | test/mjsunit/strong/objects.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 2015 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 // Flags: --strong-mode --allow-natives-syntax
6 // Flags: --harmony-arrow-functions --harmony-rest-parameters
7
8
9 (function WeakObjectLiterals() {
10 assertTrue(!%IsStrong({}));
11 assertTrue(!%IsStrong({a: 0, b: 0}));
12 assertTrue(!%IsStrong({f: function(){}}));
13 assertTrue(!%IsStrong(Realm.eval(Realm.current(),
14 "({f: function(){}})")));
15 })();
16
17 (function StrongObjectLiterals() {
18 'use strong';
19 assertTrue(%IsStrong({}));
20 assertTrue(%IsStrong({a: 0, b: 0}));
21 assertTrue(%IsStrong({__proto__: {}, get a() {}, set b(x) {}}));
22 assertTrue(%IsStrong({[Date() + ""]: 0, [Symbol()]: 0}));
23 // TODO(rossberg): super does not work yet
24 // assertTrue(%IsStrong({m() { super.m() }}));
25 // Object literals with constant functions are treated specially,
26 // but currently only on the toplevel.
27 assertTrue(%IsStrong({f: function(){}}));
28 // TODO(rossberg): implement strong object literals with functions
29 // assertTrue(%IsStrong(Realm.eval(Realm.current(),
30 // "'use strong'; ({f: function(){}})")));
31 })();
32
33 (function WeakArrayLiterals(...args) {
34 assertTrue(!%IsStrong(args));
35 assertTrue(!%IsStrong([]));
36 assertTrue(!%IsStrong([1, 2, 3]));
37 Array.prototype = {}
38 assertTrue(!%IsStrong([]));
39 assertTrue(!%IsStrong([1, 2, 3]));
40 })();
41
42 (function StrongArrayLiterals(...args) {
43 'use strong';
44 // TODO(rossberg): implement strong array literals
45 // assertTrue(%IsStrong(args));
46 // assertTrue(%IsStrong([]));
47 // assertTrue(%IsStrong([1, 2, 3]));
48 // Array.prototype = {}
49 // assertTrue(%IsStrong([]));
50 // assertTrue(%IsStrong([1, 2, 3]));
51 })(0); // TODO(arv): drop dummy
52
53 (function WeakFunctionLiterals() {
54 function f() {}
55 assertTrue(!%IsStrong(f));
56 assertTrue(!%IsStrong(function(){}));
57 assertTrue(!%IsStrong(() => {}));
58 assertTrue(!%IsStrong(x => x));
59 })();
60
61 (function StrongFunctionLiterals(g) {
62 'use strong';
63 function f() {}
64 assertTrue(%IsStrong(f));
65 assertTrue(%IsStrong(g));
66 assertTrue(%IsStrong(function(){}));
67 assertTrue(%IsStrong(() => {}));
68 assertTrue(%IsStrong(x => x));
69 })(function() { 'use strong' });
70
71 (function WeakRegExpLiterals() {
72 assertTrue(!%IsStrong(/abc/));
73 })();
74
75 (function StrongRegExpLiterals() {
76 'use strong';
77 // TODO(rossberg): implement strong regexp literals
78 // assertTrue(%IsStrong(/abc/));
79 })();
OLDNEW
« no previous file with comments | « src/runtime/runtime-literals.cc ('k') | test/mjsunit/strong/objects.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698