| 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 9024 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9035 int suffix_len = Utf8LengthHelper(suffix); | 9035 int suffix_len = Utf8LengthHelper(suffix); |
| 9036 | 9036 |
| 9037 // The scope start positions must match; note the extra space in lazy_inner. | 9037 // The scope start positions must match; note the extra space in lazy_inner. |
| 9038 const char* lazy_inner = " function inner(%s) { %s }"; | 9038 const char* lazy_inner = " function inner(%s) { %s }"; |
| 9039 const char* eager_inner = "(function inner(%s) { %s })()"; | 9039 const char* eager_inner = "(function inner(%s) { %s })()"; |
| 9040 | 9040 |
| 9041 struct { | 9041 struct { |
| 9042 const char* params; | 9042 const char* params; |
| 9043 const char* source; | 9043 const char* source; |
| 9044 } inners[] = { | 9044 } inners[] = { |
| 9045 {"", "var1"}, | 9045 {"", "var1;"}, |
| 9046 {"", "var1 = 5;"}, |
| 9046 {"", "if (true) {}"}, | 9047 {"", "if (true) {}"}, |
| 9047 {"", "function f1() {}"}, | 9048 {"", "function f1() {}"}, |
| 9049 |
| 9050 {"", "var var1;"}, |
| 9051 {"", "var var1; var1 = 5;"}, |
| 9052 {"", "if (true) { var var1; }"}, |
| 9053 {"", "if (true) { var var1; var1 = 5; }"}, |
| 9054 {"", "var var1; function f() { var1; }"}, |
| 9055 {"", "var var1; var1 = 5; function f() { var1; }"}, |
| 9056 {"", "var var1; function f() { var1 = 5; }"}, |
| 9057 |
| 9058 {"", "let var1;"}, |
| 9059 {"", "let var1; var1 = 5;"}, |
| 9060 {"", "if (true) { let var1; }"}, |
| 9061 {"", "if (true) { let var1; var1 = 5; }"}, |
| 9062 {"", "let var1; function f() { var1; }"}, |
| 9063 {"", "let var1; var1 = 5; function f() { var1; }"}, |
| 9064 {"", "let var1; function f() { var1 = 5; }"}, |
| 9065 |
| 9066 {"", "const var1 = 5;"}, |
| 9067 {"", "if (true) { const var1 = 5; }"}, |
| 9068 {"", "const var1 = 5; function f() { var1; }"}, |
| 9048 }; | 9069 }; |
| 9049 | 9070 |
| 9050 for (unsigned i = 0; i < arraysize(inners); ++i) { | 9071 for (unsigned i = 0; i < arraysize(inners); ++i) { |
| 9051 // First compile with the lazy inner function and extract the scope data. | 9072 // First compile with the lazy inner function and extract the scope data. |
| 9052 const char* inner_function = lazy_inner; | 9073 const char* inner_function = lazy_inner; |
| 9053 int inner_function_len = Utf8LengthHelper(inner_function) - 4; | 9074 int inner_function_len = Utf8LengthHelper(inner_function) - 4; |
| 9054 | 9075 |
| 9055 int params_len = Utf8LengthHelper(inners[i].params); | 9076 int params_len = Utf8LengthHelper(inners[i].params); |
| 9056 int source_len = Utf8LengthHelper(inners[i].source); | 9077 int source_len = Utf8LengthHelper(inners[i].source); |
| 9057 int len = | 9078 int len = |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9107 eager_info.literal()->scope()->inner_scope()->inner_scope(); | 9128 eager_info.literal()->scope()->inner_scope()->inner_scope(); |
| 9108 DCHECK_NOT_NULL(scope); | 9129 DCHECK_NOT_NULL(scope); |
| 9109 DCHECK_NULL(scope->sibling()); | 9130 DCHECK_NULL(scope->sibling()); |
| 9110 DCHECK(scope->is_function_scope()); | 9131 DCHECK(scope->is_function_scope()); |
| 9111 | 9132 |
| 9112 size_t index = 0; | 9133 size_t index = 0; |
| 9113 i::ScopeTestHelper::CompareScopeToData( | 9134 i::ScopeTestHelper::CompareScopeToData( |
| 9114 scope, lazy_info.preparsed_scope_data(), index); | 9135 scope, lazy_info.preparsed_scope_data(), index); |
| 9115 } | 9136 } |
| 9116 } | 9137 } |
| OLD | NEW |