OLD | NEW |
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 5747 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5758 mode = HLoadContextSlot::kNoCheck; | 5758 mode = HLoadContextSlot::kNoCheck; |
5759 break; | 5759 break; |
5760 } | 5760 } |
5761 HLoadContextSlot* instr = | 5761 HLoadContextSlot* instr = |
5762 new(zone()) HLoadContextSlot(context, variable->index(), mode); | 5762 new(zone()) HLoadContextSlot(context, variable->index(), mode); |
5763 return ast_context()->ReturnInstruction(instr, expr->id()); | 5763 return ast_context()->ReturnInstruction(instr, expr->id()); |
5764 } | 5764 } |
5765 | 5765 |
5766 case VariableLocation::LOOKUP: | 5766 case VariableLocation::LOOKUP: |
5767 return Bailout(kReferenceToAVariableWhichRequiresDynamicLookup); | 5767 return Bailout(kReferenceToAVariableWhichRequiresDynamicLookup); |
| 5768 |
| 5769 case VariableLocation::MODULE: |
| 5770 UNREACHABLE(); |
5768 } | 5771 } |
5769 } | 5772 } |
5770 | 5773 |
5771 | 5774 |
5772 void HOptimizedGraphBuilder::VisitLiteral(Literal* expr) { | 5775 void HOptimizedGraphBuilder::VisitLiteral(Literal* expr) { |
5773 DCHECK(!HasStackOverflow()); | 5776 DCHECK(!HasStackOverflow()); |
5774 DCHECK(current_block() != NULL); | 5777 DCHECK(current_block() != NULL); |
5775 DCHECK(current_block()->HasPredecessor()); | 5778 DCHECK(current_block()->HasPredecessor()); |
5776 HConstant* instr = New<HConstant>(expr->value()); | 5779 HConstant* instr = New<HConstant>(expr->value()); |
5777 return ast_context()->ReturnInstruction(instr, expr->id()); | 5780 return ast_context()->ReturnInstruction(instr, expr->id()); |
(...skipping 1222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7000 HStoreContextSlot* instr = Add<HStoreContextSlot>( | 7003 HStoreContextSlot* instr = Add<HStoreContextSlot>( |
7001 context, var->index(), mode, Top()); | 7004 context, var->index(), mode, Top()); |
7002 if (instr->HasObservableSideEffects()) { | 7005 if (instr->HasObservableSideEffects()) { |
7003 Add<HSimulate>(expr->AssignmentId(), REMOVABLE_SIMULATE); | 7006 Add<HSimulate>(expr->AssignmentId(), REMOVABLE_SIMULATE); |
7004 } | 7007 } |
7005 break; | 7008 break; |
7006 } | 7009 } |
7007 | 7010 |
7008 case VariableLocation::LOOKUP: | 7011 case VariableLocation::LOOKUP: |
7009 return Bailout(kCompoundAssignmentToLookupSlot); | 7012 return Bailout(kCompoundAssignmentToLookupSlot); |
| 7013 |
| 7014 case VariableLocation::MODULE: |
| 7015 UNREACHABLE(); |
7010 } | 7016 } |
7011 return ast_context()->ReturnValue(Pop()); | 7017 return ast_context()->ReturnValue(Pop()); |
7012 | 7018 |
7013 } else if (prop != NULL) { | 7019 } else if (prop != NULL) { |
7014 CHECK_ALIVE(VisitForValue(prop->obj())); | 7020 CHECK_ALIVE(VisitForValue(prop->obj())); |
7015 HValue* object = Top(); | 7021 HValue* object = Top(); |
7016 HValue* key = NULL; | 7022 HValue* key = NULL; |
7017 if (!prop->key()->IsPropertyName() || prop->IsStringAccess()) { | 7023 if (!prop->key()->IsPropertyName() || prop->IsStringAccess()) { |
7018 CHECK_ALIVE(VisitForValue(prop->key())); | 7024 CHECK_ALIVE(VisitForValue(prop->key())); |
7019 key = Top(); | 7025 key = Top(); |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7148 HStoreContextSlot* instr = Add<HStoreContextSlot>( | 7154 HStoreContextSlot* instr = Add<HStoreContextSlot>( |
7149 context, var->index(), mode, Top()); | 7155 context, var->index(), mode, Top()); |
7150 if (instr->HasObservableSideEffects()) { | 7156 if (instr->HasObservableSideEffects()) { |
7151 Add<HSimulate>(expr->AssignmentId(), REMOVABLE_SIMULATE); | 7157 Add<HSimulate>(expr->AssignmentId(), REMOVABLE_SIMULATE); |
7152 } | 7158 } |
7153 return ast_context()->ReturnValue(Pop()); | 7159 return ast_context()->ReturnValue(Pop()); |
7154 } | 7160 } |
7155 | 7161 |
7156 case VariableLocation::LOOKUP: | 7162 case VariableLocation::LOOKUP: |
7157 return Bailout(kAssignmentToLOOKUPVariable); | 7163 return Bailout(kAssignmentToLOOKUPVariable); |
| 7164 |
| 7165 case VariableLocation::MODULE: |
| 7166 UNREACHABLE(); |
7158 } | 7167 } |
7159 } else { | 7168 } else { |
7160 return Bailout(kInvalidLeftHandSideInAssignment); | 7169 return Bailout(kInvalidLeftHandSideInAssignment); |
7161 } | 7170 } |
7162 } | 7171 } |
7163 | 7172 |
7164 | 7173 |
7165 void HOptimizedGraphBuilder::VisitYield(Yield* expr) { | 7174 void HOptimizedGraphBuilder::VisitYield(Yield* expr) { |
7166 // Generators are not optimized, so we should never get here. | 7175 // Generators are not optimized, so we should never get here. |
7167 UNREACHABLE(); | 7176 UNREACHABLE(); |
(...skipping 3626 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10794 HStoreContextSlot* instr = Add<HStoreContextSlot>(context, var->index(), | 10803 HStoreContextSlot* instr = Add<HStoreContextSlot>(context, var->index(), |
10795 mode, after); | 10804 mode, after); |
10796 if (instr->HasObservableSideEffects()) { | 10805 if (instr->HasObservableSideEffects()) { |
10797 Add<HSimulate>(expr->AssignmentId(), REMOVABLE_SIMULATE); | 10806 Add<HSimulate>(expr->AssignmentId(), REMOVABLE_SIMULATE); |
10798 } | 10807 } |
10799 break; | 10808 break; |
10800 } | 10809 } |
10801 | 10810 |
10802 case VariableLocation::LOOKUP: | 10811 case VariableLocation::LOOKUP: |
10803 return Bailout(kLookupVariableInCountOperation); | 10812 return Bailout(kLookupVariableInCountOperation); |
| 10813 |
| 10814 case VariableLocation::MODULE: |
| 10815 UNREACHABLE(); |
10804 } | 10816 } |
10805 | 10817 |
10806 Drop(returns_original_input ? 2 : 1); | 10818 Drop(returns_original_input ? 2 : 1); |
10807 return ast_context()->ReturnValue(expr->is_postfix() ? input : after); | 10819 return ast_context()->ReturnValue(expr->is_postfix() ? input : after); |
10808 } | 10820 } |
10809 | 10821 |
10810 // Argument of the count operation is a property. | 10822 // Argument of the count operation is a property. |
10811 DCHECK(prop != NULL); | 10823 DCHECK(prop != NULL); |
10812 if (returns_original_input) Push(graph()->GetConstantUndefined()); | 10824 if (returns_original_input) Push(graph()->GetConstantUndefined()); |
10813 | 10825 |
(...skipping 1371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12185 HValue* context = environment()->context(); | 12197 HValue* context = environment()->context(); |
12186 HStoreContextSlot* store = Add<HStoreContextSlot>( | 12198 HStoreContextSlot* store = Add<HStoreContextSlot>( |
12187 context, variable->index(), HStoreContextSlot::kNoCheck, value); | 12199 context, variable->index(), HStoreContextSlot::kNoCheck, value); |
12188 if (store->HasObservableSideEffects()) { | 12200 if (store->HasObservableSideEffects()) { |
12189 Add<HSimulate>(proxy->id(), REMOVABLE_SIMULATE); | 12201 Add<HSimulate>(proxy->id(), REMOVABLE_SIMULATE); |
12190 } | 12202 } |
12191 } | 12203 } |
12192 break; | 12204 break; |
12193 case VariableLocation::LOOKUP: | 12205 case VariableLocation::LOOKUP: |
12194 return Bailout(kUnsupportedLookupSlotInDeclaration); | 12206 return Bailout(kUnsupportedLookupSlotInDeclaration); |
| 12207 case VariableLocation::MODULE: |
| 12208 UNREACHABLE(); |
12195 } | 12209 } |
12196 } | 12210 } |
12197 | 12211 |
12198 | 12212 |
12199 void HOptimizedGraphBuilder::VisitFunctionDeclaration( | 12213 void HOptimizedGraphBuilder::VisitFunctionDeclaration( |
12200 FunctionDeclaration* declaration) { | 12214 FunctionDeclaration* declaration) { |
12201 VariableProxy* proxy = declaration->proxy(); | 12215 VariableProxy* proxy = declaration->proxy(); |
12202 Variable* variable = proxy->var(); | 12216 Variable* variable = proxy->var(); |
12203 switch (variable->location()) { | 12217 switch (variable->location()) { |
12204 case VariableLocation::GLOBAL: | 12218 case VariableLocation::GLOBAL: |
(...skipping 21 matching lines...) Expand all Loading... |
12226 HValue* context = environment()->context(); | 12240 HValue* context = environment()->context(); |
12227 HStoreContextSlot* store = Add<HStoreContextSlot>( | 12241 HStoreContextSlot* store = Add<HStoreContextSlot>( |
12228 context, variable->index(), HStoreContextSlot::kNoCheck, value); | 12242 context, variable->index(), HStoreContextSlot::kNoCheck, value); |
12229 if (store->HasObservableSideEffects()) { | 12243 if (store->HasObservableSideEffects()) { |
12230 Add<HSimulate>(proxy->id(), REMOVABLE_SIMULATE); | 12244 Add<HSimulate>(proxy->id(), REMOVABLE_SIMULATE); |
12231 } | 12245 } |
12232 break; | 12246 break; |
12233 } | 12247 } |
12234 case VariableLocation::LOOKUP: | 12248 case VariableLocation::LOOKUP: |
12235 return Bailout(kUnsupportedLookupSlotInDeclaration); | 12249 return Bailout(kUnsupportedLookupSlotInDeclaration); |
| 12250 case VariableLocation::MODULE: |
| 12251 UNREACHABLE(); |
12236 } | 12252 } |
12237 } | 12253 } |
12238 | 12254 |
12239 | 12255 |
12240 void HOptimizedGraphBuilder::VisitRewritableExpression( | 12256 void HOptimizedGraphBuilder::VisitRewritableExpression( |
12241 RewritableExpression* node) { | 12257 RewritableExpression* node) { |
12242 CHECK_ALIVE(Visit(node->expression())); | 12258 CHECK_ALIVE(Visit(node->expression())); |
12243 } | 12259 } |
12244 | 12260 |
12245 | 12261 |
(...skipping 1171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13417 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 13433 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
13418 } | 13434 } |
13419 | 13435 |
13420 #ifdef DEBUG | 13436 #ifdef DEBUG |
13421 graph_->Verify(false); // No full verify. | 13437 graph_->Verify(false); // No full verify. |
13422 #endif | 13438 #endif |
13423 } | 13439 } |
13424 | 13440 |
13425 } // namespace internal | 13441 } // namespace internal |
13426 } // namespace v8 | 13442 } // namespace v8 |
OLD | NEW |