| OLD | NEW |
| 1 // Copyright 2007-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2007-2008 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 800 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 811 context.Check("'use strict'; let y2 = 5; 0;", | 811 context.Check("'use strict'; let y2 = 5; 0;", |
| 812 EXPECT_RESULT, Number::New(isolate, 0)); | 812 EXPECT_RESULT, Number::New(isolate, 0)); |
| 813 context.Check(script1, | 813 context.Check(script1, |
| 814 EXPECT_RESULT, Number::New(isolate, 4)); | 814 EXPECT_RESULT, Number::New(isolate, 4)); |
| 815 context.Check(script2, | 815 context.Check(script2, |
| 816 EXPECT_RESULT, Number::New(isolate, 5)); | 816 EXPECT_RESULT, Number::New(isolate, 5)); |
| 817 } | 817 } |
| 818 } | 818 } |
| 819 | 819 |
| 820 | 820 |
| 821 TEST(CrossScriptReferencesHarmonyRegress) { |
| 822 i::FLAG_harmony_scoping = true; |
| 823 v8::Isolate* isolate = CcTest::isolate(); |
| 824 HandleScope scope(isolate); |
| 825 SimpleContext context; |
| 826 context.Check( |
| 827 "'use strict';" |
| 828 "function i1() { " |
| 829 " let y = 10; return (typeof x2 === 'undefined' ? 0 : 2) + y" |
| 830 "}" |
| 831 "i1();" |
| 832 "i1();", |
| 833 EXPECT_RESULT, Number::New(isolate, 10)); |
| 834 context.Check( |
| 835 "'use strict';" |
| 836 "let x2 = 2; i1();", |
| 837 EXPECT_RESULT, Number::New(isolate, 12)); |
| 838 } |
| 839 |
| 840 |
| 821 TEST(GlobalLexicalOSR) { | 841 TEST(GlobalLexicalOSR) { |
| 822 i::FLAG_use_strict = true; | 842 i::FLAG_use_strict = true; |
| 823 i::FLAG_harmony_scoping = true; | 843 i::FLAG_harmony_scoping = true; |
| 824 | 844 |
| 825 v8::Isolate* isolate = CcTest::isolate(); | 845 v8::Isolate* isolate = CcTest::isolate(); |
| 826 HandleScope scope(isolate); | 846 HandleScope scope(isolate); |
| 827 SimpleContext context; | 847 SimpleContext context; |
| 828 | 848 |
| 829 context.Check("'use strict';" | 849 context.Check("'use strict';" |
| 830 "let x = 1; x;", | 850 "let x = 1; x;", |
| (...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1156 { | 1176 { |
| 1157 SimpleContext context; | 1177 SimpleContext context; |
| 1158 | 1178 |
| 1159 context.Check("'use strict'; o; const o = 10", EXPECT_EXCEPTION); | 1179 context.Check("'use strict'; o; const o = 10", EXPECT_EXCEPTION); |
| 1160 | 1180 |
| 1161 for (int i = 0; i < 100; i++) { | 1181 for (int i = 0; i < 100; i++) { |
| 1162 context.Check("o.prototype", EXPECT_EXCEPTION); | 1182 context.Check("o.prototype", EXPECT_EXCEPTION); |
| 1163 } | 1183 } |
| 1164 } | 1184 } |
| 1165 } | 1185 } |
| OLD | NEW |