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 791 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
802 const char* script1 = "(function(){ return y1 })()"; | 802 const char* script1 = "(function(){ return y1 })()"; |
803 const char* script2 = "(function(){ return y2 })()"; | 803 const char* script2 = "(function(){ return y2 })()"; |
804 | 804 |
805 context.Check(script1, EXPECT_EXCEPTION); | 805 context.Check(script1, EXPECT_EXCEPTION); |
806 context.Check("this.y1 = 1; this.y2 = 2; 0;", | 806 context.Check("this.y1 = 1; this.y2 = 2; 0;", |
807 EXPECT_RESULT, Number::New(isolate, 0)); | 807 EXPECT_RESULT, Number::New(isolate, 0)); |
808 context.Check(script1, | 808 context.Check(script1, |
809 EXPECT_RESULT, Number::New(isolate, 1)); | 809 EXPECT_RESULT, Number::New(isolate, 1)); |
810 context.Check("'use strict'; let y1 = 3; 0;", | 810 context.Check("'use strict'; let y1 = 3; 0;", |
811 EXPECT_RESULT, Number::New(isolate, 0)); | 811 EXPECT_RESULT, Number::New(isolate, 0)); |
812 // TODO(dslomov): still returns 1 not 3 | 812 context.Check(script1, |
813 // context.Check(script1, | 813 EXPECT_RESULT, Number::New(isolate, 3)); |
814 // EXPECT_RESULT, Number::New(isolate, 3)); | |
815 context.Check("y1 = 4;", | 814 context.Check("y1 = 4;", |
816 EXPECT_RESULT, Number::New(isolate, 4)); | 815 EXPECT_RESULT, Number::New(isolate, 4)); |
817 // TODO(dslomov): still returns 1 not 4 | 816 context.Check(script1, |
818 // context.Check(script1, | 817 EXPECT_RESULT, Number::New(isolate, 4)); |
819 // EXPECT_RESULT, Number::New(isolate, 4)); | |
820 | 818 |
821 context.Check(script2, | 819 context.Check(script2, |
822 EXPECT_RESULT, Number::New(isolate, 2)); | 820 EXPECT_RESULT, Number::New(isolate, 2)); |
823 context.Check("'use strict'; let y2 = 5; 0;", | 821 context.Check("'use strict'; let y2 = 5; 0;", |
824 EXPECT_RESULT, Number::New(isolate, 0)); | 822 EXPECT_RESULT, Number::New(isolate, 0)); |
825 // TODO(dslomov): still returns 1 not 4 | 823 context.Check(script1, |
826 // context.Check(script1, | 824 EXPECT_RESULT, Number::New(isolate, 4)); |
827 // EXPECT_RESULT, Number::New(isolate, 4)); | 825 context.Check(script2, |
828 // TODO(dslomov): still returns 2 not 5 | 826 EXPECT_RESULT, Number::New(isolate, 5)); |
829 // context.Check(script2, | |
830 // EXPECT_RESULT, Number::New(isolate, 5)); | |
831 } | 827 } |
832 } | 828 } |
833 | 829 |
834 | 830 |
835 TEST(GlobalLexicalOSR) { | 831 TEST(GlobalLexicalOSR) { |
836 i::FLAG_use_strict = true; | 832 i::FLAG_use_strict = true; |
837 i::FLAG_harmony_scoping = true; | 833 i::FLAG_harmony_scoping = true; |
838 i::FLAG_harmony_modules = true; | 834 i::FLAG_harmony_modules = true; |
839 | 835 |
840 v8::Isolate* isolate = CcTest::isolate(); | 836 v8::Isolate* isolate = CcTest::isolate(); |
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1133 Number::New(CcTest::isolate(), 13)); | 1129 Number::New(CcTest::isolate(), 13)); |
1134 } | 1130 } |
1135 context.Check("global.x", EXPECT_RESULT, | 1131 context.Check("global.x", EXPECT_RESULT, |
1136 Number::New(CcTest::isolate(), 20)); | 1132 Number::New(CcTest::isolate(), 20)); |
1137 context.Check("%OptimizeFunctionOnNextCall(f); f(41); x", EXPECT_RESULT, | 1133 context.Check("%OptimizeFunctionOnNextCall(f); f(41); x", EXPECT_RESULT, |
1138 Number::New(CcTest::isolate(), 41)); | 1134 Number::New(CcTest::isolate(), 41)); |
1139 context.Check("global.x", EXPECT_RESULT, | 1135 context.Check("global.x", EXPECT_RESULT, |
1140 Number::New(CcTest::isolate(), 20)); | 1136 Number::New(CcTest::isolate(), 20)); |
1141 } | 1137 } |
1142 } | 1138 } |
OLD | NEW |