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

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

Issue 2343633002: [interpreter] Add a fast path for dynamic local load (Closed)
Patch Set: Disable clang format for the new test 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 1945 matching lines...) Expand 10 before | Expand all | Expand 10 after
1956 depth = 0; 1956 depth = 0;
1957 } else { 1957 } else {
1958 context_reg = execution_context()->reg(); 1958 context_reg = execution_context()->reg();
1959 } 1959 }
1960 1960
1961 builder()->LoadContextSlot(context_reg, variable->index(), depth); 1961 builder()->LoadContextSlot(context_reg, variable->index(), depth);
1962 BuildHoleCheckForVariableLoad(variable); 1962 BuildHoleCheckForVariableLoad(variable);
1963 break; 1963 break;
1964 } 1964 }
1965 case VariableLocation::LOOKUP: { 1965 case VariableLocation::LOOKUP: {
1966 builder()->LoadLookupSlot(variable->name(), typeof_mode); 1966 switch (variable->mode()) {
1967 case DYNAMIC_LOCAL: {
1968 Variable* local_variable = variable->local_if_not_shadowed();
1969 int depth =
1970 execution_context()->ContextChainDepth(local_variable->scope());
1971 builder()->LoadLookupContextSlot(variable->name(), typeof_mode,
1972 local_variable->index(), depth);
1973 BuildHoleCheckForVariableLoad(variable);
1974 break;
1975 }
1976 default:
1977 builder()->LoadLookupSlot(variable->name(), typeof_mode);
1978 }
1967 break; 1979 break;
1968 } 1980 }
1969 case VariableLocation::MODULE: { 1981 case VariableLocation::MODULE: {
1970 ModuleDescriptor* descriptor = scope()->GetModuleScope()->module(); 1982 ModuleDescriptor* descriptor = scope()->GetModuleScope()->module();
1971 if (variable->IsExport()) { 1983 if (variable->IsExport()) {
1972 auto it = descriptor->regular_exports().find(variable->raw_name()); 1984 auto it = descriptor->regular_exports().find(variable->raw_name());
1973 DCHECK(it != descriptor->regular_exports().end()); 1985 DCHECK(it != descriptor->regular_exports().end());
1974 Register export_name = register_allocator()->NewRegister(); 1986 Register export_name = register_allocator()->NewRegister();
1975 builder() 1987 builder()
1976 ->LoadLiteral(it->second->export_name->string()) 1988 ->LoadLiteral(it->second->export_name->string())
(...skipping 1445 matching lines...) Expand 10 before | Expand all | Expand 10 after
3422 return execution_context()->scope()->language_mode(); 3434 return execution_context()->scope()->language_mode();
3423 } 3435 }
3424 3436
3425 int BytecodeGenerator::feedback_index(FeedbackVectorSlot slot) const { 3437 int BytecodeGenerator::feedback_index(FeedbackVectorSlot slot) const {
3426 return TypeFeedbackVector::GetIndex(slot); 3438 return TypeFeedbackVector::GetIndex(slot);
3427 } 3439 }
3428 3440
3429 } // namespace interpreter 3441 } // namespace interpreter
3430 } // namespace internal 3442 } // namespace internal
3431 } // namespace v8 3443 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698