OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 8674 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8685 {"function inner() { for (let [a, my_var, b] in {}) { } my_var; }", true}, | 8685 {"function inner() { for (let [a, my_var, b] in {}) { } my_var; }", true}, |
8686 {"function inner() { for (let [a, my_var, b] of []) { } my_var; }", true}, | 8686 {"function inner() { for (let [a, my_var, b] of []) { } my_var; }", true}, |
8687 {"function inner() { for (let {x: my_var} in {}) { } my_var; }", true}, | 8687 {"function inner() { for (let {x: my_var} in {}) { } my_var; }", true}, |
8688 {"function inner() { for (let {x: my_var} of []) { } my_var; }", true}, | 8688 {"function inner() { for (let {x: my_var} of []) { } my_var; }", true}, |
8689 {"function inner() { for (let {my_var} in {}) { } my_var; }", true}, | 8689 {"function inner() { for (let {my_var} in {}) { } my_var; }", true}, |
8690 {"function inner() { for (let {my_var} of []) { } my_var; }", true}, | 8690 {"function inner() { for (let {my_var} of []) { } my_var; }", true}, |
8691 {"function inner() { for (let {y, x: my_var} in {}) { } my_var; }", true}, | 8691 {"function inner() { for (let {y, x: my_var} in {}) { } my_var; }", true}, |
8692 {"function inner() { for (let {y, x: my_var} of []) { } my_var; }", true}, | 8692 {"function inner() { for (let {y, x: my_var} of []) { } my_var; }", true}, |
8693 {"function inner() { for (let {a, my_var} in {}) { } my_var; }", true}, | 8693 {"function inner() { for (let {a, my_var} in {}) { } my_var; }", true}, |
8694 {"function inner() { for (let {a, my_var} of []) { } my_var; }", true}, | 8694 {"function inner() { for (let {a, my_var} of []) { } my_var; }", true}, |
| 8695 {"function inner() { for (let my_var = 0; my_var < 1; ++my_var) { } " |
| 8696 "my_var }", |
| 8697 true}, |
8695 // No pessimistic context allocation: | 8698 // No pessimistic context allocation: |
8696 {"function inner() { var my_var; my_var; }", false}, | 8699 {"function inner() { var my_var; my_var; }", false}, |
8697 {"function inner() { var my_var; }", false}, | 8700 {"function inner() { var my_var; }", false}, |
| 8701 {"function inner() { var my_var = 0; }", false}, |
8698 {"function inner() { if (true) { var my_var; } my_var; }", false}, | 8702 {"function inner() { if (true) { var my_var; } my_var; }", false}, |
8699 {"function inner() { let my_var; my_var; }", false}, | 8703 {"function inner() { let my_var; my_var; }", false}, |
8700 {"function inner() { let my_var; }", false}, | 8704 {"function inner() { let my_var; }", false}, |
| 8705 {"function inner() { let my_var = 0; }", false}, |
8701 {"function inner() { const my_var = 0; my_var; }", false}, | 8706 {"function inner() { const my_var = 0; my_var; }", false}, |
8702 {"function inner() { const my_var = 0; }", false}, | 8707 {"function inner() { const my_var = 0; }", false}, |
8703 {"function inner() { var [a, my_var] = [1, 2]; my_var; }", false}, | 8708 {"function inner() { var [a, my_var] = [1, 2]; my_var; }", false}, |
8704 {"function inner() { let [a, my_var] = [1, 2]; my_var; }", false}, | 8709 {"function inner() { let [a, my_var] = [1, 2]; my_var; }", false}, |
8705 {"function inner() { const [a, my_var] = [1, 2]; my_var; }", false}, | 8710 {"function inner() { const [a, my_var] = [1, 2]; my_var; }", false}, |
8706 {"function inner() { var {a: my_var} = {a: 3}; my_var; }", false}, | 8711 {"function inner() { var {a: my_var} = {a: 3}; my_var; }", false}, |
8707 {"function inner() { let {a: my_var} = {a: 3}; my_var; }", false}, | 8712 {"function inner() { let {a: my_var} = {a: 3}; my_var; }", false}, |
8708 {"function inner() { const {a: my_var} = {a: 3}; my_var; }", false}, | 8713 {"function inner() { const {a: my_var} = {a: 3}; my_var; }", false}, |
8709 {"function inner() { var {my_var} = {my_var: 3}; my_var; }", false}, | 8714 {"function inner() { var {my_var} = {my_var: 3}; my_var; }", false}, |
8710 {"function inner() { let {my_var} = {my_var: 3}; my_var; }", false}, | 8715 {"function inner() { let {my_var} = {my_var: 3}; my_var; }", false}, |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8864 {"function inner() { for (var {y, x: my_var} of []) { } my_var; }", | 8869 {"function inner() { for (var {y, x: my_var} of []) { } my_var; }", |
8865 false}, | 8870 false}, |
8866 {"function inner() { for (var {a, my_var} in {}) { } my_var; }", false}, | 8871 {"function inner() { for (var {a, my_var} in {}) { } my_var; }", false}, |
8867 {"function inner() { for (var {a, my_var} of []) { } my_var; }", false}, | 8872 {"function inner() { for (var {a, my_var} of []) { } my_var; }", false}, |
8868 {"function inner() { for (let my_var = 0; my_var < 1; ++my_var) { my_var " | 8873 {"function inner() { for (let my_var = 0; my_var < 1; ++my_var) { my_var " |
8869 "} }", | 8874 "} }", |
8870 false}, | 8875 false}, |
8871 {"function inner() { for (var my_var = 0; my_var < 1; ++my_var) { my_var " | 8876 {"function inner() { for (var my_var = 0; my_var < 1; ++my_var) { my_var " |
8872 "} }", | 8877 "} }", |
8873 false}, | 8878 false}, |
| 8879 {"function inner() { for (var my_var = 0; my_var < 1; ++my_var) { } " |
| 8880 "my_var }", |
| 8881 false}, |
8874 {"function inner() { for (let a = 0, my_var = 0; my_var < 1; ++my_var) { " | 8882 {"function inner() { for (let a = 0, my_var = 0; my_var < 1; ++my_var) { " |
8875 "my_var } }", | 8883 "my_var } }", |
8876 false}, | 8884 false}, |
8877 {"function inner() { for (var a = 0, my_var = 0; my_var < 1; ++my_var) { " | 8885 {"function inner() { for (var a = 0, my_var = 0; my_var < 1; ++my_var) { " |
8878 "my_var } }", | 8886 "my_var } }", |
8879 false}, | 8887 false}, |
8880 {"function inner() { class my_var {}; my_var }", false}, | 8888 {"function inner() { class my_var {}; my_var }", false}, |
8881 // In the following cases we still context allocate pessimistically: | 8889 // In the following cases we still context allocate pessimistically: |
8882 {"function inner() { function my_var() {} my_var; }", true}, | 8890 {"function inner() { function my_var() {} my_var; }", true}, |
8883 {"function inner() { if (true) { function my_var() {} } my_var; }", | 8891 {"function inner() { if (true) { function my_var() {} } my_var; }", |
(...skipping 23 matching lines...) Expand all Loading... |
8907 DCHECK_NOT_NULL(scope); | 8915 DCHECK_NOT_NULL(scope); |
8908 DCHECK_NULL(scope->sibling()); | 8916 DCHECK_NULL(scope->sibling()); |
8909 DCHECK(scope->is_function_scope()); | 8917 DCHECK(scope->is_function_scope()); |
8910 const i::AstRawString* var_name = | 8918 const i::AstRawString* var_name = |
8911 info.ast_value_factory()->GetOneByteString("my_var"); | 8919 info.ast_value_factory()->GetOneByteString("my_var"); |
8912 i::Variable* var = scope->Lookup(var_name); | 8920 i::Variable* var = scope->Lookup(var_name); |
8913 CHECK_EQ(inners[i].ctxt_allocate, | 8921 CHECK_EQ(inners[i].ctxt_allocate, |
8914 i::ScopeTestHelper::MustAllocateInContext(var)); | 8922 i::ScopeTestHelper::MustAllocateInContext(var)); |
8915 } | 8923 } |
8916 } | 8924 } |
OLD | NEW |