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 634 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
645 | 645 |
646 | 646 |
647 TEST(CrossScriptReferencesHarmony) { | 647 TEST(CrossScriptReferencesHarmony) { |
648 i::FLAG_use_strict = true; | 648 i::FLAG_use_strict = true; |
649 i::FLAG_harmony_scoping = true; | 649 i::FLAG_harmony_scoping = true; |
650 i::FLAG_harmony_modules = true; | 650 i::FLAG_harmony_modules = true; |
651 | 651 |
652 v8::Isolate* isolate = CcTest::isolate(); | 652 v8::Isolate* isolate = CcTest::isolate(); |
653 HandleScope scope(isolate); | 653 HandleScope scope(isolate); |
654 | 654 |
| 655 // TODO(rossberg): Reparsing of top-level code does not work in the presence |
| 656 // of harmony scoping and multiple scripts. This can already be reproduced |
| 657 // without --always-opt by relying on OSR alone. |
| 658 // |
| 659 // ./d8 --harmony-scoping |
| 660 // -e "'use strict'; let a = 1;" |
| 661 // -e "'use strict'; let b = 2; for (var i = 0; i < 100000; ++i) b++;" |
| 662 // |
| 663 // For now we just disable --always-opt for this test. |
| 664 i::FLAG_always_opt = false; |
| 665 |
655 const char* decs[] = { | 666 const char* decs[] = { |
656 "var x = 1; x", "x", "this.x", | 667 "var x = 1; x", "x", "this.x", |
657 "function x() { return 1 }; x()", "x()", "this.x()", | 668 "function x() { return 1 }; x()", "x()", "this.x()", |
658 "let x = 1; x", "x", "this.x", | 669 "let x = 1; x", "x", "this.x", |
659 "const x = 1; x", "x", "this.x", | 670 "const x = 1; x", "x", "this.x", |
660 "module x { export let a = 1 }; x.a", "x.a", "this.x.a", | 671 "module x { export let a = 1 }; x.a", "x.a", "this.x.a", |
661 NULL | 672 NULL |
662 }; | 673 }; |
663 | 674 |
664 for (int i = 0; decs[i] != NULL; i += 3) { | 675 for (int i = 0; decs[i] != NULL; i += 3) { |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
706 Number::New(CcTest::isolate(), 1)); | 717 Number::New(CcTest::isolate(), 1)); |
707 // TODO(rossberg): All tests should actually be errors in Harmony, | 718 // TODO(rossberg): All tests should actually be errors in Harmony, |
708 // but we currently do not detect the cases where the first declaration | 719 // but we currently do not detect the cases where the first declaration |
709 // is not lexical. | 720 // is not lexical. |
710 context.Check(seconds[j], | 721 context.Check(seconds[j], |
711 i < 2 ? EXPECT_RESULT : EXPECT_ERROR, | 722 i < 2 ? EXPECT_RESULT : EXPECT_ERROR, |
712 Number::New(CcTest::isolate(), 2)); | 723 Number::New(CcTest::isolate(), 2)); |
713 } | 724 } |
714 } | 725 } |
715 } | 726 } |
OLD | NEW |