OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/interpreter/bytecode-generator.h" | 5 #include "src/interpreter/bytecode-generator.h" |
6 | 6 |
7 #include "src/ast/compile-time-value.h" | 7 #include "src/ast/compile-time-value.h" |
8 #include "src/ast/scopes.h" | 8 #include "src/ast/scopes.h" |
9 #include "src/code-stubs.h" | 9 #include "src/code-stubs.h" |
10 #include "src/compilation-info.h" | 10 #include "src/compilation-info.h" |
(...skipping 1959 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1970 switch (variable->mode()) { | 1970 switch (variable->mode()) { |
1971 case DYNAMIC_LOCAL: { | 1971 case DYNAMIC_LOCAL: { |
1972 Variable* local_variable = variable->local_if_not_shadowed(); | 1972 Variable* local_variable = variable->local_if_not_shadowed(); |
1973 int depth = | 1973 int depth = |
1974 execution_context()->ContextChainDepth(local_variable->scope()); | 1974 execution_context()->ContextChainDepth(local_variable->scope()); |
1975 builder()->LoadLookupContextSlot(variable->name(), typeof_mode, | 1975 builder()->LoadLookupContextSlot(variable->name(), typeof_mode, |
1976 local_variable->index(), depth); | 1976 local_variable->index(), depth); |
1977 BuildHoleCheckForVariableLoad(variable); | 1977 BuildHoleCheckForVariableLoad(variable); |
1978 break; | 1978 break; |
1979 } | 1979 } |
| 1980 case DYNAMIC_GLOBAL: { |
| 1981 int depth = scope()->ContextChainLengthUntilOutermostSloppyEval(); |
| 1982 builder()->LoadLookupGlobalSlot(variable->name(), typeof_mode, |
| 1983 feedback_index(slot), depth); |
| 1984 break; |
| 1985 } |
1980 default: | 1986 default: |
1981 builder()->LoadLookupSlot(variable->name(), typeof_mode); | 1987 builder()->LoadLookupSlot(variable->name(), typeof_mode); |
1982 } | 1988 } |
1983 break; | 1989 break; |
1984 } | 1990 } |
1985 case VariableLocation::MODULE: { | 1991 case VariableLocation::MODULE: { |
1986 ModuleDescriptor* descriptor = scope()->GetModuleScope()->module(); | 1992 ModuleDescriptor* descriptor = scope()->GetModuleScope()->module(); |
1987 if (variable->IsExport()) { | 1993 if (variable->IsExport()) { |
1988 auto it = descriptor->regular_exports().find(variable->raw_name()); | 1994 auto it = descriptor->regular_exports().find(variable->raw_name()); |
1989 DCHECK(it != descriptor->regular_exports().end()); | 1995 DCHECK(it != descriptor->regular_exports().end()); |
(...skipping 1448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3438 return execution_context()->scope()->language_mode(); | 3444 return execution_context()->scope()->language_mode(); |
3439 } | 3445 } |
3440 | 3446 |
3441 int BytecodeGenerator::feedback_index(FeedbackVectorSlot slot) const { | 3447 int BytecodeGenerator::feedback_index(FeedbackVectorSlot slot) const { |
3442 return TypeFeedbackVector::GetIndex(slot); | 3448 return TypeFeedbackVector::GetIndex(slot); |
3443 } | 3449 } |
3444 | 3450 |
3445 } // namespace interpreter | 3451 } // namespace interpreter |
3446 } // namespace internal | 3452 } // namespace internal |
3447 } // namespace v8 | 3453 } // namespace v8 |
OLD | NEW |