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

Side by Side Diff: test/mjsunit/property-load-across-eval.js

Issue 1819123002: Remove support for legacy const, part 1 (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebased, deleted one more file 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/parallel-optimize-disabled.js ('k') | test/mjsunit/regress/regress-1178598.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2009 the V8 project authors. All rights reserved. 1 // Copyright 2009 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
11 // with the distribution. 11 // with the distribution.
12 // * Neither the name of Google Inc. nor the names of its 12 // * Neither the name of Google Inc. nor the names of its
13 // contributors may be used to endorse or promote products derived 13 // contributors may be used to endorse or promote products derived
14 // from this software without specific prior written permission. 14 // from this software without specific prior written permission.
15 // 15 //
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 27
28 // Flags: --legacy-const
29
30 // Tests loading of properties across eval calls. 28 // Tests loading of properties across eval calls.
31 29
32 var x = 1; 30 var x = 1;
33 function global_function() { return 'global'; } 31 function global_function() { return 'global'; }
34 const const_uninitialized;
35 const const_initialized = function() { return "const_global"; }
36 32
37 // Test loading across an eval call that does not shadow variables. 33 // Test loading across an eval call that does not shadow variables.
38 function testNoShadowing() { 34 function testNoShadowing() {
39 var y = 2; 35 var y = 2;
40 function local_function() { return 'local'; } 36 function local_function() { return 'local'; }
41 const local_const_uninitialized;
42 const local_const_initialized = function() { return "const_local"; }
43 function f() { 37 function f() {
44 eval('1'); 38 eval('1');
45 assertEquals(1, x); 39 assertEquals(1, x);
46 try { typeof(asdf); } catch(e) { assertUnreachable(); } 40 try { typeof(asdf); } catch(e) { assertUnreachable(); }
47 assertEquals(2, y); 41 assertEquals(2, y);
48 assertEquals('global', global_function()); 42 assertEquals('global', global_function());
49 assertEquals('local', local_function()); 43 assertEquals('local', local_function());
50 var exception = false;
51 try {
52 const_uninitialized();
53 } catch(e) {
54 exception = true;
55 }
56 assertTrue(exception);
57 assertEquals('const_global', const_initialized());
58 exception = false;
59 try {
60 local_const_uninitialized();
61 } catch(e) {
62 exception = true;
63 }
64 assertTrue(exception);
65 assertEquals('const_local', local_const_initialized());
66 function g() { 44 function g() {
67 assertEquals(1, x); 45 assertEquals(1, x);
68 try { typeof(asdf); } catch(e) { assertUnreachable(); } 46 try { typeof(asdf); } catch(e) { assertUnreachable(); }
69 assertEquals(2, y); 47 assertEquals(2, y);
70 assertEquals('global', global_function()); 48 assertEquals('global', global_function());
71 assertEquals('local', local_function()); 49 assertEquals('local', local_function());
72 var exception = false;
73 try {
74 const_uninitialized();
75 } catch(e) {
76 exception = true;
77 }
78 assertTrue(exception);
79 assertEquals('const_global', const_initialized());
80 exception = false;
81 try {
82 local_const_uninitialized();
83 } catch(e) {
84 exception = true;
85 }
86 assertTrue(exception);
87 assertEquals('const_local', local_const_initialized());
88 } 50 }
89 g(); 51 g();
90 } 52 }
91 f(); 53 f();
92 } 54 }
93 55
94 testNoShadowing(); 56 testNoShadowing();
95 57
96 // Test loading across eval calls that do not shadow variables. 58 // Test loading across eval calls that do not shadow variables.
97 function testNoShadowing2() { 59 function testNoShadowing2() {
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 assertEquals(4, y); 96 assertEquals(4, y);
135 assertEquals('new_nonglobal', global_function()); 97 assertEquals('new_nonglobal', global_function());
136 assertEquals('new_local', local_function()); 98 assertEquals('new_local', local_function());
137 } 99 }
138 g(); 100 g();
139 } 101 }
140 f(); 102 f();
141 } 103 }
142 104
143 testShadowing(); 105 testShadowing();
OLDNEW
« no previous file with comments | « test/mjsunit/parallel-optimize-disabled.js ('k') | test/mjsunit/regress/regress-1178598.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698