Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(195)

Side by Side Diff: src/interpreter/bytecode-generator.cc

Issue 2343633002: [interpreter] Add a fast path for dynamic local load (Closed)
Patch Set: Rebase Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 1949 matching lines...) Expand 10 before | Expand all | Expand 10 after
1960 depth = 0; 1960 depth = 0;
1961 } else { 1961 } else {
1962 context_reg = execution_context()->reg(); 1962 context_reg = execution_context()->reg();
1963 } 1963 }
1964 1964
1965 builder()->LoadContextSlot(context_reg, variable->index(), depth); 1965 builder()->LoadContextSlot(context_reg, variable->index(), depth);
1966 BuildHoleCheckForVariableLoad(variable); 1966 BuildHoleCheckForVariableLoad(variable);
1967 break; 1967 break;
1968 } 1968 }
1969 case VariableLocation::LOOKUP: { 1969 case VariableLocation::LOOKUP: {
1970 builder()->LoadLookupSlot(variable->name(), typeof_mode); 1970 switch (variable->mode()) {
1971 case DYNAMIC_LOCAL: {
1972 Variable* local_variable = variable->local_if_not_shadowed();
1973 int depth =
1974 execution_context()->ContextChainDepth(local_variable->scope());
1975 builder()->LoadLookupContextSlot(variable->name(), typeof_mode,
1976 local_variable->index(), depth);
1977 BuildHoleCheckForVariableLoad(variable);
1978 break;
1979 }
1980 default:
1981 builder()->LoadLookupSlot(variable->name(), typeof_mode);
1982 }
1971 break; 1983 break;
1972 } 1984 }
1973 case VariableLocation::MODULE: { 1985 case VariableLocation::MODULE: {
1974 ModuleDescriptor* descriptor = scope()->GetModuleScope()->module(); 1986 ModuleDescriptor* descriptor = scope()->GetModuleScope()->module();
1975 if (variable->IsExport()) { 1987 if (variable->IsExport()) {
1976 auto it = descriptor->regular_exports().find(variable->raw_name()); 1988 auto it = descriptor->regular_exports().find(variable->raw_name());
1977 DCHECK(it != descriptor->regular_exports().end()); 1989 DCHECK(it != descriptor->regular_exports().end());
1978 Register export_name = register_allocator()->NewRegister(); 1990 Register export_name = register_allocator()->NewRegister();
1979 builder() 1991 builder()
1980 ->LoadLiteral(it->second->export_name->string()) 1992 ->LoadLiteral(it->second->export_name->string())
(...skipping 1445 matching lines...) Expand 10 before | Expand all | Expand 10 after
3426 return execution_context()->scope()->language_mode(); 3438 return execution_context()->scope()->language_mode();
3427 } 3439 }
3428 3440
3429 int BytecodeGenerator::feedback_index(FeedbackVectorSlot slot) const { 3441 int BytecodeGenerator::feedback_index(FeedbackVectorSlot slot) const {
3430 return TypeFeedbackVector::GetIndex(slot); 3442 return TypeFeedbackVector::GetIndex(slot);
3431 } 3443 }
3432 3444
3433 } // namespace interpreter 3445 } // namespace interpreter
3434 } // namespace internal 3446 } // namespace internal
3435 } // namespace v8 3447 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698