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

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

Issue 1419823003: Remove support for "loads and stores to global vars through property cell shortcuts inst… (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@disable-shortcuts
Patch Set: Addressing comments Created 5 years, 2 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
« no previous file with comments | « src/interpreter/bytecode-array-builder.cc ('k') | src/interpreter/bytecodes.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/compiler.h" 7 #include "src/compiler.h"
8 #include "src/interpreter/control-flow-builders.h" 8 #include "src/interpreter/control-flow-builders.h"
9 #include "src/objects.h" 9 #include "src/objects.h"
10 #include "src/parser.h" 10 #include "src/parser.h"
(...skipping 919 matching lines...) Expand 10 before | Expand all | Expand 10 after
930 execution_result()->SetResultInRegister(source); 930 execution_result()->SetResultInRegister(source);
931 break; 931 break;
932 } 932 }
933 case VariableLocation::PARAMETER: { 933 case VariableLocation::PARAMETER: {
934 // The parameter indices are shifted by 1 (receiver is variable 934 // The parameter indices are shifted by 1 (receiver is variable
935 // index -1 but is parameter index 0 in BytecodeArrayBuilder). 935 // index -1 but is parameter index 0 in BytecodeArrayBuilder).
936 Register source = builder()->Parameter(variable->index() + 1); 936 Register source = builder()->Parameter(variable->index() + 1);
937 execution_result()->SetResultInRegister(source); 937 execution_result()->SetResultInRegister(source);
938 break; 938 break;
939 } 939 }
940 case VariableLocation::GLOBAL: { 940 case VariableLocation::GLOBAL:
941 // Global var, const, or let variable.
942 // TODO(rmcilroy): If context chain depth is short enough, do this using
943 // a generic version of LoadGlobalViaContextStub rather than calling the
944 // runtime.
945 DCHECK(variable->IsStaticGlobalObjectProperty());
946 builder()->LoadGlobal(variable->index());
947 execution_result()->SetResultInAccumulator();
948 break;
949 }
950 case VariableLocation::UNALLOCATED: { 941 case VariableLocation::UNALLOCATED: {
951 TemporaryRegisterScope temporary_register_scope(builder()); 942 TemporaryRegisterScope temporary_register_scope(builder());
952 Register obj = temporary_register_scope.NewRegister(); 943 Register obj = temporary_register_scope.NewRegister();
953 builder()->LoadContextSlot(execution_context()->reg(), 944 builder()->LoadContextSlot(execution_context()->reg(),
954 Context::GLOBAL_OBJECT_INDEX); 945 Context::GLOBAL_OBJECT_INDEX);
955 builder()->StoreAccumulatorInRegister(obj); 946 builder()->StoreAccumulatorInRegister(obj);
956 builder()->LoadLiteral(variable->name()); 947 builder()->LoadLiteral(variable->name());
957 builder()->LoadNamedProperty(obj, feedback_index(slot), language_mode()); 948 builder()->LoadNamedProperty(obj, feedback_index(slot), language_mode());
958 execution_result()->SetResultInAccumulator(); 949 execution_result()->SetResultInAccumulator();
959 break; 950 break;
(...skipping 27 matching lines...) Expand all
987 break; 978 break;
988 } 979 }
989 case VariableLocation::PARAMETER: { 980 case VariableLocation::PARAMETER: {
990 // The parameter indices are shifted by 1 (receiver is variable 981 // The parameter indices are shifted by 1 (receiver is variable
991 // index -1 but is parameter index 0 in BytecodeArrayBuilder). 982 // index -1 but is parameter index 0 in BytecodeArrayBuilder).
992 Register destination(builder()->Parameter(variable->index() + 1)); 983 Register destination(builder()->Parameter(variable->index() + 1));
993 builder()->StoreAccumulatorInRegister(destination); 984 builder()->StoreAccumulatorInRegister(destination);
994 RecordStoreToRegister(destination); 985 RecordStoreToRegister(destination);
995 break; 986 break;
996 } 987 }
997 case VariableLocation::GLOBAL: { 988 case VariableLocation::GLOBAL:
998 // Global var, const, or let variable.
999 // TODO(rmcilroy): If context chain depth is short enough, do this using
1000 // a generic version of LoadGlobalViaContextStub rather than calling the
1001 // runtime.
1002 DCHECK(variable->IsStaticGlobalObjectProperty());
1003 builder()->StoreGlobal(variable->index(), language_mode());
1004 break;
1005 }
1006 case VariableLocation::UNALLOCATED: { 989 case VariableLocation::UNALLOCATED: {
1007 Register value = execution_result()->NewRegister(); 990 Register value = execution_result()->NewRegister();
1008 Register obj = execution_result()->NewRegister(); 991 Register obj = execution_result()->NewRegister();
1009 Register name = execution_result()->NewRegister(); 992 Register name = execution_result()->NewRegister();
1010 993
1011 // TODO(rmcilroy): Investigate whether we can avoid having to stash the 994 // TODO(rmcilroy): Investigate whether we can avoid having to stash the
1012 // value in a register. 995 // value in a register.
1013 builder()->StoreAccumulatorInRegister(value); 996 builder()->StoreAccumulatorInRegister(value);
1014 builder()->LoadContextSlot(execution_context()->reg(), 997 builder()->LoadContextSlot(execution_context()->reg(),
1015 Context::GLOBAL_OBJECT_INDEX); 998 Context::GLOBAL_OBJECT_INDEX);
(...skipping 635 matching lines...) Expand 10 before | Expand all | Expand 10 after
1651 } 1634 }
1652 1635
1653 1636
1654 int BytecodeGenerator::feedback_index(FeedbackVectorSlot slot) const { 1637 int BytecodeGenerator::feedback_index(FeedbackVectorSlot slot) const {
1655 return info()->feedback_vector()->GetIndex(slot); 1638 return info()->feedback_vector()->GetIndex(slot);
1656 } 1639 }
1657 1640
1658 } // namespace interpreter 1641 } // namespace interpreter
1659 } // namespace internal 1642 } // namespace internal
1660 } // namespace v8 1643 } // namespace v8
OLDNEW
« no previous file with comments | « src/interpreter/bytecode-array-builder.cc ('k') | src/interpreter/bytecodes.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698