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

Side by Side Diff: src/crankshaft/hydrogen.cc

Issue 2199283002: [modules] Introduce new VariableLocation for module imports/exports. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Comment Created 4 years, 4 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 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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/crankshaft/hydrogen.h" 5 #include "src/crankshaft/hydrogen.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <sstream> 8 #include <sstream>
9 9
10 #include "src/allocation-site-scopes.h" 10 #include "src/allocation-site-scopes.h"
(...skipping 5749 matching lines...) Expand 10 before | Expand all | Expand 10 after
5760 mode = HLoadContextSlot::kNoCheck; 5760 mode = HLoadContextSlot::kNoCheck;
5761 break; 5761 break;
5762 } 5762 }
5763 HLoadContextSlot* instr = 5763 HLoadContextSlot* instr =
5764 new(zone()) HLoadContextSlot(context, variable->index(), mode); 5764 new(zone()) HLoadContextSlot(context, variable->index(), mode);
5765 return ast_context()->ReturnInstruction(instr, expr->id()); 5765 return ast_context()->ReturnInstruction(instr, expr->id());
5766 } 5766 }
5767 5767
5768 case VariableLocation::LOOKUP: 5768 case VariableLocation::LOOKUP:
5769 return Bailout(kReferenceToAVariableWhichRequiresDynamicLookup); 5769 return Bailout(kReferenceToAVariableWhichRequiresDynamicLookup);
5770
5771 case VariableLocation::MODULE:
5772 UNREACHABLE();
5770 } 5773 }
5771 } 5774 }
5772 5775
5773 5776
5774 void HOptimizedGraphBuilder::VisitLiteral(Literal* expr) { 5777 void HOptimizedGraphBuilder::VisitLiteral(Literal* expr) {
5775 DCHECK(!HasStackOverflow()); 5778 DCHECK(!HasStackOverflow());
5776 DCHECK(current_block() != NULL); 5779 DCHECK(current_block() != NULL);
5777 DCHECK(current_block()->HasPredecessor()); 5780 DCHECK(current_block()->HasPredecessor());
5778 HConstant* instr = New<HConstant>(expr->value()); 5781 HConstant* instr = New<HConstant>(expr->value());
5779 return ast_context()->ReturnInstruction(instr, expr->id()); 5782 return ast_context()->ReturnInstruction(instr, expr->id());
(...skipping 1222 matching lines...) Expand 10 before | Expand all | Expand 10 after
7002 HStoreContextSlot* instr = Add<HStoreContextSlot>( 7005 HStoreContextSlot* instr = Add<HStoreContextSlot>(
7003 context, var->index(), mode, Top()); 7006 context, var->index(), mode, Top());
7004 if (instr->HasObservableSideEffects()) { 7007 if (instr->HasObservableSideEffects()) {
7005 Add<HSimulate>(expr->AssignmentId(), REMOVABLE_SIMULATE); 7008 Add<HSimulate>(expr->AssignmentId(), REMOVABLE_SIMULATE);
7006 } 7009 }
7007 break; 7010 break;
7008 } 7011 }
7009 7012
7010 case VariableLocation::LOOKUP: 7013 case VariableLocation::LOOKUP:
7011 return Bailout(kCompoundAssignmentToLookupSlot); 7014 return Bailout(kCompoundAssignmentToLookupSlot);
7015
7016 case VariableLocation::MODULE:
7017 UNREACHABLE();
7012 } 7018 }
7013 return ast_context()->ReturnValue(Pop()); 7019 return ast_context()->ReturnValue(Pop());
7014 7020
7015 } else if (prop != NULL) { 7021 } else if (prop != NULL) {
7016 CHECK_ALIVE(VisitForValue(prop->obj())); 7022 CHECK_ALIVE(VisitForValue(prop->obj()));
7017 HValue* object = Top(); 7023 HValue* object = Top();
7018 HValue* key = NULL; 7024 HValue* key = NULL;
7019 if (!prop->key()->IsPropertyName() || prop->IsStringAccess()) { 7025 if (!prop->key()->IsPropertyName() || prop->IsStringAccess()) {
7020 CHECK_ALIVE(VisitForValue(prop->key())); 7026 CHECK_ALIVE(VisitForValue(prop->key()));
7021 key = Top(); 7027 key = Top();
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
7150 HStoreContextSlot* instr = Add<HStoreContextSlot>( 7156 HStoreContextSlot* instr = Add<HStoreContextSlot>(
7151 context, var->index(), mode, Top()); 7157 context, var->index(), mode, Top());
7152 if (instr->HasObservableSideEffects()) { 7158 if (instr->HasObservableSideEffects()) {
7153 Add<HSimulate>(expr->AssignmentId(), REMOVABLE_SIMULATE); 7159 Add<HSimulate>(expr->AssignmentId(), REMOVABLE_SIMULATE);
7154 } 7160 }
7155 return ast_context()->ReturnValue(Pop()); 7161 return ast_context()->ReturnValue(Pop());
7156 } 7162 }
7157 7163
7158 case VariableLocation::LOOKUP: 7164 case VariableLocation::LOOKUP:
7159 return Bailout(kAssignmentToLOOKUPVariable); 7165 return Bailout(kAssignmentToLOOKUPVariable);
7166
7167 case VariableLocation::MODULE:
7168 UNREACHABLE();
7160 } 7169 }
7161 } else { 7170 } else {
7162 return Bailout(kInvalidLeftHandSideInAssignment); 7171 return Bailout(kInvalidLeftHandSideInAssignment);
7163 } 7172 }
7164 } 7173 }
7165 7174
7166 7175
7167 void HOptimizedGraphBuilder::VisitYield(Yield* expr) { 7176 void HOptimizedGraphBuilder::VisitYield(Yield* expr) {
7168 // Generators are not optimized, so we should never get here. 7177 // Generators are not optimized, so we should never get here.
7169 UNREACHABLE(); 7178 UNREACHABLE();
(...skipping 3626 matching lines...) Expand 10 before | Expand all | Expand 10 after
10796 HStoreContextSlot* instr = Add<HStoreContextSlot>(context, var->index(), 10805 HStoreContextSlot* instr = Add<HStoreContextSlot>(context, var->index(),
10797 mode, after); 10806 mode, after);
10798 if (instr->HasObservableSideEffects()) { 10807 if (instr->HasObservableSideEffects()) {
10799 Add<HSimulate>(expr->AssignmentId(), REMOVABLE_SIMULATE); 10808 Add<HSimulate>(expr->AssignmentId(), REMOVABLE_SIMULATE);
10800 } 10809 }
10801 break; 10810 break;
10802 } 10811 }
10803 10812
10804 case VariableLocation::LOOKUP: 10813 case VariableLocation::LOOKUP:
10805 return Bailout(kLookupVariableInCountOperation); 10814 return Bailout(kLookupVariableInCountOperation);
10815
10816 case VariableLocation::MODULE:
10817 UNREACHABLE();
10806 } 10818 }
10807 10819
10808 Drop(returns_original_input ? 2 : 1); 10820 Drop(returns_original_input ? 2 : 1);
10809 return ast_context()->ReturnValue(expr->is_postfix() ? input : after); 10821 return ast_context()->ReturnValue(expr->is_postfix() ? input : after);
10810 } 10822 }
10811 10823
10812 // Argument of the count operation is a property. 10824 // Argument of the count operation is a property.
10813 DCHECK(prop != NULL); 10825 DCHECK(prop != NULL);
10814 if (returns_original_input) Push(graph()->GetConstantUndefined()); 10826 if (returns_original_input) Push(graph()->GetConstantUndefined());
10815 10827
(...skipping 1373 matching lines...) Expand 10 before | Expand all | Expand 10 after
12189 HValue* context = environment()->context(); 12201 HValue* context = environment()->context();
12190 HStoreContextSlot* store = Add<HStoreContextSlot>( 12202 HStoreContextSlot* store = Add<HStoreContextSlot>(
12191 context, variable->index(), HStoreContextSlot::kNoCheck, value); 12203 context, variable->index(), HStoreContextSlot::kNoCheck, value);
12192 if (store->HasObservableSideEffects()) { 12204 if (store->HasObservableSideEffects()) {
12193 Add<HSimulate>(proxy->id(), REMOVABLE_SIMULATE); 12205 Add<HSimulate>(proxy->id(), REMOVABLE_SIMULATE);
12194 } 12206 }
12195 } 12207 }
12196 break; 12208 break;
12197 case VariableLocation::LOOKUP: 12209 case VariableLocation::LOOKUP:
12198 return Bailout(kUnsupportedLookupSlotInDeclaration); 12210 return Bailout(kUnsupportedLookupSlotInDeclaration);
12211 case VariableLocation::MODULE:
12212 UNREACHABLE();
12199 } 12213 }
12200 } 12214 }
12201 12215
12202 12216
12203 void HOptimizedGraphBuilder::VisitFunctionDeclaration( 12217 void HOptimizedGraphBuilder::VisitFunctionDeclaration(
12204 FunctionDeclaration* declaration) { 12218 FunctionDeclaration* declaration) {
12205 VariableProxy* proxy = declaration->proxy(); 12219 VariableProxy* proxy = declaration->proxy();
12206 Variable* variable = proxy->var(); 12220 Variable* variable = proxy->var();
12207 switch (variable->location()) { 12221 switch (variable->location()) {
12208 case VariableLocation::GLOBAL: 12222 case VariableLocation::GLOBAL:
(...skipping 21 matching lines...) Expand all
12230 HValue* context = environment()->context(); 12244 HValue* context = environment()->context();
12231 HStoreContextSlot* store = Add<HStoreContextSlot>( 12245 HStoreContextSlot* store = Add<HStoreContextSlot>(
12232 context, variable->index(), HStoreContextSlot::kNoCheck, value); 12246 context, variable->index(), HStoreContextSlot::kNoCheck, value);
12233 if (store->HasObservableSideEffects()) { 12247 if (store->HasObservableSideEffects()) {
12234 Add<HSimulate>(proxy->id(), REMOVABLE_SIMULATE); 12248 Add<HSimulate>(proxy->id(), REMOVABLE_SIMULATE);
12235 } 12249 }
12236 break; 12250 break;
12237 } 12251 }
12238 case VariableLocation::LOOKUP: 12252 case VariableLocation::LOOKUP:
12239 return Bailout(kUnsupportedLookupSlotInDeclaration); 12253 return Bailout(kUnsupportedLookupSlotInDeclaration);
12254 case VariableLocation::MODULE:
12255 UNREACHABLE();
12240 } 12256 }
12241 } 12257 }
12242 12258
12243 12259
12244 void HOptimizedGraphBuilder::VisitRewritableExpression( 12260 void HOptimizedGraphBuilder::VisitRewritableExpression(
12245 RewritableExpression* node) { 12261 RewritableExpression* node) {
12246 CHECK_ALIVE(Visit(node->expression())); 12262 CHECK_ALIVE(Visit(node->expression()));
12247 } 12263 }
12248 12264
12249 12265
(...skipping 1171 matching lines...) Expand 10 before | Expand all | Expand 10 after
13421 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); 13437 isolate()->GetHTracer()->TraceHydrogen(name(), graph_);
13422 } 13438 }
13423 13439
13424 #ifdef DEBUG 13440 #ifdef DEBUG
13425 graph_->Verify(false); // No full verify. 13441 graph_->Verify(false); // No full verify.
13426 #endif 13442 #endif
13427 } 13443 }
13428 13444
13429 } // namespace internal 13445 } // namespace internal
13430 } // namespace v8 13446 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698