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

Side by Side Diff: test/mjsunit/strong/object-set-prototype.js

Issue 1773653002: [strong] Remove all remainders of strong mode (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Oversight Created 4 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
« no previous file with comments | « test/mjsunit/strong/object-freeze-property.js ('k') | test/mjsunit/strong/super.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
7 // TODO(conradw): Track implementation of strong bit for other objects, add
8 // tests.
9
10 function getSloppyObjects() {
11 return [(function(){}), ({})];
12 }
13
14 function getStrictObjects() {
15 "use strict";
16 return [(function(){}), ({})];
17 }
18
19 function getStrongObjects() {
20 "use strong";
21 return [(function(){}), ({})];
22 }
23
24 function declareObjectLiteralWithProtoSloppy() {
25 return {__proto__: {}};
26 }
27
28 function declareObjectLiteralWithProtoStrong() {
29 "use strong";
30 return {__proto__: {}};
31 }
32
33 function testStrongObjectSetProto() {
34 "use strict";
35 let sloppyObjects = getSloppyObjects();
36 let strictObjects = getStrictObjects();
37 let strongObjects = getStrongObjects();
38 let weakObjects = sloppyObjects.concat(strictObjects);
39
40 for (let o of weakObjects) {
41 let setProtoBuiltin = function(o){Object.setPrototypeOf(o, {})};
42 let setProtoProperty = function(o){o.__proto__ = {}};
43 for (let setProtoFunc of [setProtoBuiltin, setProtoProperty]) {
44 assertDoesNotThrow(function(){setProtoFunc(o)});
45 assertDoesNotThrow(function(){setProtoFunc(o)});
46 assertDoesNotThrow(function(){setProtoFunc(o)});
47 %OptimizeFunctionOnNextCall(setProtoFunc);
48 assertDoesNotThrow(function(){setProtoFunc(o)});
49 %DeoptimizeFunction(setProtoFunc);
50 assertDoesNotThrow(function(){setProtoFunc(o)});
51 }
52 }
53 for (let o of strongObjects) {
54 let setProtoBuiltin = function(o){Object.setPrototypeOf(o, {})};
55 let setProtoProperty = function(o){o.__proto__ = {}};
56 for (let setProtoFunc of [setProtoBuiltin, setProtoProperty]) {
57 assertThrows(function(){setProtoFunc(o)}, TypeError);
58 assertThrows(function(){setProtoFunc(o)}, TypeError);
59 assertThrows(function(){setProtoFunc(o)}, TypeError);
60 %OptimizeFunctionOnNextCall(setProtoFunc);
61 assertThrows(function(){setProtoFunc(o)}, TypeError);
62 %DeoptimizeFunction(setProtoFunc);
63 assertThrows(function(){setProtoFunc(o)}, TypeError);
64 }
65 }
66
67 assertDoesNotThrow(declareObjectLiteralWithProtoSloppy);
68 assertDoesNotThrow(declareObjectLiteralWithProtoSloppy);
69 assertDoesNotThrow(declareObjectLiteralWithProtoSloppy);
70 %OptimizeFunctionOnNextCall(declareObjectLiteralWithProtoSloppy);
71 assertDoesNotThrow(declareObjectLiteralWithProtoSloppy);
72 %DeoptimizeFunction(declareObjectLiteralWithProtoSloppy);
73 assertDoesNotThrow(declareObjectLiteralWithProtoSloppy);
74
75 assertDoesNotThrow(declareObjectLiteralWithProtoStrong);
76 assertDoesNotThrow(declareObjectLiteralWithProtoStrong);
77 assertDoesNotThrow(declareObjectLiteralWithProtoStrong);
78 %OptimizeFunctionOnNextCall(declareObjectLiteralWithProtoStrong);
79 assertDoesNotThrow(declareObjectLiteralWithProtoStrong);
80 %DeoptimizeFunction(declareObjectLiteralWithProtoStrong);
81 assertDoesNotThrow(declareObjectLiteralWithProtoStrong);
82 }
83 testStrongObjectSetProto();
OLDNEW
« no previous file with comments | « test/mjsunit/strong/object-freeze-property.js ('k') | test/mjsunit/strong/super.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698