OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 824 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
835 var name = "prop" + "erty"; // to avoid symbol path. | 835 var name = "prop" + "erty"; // to avoid symbol path. |
836 var o = {}; | 836 var o = {}; |
837 Object.defineProperty(o, "property", { value: 7 }); | 837 Object.defineProperty(o, "property", { value: 7 }); |
838 | 838 |
839 function strict(o, name) { | 839 function strict(o, name) { |
840 "use strict"; | 840 "use strict"; |
841 o[name] = "new value"; | 841 o[name] = "new value"; |
842 } | 842 } |
843 | 843 |
844 for (var i = 0; i < 10; i ++) { | 844 for (var i = 0; i < 10; i ++) { |
| 845 var exception = false; |
845 try { | 846 try { |
846 strict(o, name); | 847 strict(o, name); |
847 assertUnreachable(); | |
848 } catch(e) { | 848 } catch(e) { |
| 849 exception = true; |
849 assertInstanceof(e, TypeError); | 850 assertInstanceof(e, TypeError); |
850 } | 851 } |
| 852 assertTrue(exception); |
851 } | 853 } |
852 })(); | 854 })(); |
853 | 855 |
854 | 856 |
855 // Specialized KeyedStoreIC experiencing miss. | 857 // Specialized KeyedStoreIC experiencing miss. |
856 (function testKeyedStoreICStrict() { | 858 (function testKeyedStoreICStrict() { |
857 var o = [9,8,7,6,5,4,3,2,1]; | 859 var o = [9,8,7,6,5,4,3,2,1]; |
858 | 860 |
859 function test(o, i, v) { | 861 function test(o, i, v) { |
860 "use strict"; | 862 "use strict"; |
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1179 assertEquals(test(i), true); | 1181 assertEquals(test(i), true); |
1180 } | 1182 } |
1181 })(); | 1183 })(); |
1182 | 1184 |
1183 | 1185 |
1184 (function TestStrictModeEval() { | 1186 (function TestStrictModeEval() { |
1185 "use strict"; | 1187 "use strict"; |
1186 eval("var eval_local = 10;"); | 1188 eval("var eval_local = 10;"); |
1187 assertThrows(function() { return eval_local; }, ReferenceError); | 1189 assertThrows(function() { return eval_local; }, ReferenceError); |
1188 })(); | 1190 })(); |
OLD | NEW |