| 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 12144 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 12155     Handle<TypeFeedbackVector> vector(current_feedback_vector(), isolate()); | 12155     Handle<TypeFeedbackVector> vector(current_feedback_vector(), isolate()); | 
| 12156     Add<HDeclareGlobals>(array, flags, vector); | 12156     Add<HDeclareGlobals>(array, flags, vector); | 
| 12157     globals_.Rewind(0); | 12157     globals_.Rewind(0); | 
| 12158   } | 12158   } | 
| 12159 } | 12159 } | 
| 12160 | 12160 | 
| 12161 | 12161 | 
| 12162 void HOptimizedGraphBuilder::VisitVariableDeclaration( | 12162 void HOptimizedGraphBuilder::VisitVariableDeclaration( | 
| 12163     VariableDeclaration* declaration) { | 12163     VariableDeclaration* declaration) { | 
| 12164   VariableProxy* proxy = declaration->proxy(); | 12164   VariableProxy* proxy = declaration->proxy(); | 
| 12165   VariableMode mode = declaration->mode(); |  | 
| 12166   Variable* variable = proxy->var(); | 12165   Variable* variable = proxy->var(); | 
| 12167   bool hole_init = mode == LET || mode == CONST; |  | 
| 12168   switch (variable->location()) { | 12166   switch (variable->location()) { | 
| 12169     case VariableLocation::GLOBAL: | 12167     case VariableLocation::GLOBAL: | 
| 12170     case VariableLocation::UNALLOCATED: { | 12168     case VariableLocation::UNALLOCATED: { | 
| 12171       DCHECK(!variable->binding_needs_init()); | 12169       DCHECK(!variable->binding_needs_init()); | 
| 12172       FeedbackVectorSlot slot = proxy->VariableFeedbackSlot(); | 12170       FeedbackVectorSlot slot = proxy->VariableFeedbackSlot(); | 
| 12173       DCHECK(!slot.IsInvalid()); | 12171       DCHECK(!slot.IsInvalid()); | 
| 12174       globals_.Add(handle(Smi::FromInt(slot.ToInt()), isolate()), zone()); | 12172       globals_.Add(handle(Smi::FromInt(slot.ToInt()), isolate()), zone()); | 
| 12175       globals_.Add(isolate()->factory()->undefined_value(), zone()); | 12173       globals_.Add(isolate()->factory()->undefined_value(), zone()); | 
| 12176       return; | 12174       return; | 
| 12177     } | 12175     } | 
| 12178     case VariableLocation::PARAMETER: | 12176     case VariableLocation::PARAMETER: | 
| 12179     case VariableLocation::LOCAL: | 12177     case VariableLocation::LOCAL: | 
| 12180       if (hole_init) { | 12178       if (variable->binding_needs_init()) { | 
| 12181         HValue* value = graph()->GetConstantHole(); | 12179         HValue* value = graph()->GetConstantHole(); | 
| 12182         environment()->Bind(variable, value); | 12180         environment()->Bind(variable, value); | 
| 12183       } | 12181       } | 
| 12184       break; | 12182       break; | 
| 12185     case VariableLocation::CONTEXT: | 12183     case VariableLocation::CONTEXT: | 
| 12186       if (hole_init) { | 12184       if (variable->binding_needs_init()) { | 
| 12187         HValue* value = graph()->GetConstantHole(); | 12185         HValue* value = graph()->GetConstantHole(); | 
| 12188         HValue* context = environment()->context(); | 12186         HValue* context = environment()->context(); | 
| 12189         HStoreContextSlot* store = Add<HStoreContextSlot>( | 12187         HStoreContextSlot* store = Add<HStoreContextSlot>( | 
| 12190             context, variable->index(), HStoreContextSlot::kNoCheck, value); | 12188             context, variable->index(), HStoreContextSlot::kNoCheck, value); | 
| 12191         if (store->HasObservableSideEffects()) { | 12189         if (store->HasObservableSideEffects()) { | 
| 12192           Add<HSimulate>(proxy->id(), REMOVABLE_SIMULATE); | 12190           Add<HSimulate>(proxy->id(), REMOVABLE_SIMULATE); | 
| 12193         } | 12191         } | 
| 12194       } | 12192       } | 
| 12195       break; | 12193       break; | 
| 12196     case VariableLocation::LOOKUP: | 12194     case VariableLocation::LOOKUP: | 
| (...skipping 1223 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 13420     isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 13418     isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 
| 13421   } | 13419   } | 
| 13422 | 13420 | 
| 13423 #ifdef DEBUG | 13421 #ifdef DEBUG | 
| 13424   graph_->Verify(false);  // No full verify. | 13422   graph_->Verify(false);  // No full verify. | 
| 13425 #endif | 13423 #endif | 
| 13426 } | 13424 } | 
| 13427 | 13425 | 
| 13428 }  // namespace internal | 13426 }  // namespace internal | 
| 13429 }  // namespace v8 | 13427 }  // namespace v8 | 
| OLD | NEW | 
|---|