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

Side by Side Diff: src/compiler/bytecode-graph-builder.cc

Issue 2347143002: [interpreter] Add fast path for dynamic global lookups (Closed)
Patch Set: Fix bytecode operand documentation 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
« no previous file with comments | « src/compiler/bytecode-graph-builder.h ('k') | src/interpreter/bytecode-array-builder.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/compiler/bytecode-graph-builder.h" 5 #include "src/compiler/bytecode-graph-builder.h"
6 6
7 #include "src/ast/ast.h" 7 #include "src/ast/ast.h"
8 #include "src/ast/scopes.h" 8 #include "src/ast/scopes.h"
9 #include "src/compilation-info.h" 9 #include "src/compilation-info.h"
10 #include "src/compiler/bytecode-branch-analysis.h" 10 #include "src/compiler/bytecode-branch-analysis.h"
(...skipping 897 matching lines...) Expand 10 before | Expand all | Expand 10 after
908 } 908 }
909 909
910 void BytecodeGraphBuilder::VisitLdaLookupContextSlot() { 910 void BytecodeGraphBuilder::VisitLdaLookupContextSlot() {
911 BuildLdaLookupContextSlot(TypeofMode::NOT_INSIDE_TYPEOF); 911 BuildLdaLookupContextSlot(TypeofMode::NOT_INSIDE_TYPEOF);
912 } 912 }
913 913
914 void BytecodeGraphBuilder::VisitLdaLookupContextSlotInsideTypeof() { 914 void BytecodeGraphBuilder::VisitLdaLookupContextSlotInsideTypeof() {
915 BuildLdaLookupContextSlot(TypeofMode::INSIDE_TYPEOF); 915 BuildLdaLookupContextSlot(TypeofMode::INSIDE_TYPEOF);
916 } 916 }
917 917
918 void BytecodeGraphBuilder::BuildLdaLookupGlobalSlot(TypeofMode typeof_mode) {
919 // TODO(leszeks): Build the fast path here.
920
921 // Slow path, do a runtime load lookup.
922 {
923 FrameStateBeforeAndAfter states(this);
924
925 Node* name =
926 jsgraph()->Constant(bytecode_iterator().GetConstantForIndexOperand(0));
927
928 const Operator* op =
929 javascript()->CallRuntime(typeof_mode == TypeofMode::NOT_INSIDE_TYPEOF
930 ? Runtime::kLoadLookupSlot
931 : Runtime::kLoadLookupSlotInsideTypeof);
932 Node* value = NewNode(op, name);
933 environment()->BindAccumulator(value, &states);
934 }
935 }
936
937 void BytecodeGraphBuilder::VisitLdaLookupGlobalSlot() {
938 BuildLdaLookupGlobalSlot(TypeofMode::NOT_INSIDE_TYPEOF);
939 }
940
941 void BytecodeGraphBuilder::VisitLdaLookupGlobalSlotInsideTypeof() {
942 BuildLdaLookupGlobalSlot(TypeofMode::INSIDE_TYPEOF);
943 }
944
918 void BytecodeGraphBuilder::BuildStaLookupSlot(LanguageMode language_mode) { 945 void BytecodeGraphBuilder::BuildStaLookupSlot(LanguageMode language_mode) {
919 FrameStateBeforeAndAfter states(this); 946 FrameStateBeforeAndAfter states(this);
920 Node* value = environment()->LookupAccumulator(); 947 Node* value = environment()->LookupAccumulator();
921 Node* name = 948 Node* name =
922 jsgraph()->Constant(bytecode_iterator().GetConstantForIndexOperand(0)); 949 jsgraph()->Constant(bytecode_iterator().GetConstantForIndexOperand(0));
923 const Operator* op = javascript()->CallRuntime( 950 const Operator* op = javascript()->CallRuntime(
924 is_strict(language_mode) ? Runtime::kStoreLookupSlot_Strict 951 is_strict(language_mode) ? Runtime::kStoreLookupSlot_Strict
925 : Runtime::kStoreLookupSlot_Sloppy); 952 : Runtime::kStoreLookupSlot_Sloppy);
926 Node* store = NewNode(op, name, value); 953 Node* store = NewNode(op, name, value);
927 environment()->BindAccumulator(store, &states); 954 environment()->BindAccumulator(store, &states);
(...skipping 1189 matching lines...) Expand 10 before | Expand all | Expand 10 after
2117 // Phi does not exist yet, introduce one. 2144 // Phi does not exist yet, introduce one.
2118 value = NewPhi(inputs, value, control); 2145 value = NewPhi(inputs, value, control);
2119 value->ReplaceInput(inputs - 1, other); 2146 value->ReplaceInput(inputs - 1, other);
2120 } 2147 }
2121 return value; 2148 return value;
2122 } 2149 }
2123 2150
2124 } // namespace compiler 2151 } // namespace compiler
2125 } // namespace internal 2152 } // namespace internal
2126 } // namespace v8 2153 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/bytecode-graph-builder.h ('k') | src/interpreter/bytecode-array-builder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698