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

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

Issue 1962723002: [turbofan] Implement top-level lookup slot declaration. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Skip timeouts. Created 4 years, 7 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 | « no previous file | src/full-codegen/arm/full-codegen-arm.cc » ('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 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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/ast-graph-builder.h" 5 #include "src/compiler/ast-graph-builder.h"
6 6
7 #include "src/ast/scopes.h" 7 #include "src/ast/scopes.h"
8 #include "src/compiler.h" 8 #include "src/compiler.h"
9 #include "src/compiler/ast-loop-assignment-analyzer.h" 9 #include "src/compiler/ast-loop-assignment-analyzer.h"
10 #include "src/compiler/control-builders.h" 10 #include "src/compiler/control-builders.h"
(...skipping 1096 matching lines...) Expand 10 before | Expand all | Expand 10 after
1107 environment()->Bind(variable, value); 1107 environment()->Bind(variable, value);
1108 } 1108 }
1109 break; 1109 break;
1110 case VariableLocation::CONTEXT: 1110 case VariableLocation::CONTEXT:
1111 if (hole_init) { 1111 if (hole_init) {
1112 Node* value = jsgraph()->TheHoleConstant(); 1112 Node* value = jsgraph()->TheHoleConstant();
1113 const Operator* op = javascript()->StoreContext(0, variable->index()); 1113 const Operator* op = javascript()->StoreContext(0, variable->index());
1114 NewNode(op, current_context(), value); 1114 NewNode(op, current_context(), value);
1115 } 1115 }
1116 break; 1116 break;
1117 case VariableLocation::LOOKUP: 1117 case VariableLocation::LOOKUP: {
1118 // TODO(mstarzinger): Implement this case. 1118 Node* name = jsgraph()->Constant(variable->name());
1119 SetStackOverflow(); 1119 // For variables we must not push an initial value (such as 'undefined')
1120 // because we may have a (legal) redeclaration and we must not destroy
1121 // the current value.
1122 Node* value =
1123 hole_init ? jsgraph()->TheHoleConstant()
1124 : jsgraph()->ZeroConstant(); // Indicates no initial value.
1125 Node* attr =
1126 jsgraph()->Constant(variable->DeclarationPropertyAttributes());
1127 const Operator* op =
1128 javascript()->CallRuntime(Runtime::kDeclareLookupSlot);
1129 Node* store = NewNode(op, name, value, attr);
1130 PrepareFrameState(store, decl->proxy()->id());
1120 break; 1131 break;
1132 }
1121 } 1133 }
1122 } 1134 }
1123 1135
1124 1136
1125 void AstGraphBuilder::VisitFunctionDeclaration(FunctionDeclaration* decl) { 1137 void AstGraphBuilder::VisitFunctionDeclaration(FunctionDeclaration* decl) {
1126 Variable* variable = decl->proxy()->var(); 1138 Variable* variable = decl->proxy()->var();
1127 switch (variable->location()) { 1139 switch (variable->location()) {
1128 case VariableLocation::GLOBAL: 1140 case VariableLocation::GLOBAL:
1129 case VariableLocation::UNALLOCATED: { 1141 case VariableLocation::UNALLOCATED: {
1130 Handle<SharedFunctionInfo> function = Compiler::GetSharedFunctionInfo( 1142 Handle<SharedFunctionInfo> function = Compiler::GetSharedFunctionInfo(
(...skipping 11 matching lines...) Expand all
1142 environment()->Bind(variable, value); 1154 environment()->Bind(variable, value);
1143 break; 1155 break;
1144 } 1156 }
1145 case VariableLocation::CONTEXT: { 1157 case VariableLocation::CONTEXT: {
1146 VisitForValue(decl->fun()); 1158 VisitForValue(decl->fun());
1147 Node* value = environment()->Pop(); 1159 Node* value = environment()->Pop();
1148 const Operator* op = javascript()->StoreContext(0, variable->index()); 1160 const Operator* op = javascript()->StoreContext(0, variable->index());
1149 NewNode(op, current_context(), value); 1161 NewNode(op, current_context(), value);
1150 break; 1162 break;
1151 } 1163 }
1152 case VariableLocation::LOOKUP: 1164 case VariableLocation::LOOKUP: {
1153 // TODO(mstarzinger): Implement this case. 1165 VisitForValue(decl->fun());
1154 SetStackOverflow(); 1166 Node* value = environment()->Pop();
1167 Node* name = jsgraph()->Constant(variable->name());
1168 Node* attr =
1169 jsgraph()->Constant(variable->DeclarationPropertyAttributes());
1170 const Operator* op =
1171 javascript()->CallRuntime(Runtime::kDeclareLookupSlot);
1172 Node* store = NewNode(op, name, value, attr);
1173 PrepareFrameState(store, decl->proxy()->id());
1155 break; 1174 break;
1175 }
1156 } 1176 }
1157 } 1177 }
1158 1178
1159 1179
1160 void AstGraphBuilder::VisitImportDeclaration(ImportDeclaration* decl) { 1180 void AstGraphBuilder::VisitImportDeclaration(ImportDeclaration* decl) {
1161 UNREACHABLE(); 1181 UNREACHABLE();
1162 } 1182 }
1163 1183
1164 1184
1165 void AstGraphBuilder::VisitExportDeclaration(ExportDeclaration* decl) { 1185 void AstGraphBuilder::VisitExportDeclaration(ExportDeclaration* decl) {
(...skipping 3177 matching lines...) Expand 10 before | Expand all | Expand 10 after
4343 // Phi does not exist yet, introduce one. 4363 // Phi does not exist yet, introduce one.
4344 value = NewPhi(inputs, value, control); 4364 value = NewPhi(inputs, value, control);
4345 value->ReplaceInput(inputs - 1, other); 4365 value->ReplaceInput(inputs - 1, other);
4346 } 4366 }
4347 return value; 4367 return value;
4348 } 4368 }
4349 4369
4350 } // namespace compiler 4370 } // namespace compiler
4351 } // namespace internal 4371 } // namespace internal
4352 } // namespace v8 4372 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | src/full-codegen/arm/full-codegen-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698