Lines Matching refs:var

52 void VariableMap::Remove(Variable* var) {  in Remove()  argument
53 const AstRawString* name = var->raw_name(); in Remove()
57 void VariableMap::Add(Zone* zone, Variable* var) { in Add() argument
58 const AstRawString* name = var->raw_name(); in Add()
64 p->value = var; in Add()
475 Variable* var = nullptr; in HoistSloppyBlockFunctions() local
484 var = query_scope->LookupLocal(name); in HoistSloppyBlockFunctions()
485 if (var != nullptr && IsLexicalVariableMode(var->mode())) { in HoistSloppyBlockFunctions()
581 Variable* var = Declare( in DeclareThis() local
585 receiver_ = var; in DeclareThis()
711 void DeclarationScope::AddLocal(Variable* var) { in AddLocal() argument
715 locals_.Add(var); in AddLocal()
723 Variable* var = in Declare() local
726 if (added) locals_.Add(var); in Declare()
727 return var; in Declare()
835 Variable* var = AsDeclarationScope()->DeclareFunctionVar(name); in LookupInScopeInfo() local
836 DCHECK_EQ(CONST, var->mode()); in LookupInScopeInfo()
837 var->AllocateTo(VariableLocation::CONTEXT, index); in LookupInScopeInfo()
849 Variable* var = variables_.Declare(zone(), this, name, mode, kind, init_flag, in LookupInScopeInfo() local
851 var->AllocateTo(location, index); in LookupInScopeInfo()
852 return var; in LookupInScopeInfo()
859 Variable* var = scope->LookupLocal(name); in Lookup() local
860 if (var != NULL) return var; in Lookup()
872 Variable* var; in DeclareParameter() local
874 var = NewTemporary(name); in DeclareParameter()
876 var = in DeclareParameter()
882 params_.Add(var, zone()); in DeclareParameter()
886 return var; in DeclareParameter()
923 Variable* var = nullptr; in DeclareVariable() local
931 var = new (zone()) Variable(this, name, mode, kind, init, kNotAssigned); in DeclareVariable()
932 var->AllocateTo(VariableLocation::LOOKUP, -1); in DeclareVariable()
935 var = LookupLocal(name); in DeclareVariable()
936 if (var == NULL) { in DeclareVariable()
942 var = DeclareLocal(name, mode, init, kind, kNotAssigned); in DeclareVariable()
944 IsLexicalVariableMode(var->mode())) { in DeclareVariable()
948 var->is_function()) { in DeclareVariable()
950 IsLexicalVariableMode(var->mode())); in DeclareVariable()
979 DCHECK(IsDeclaredVariableMode(var->mode())); in DeclareVariable()
986 var->set_maybe_assigned(); in DeclareVariable()
989 DCHECK_NOT_NULL(var); in DeclareVariable()
1001 proxy->BindTo(var); in DeclareVariable()
1002 return var; in DeclareVariable()
1034 bool Scope::RemoveUnresolved(VariableProxy* var) { in RemoveUnresolved() argument
1035 if (unresolved_ == var) { in RemoveUnresolved()
1036 unresolved_ = var->next_unresolved(); in RemoveUnresolved()
1037 var->set_next_unresolved(nullptr); in RemoveUnresolved()
1043 if (var == next) { in RemoveUnresolved()
1045 var->set_next_unresolved(nullptr); in RemoveUnresolved()
1075 Variable* var = new (zone()) in NewTemporary() local
1077 scope->AddLocal(var); in NewTemporary()
1078 return var; in NewTemporary()
1083 VariableMode mode = decl->proxy()->var()->mode(); in CheckConflictingVarDeclarations()
1112 Variable* var = LookupLocal(names.at(i)); in CheckLexDeclarationsConflictingWith() local
1113 if (var != nullptr) { in CheckLexDeclarationsConflictingWith()
1115 DCHECK(IsLexicalVariableMode(var->mode())); in CheckLexDeclarationsConflictingWith()
1373 static void PrintLocation(Variable* var) { in PrintLocation() argument
1374 switch (var->location()) { in PrintLocation()
1378 PrintF("parameter[%d]", var->index()); in PrintLocation()
1381 PrintF("local[%d]", var->index()); in PrintLocation()
1384 PrintF("context[%d]", var->index()); in PrintLocation()
1396 static void PrintVar(int indent, Variable* var) { in PrintVar() argument
1397 if (var->is_used() || !var->IsUnallocated()) { in PrintVar()
1398 Indent(indent, VariableMode2String(var->mode())); in PrintVar()
1400 if (var->raw_name()->IsEmpty()) in PrintVar()
1401 PrintF(".%p", reinterpret_cast<void*>(var)); in PrintVar()
1403 PrintName(var->raw_name()); in PrintVar()
1405 PrintLocation(var); in PrintVar()
1406 bool comma = !var->IsUnallocated(); in PrintVar()
1407 if (var->has_forced_context_allocation()) { in PrintVar()
1412 if (var->maybe_assigned() == kNotAssigned) { in PrintVar()
1422 Variable* var = reinterpret_cast<Variable*>(p->value); in PrintMap() local
1423 bool local = !IsDynamicVariableMode(var->mode()); in PrintMap()
1425 if (var == nullptr) { in PrintMap()
1428 PrintVar(indent, var); in PrintMap()
1551 Variable* var = variables_.Declare(zone(), NULL, name, mode, NORMAL_VARIABLE, in NonLocal() local
1554 var->AllocateTo(VariableLocation::LOOKUP, -1); in NonLocal()
1555 return var; in NonLocal()
1570 Variable* var = LookupLocal(proxy->raw_name()); in LookupRecursive() local
1575 if (var != nullptr) return var; in LookupRecursive()
1588 var = outer_scope_->LookupRecursive(proxy, outer_scope_end); in LookupRecursive()
1591 if (var == nullptr) return var; in LookupRecursive()
1593 if (is_function_scope() && !var->is_dynamic()) { in LookupRecursive()
1594 var->ForceContextAllocation(); in LookupRecursive()
1599 if (var->is_this()) return var; in LookupRecursive()
1608 if (!var->is_dynamic() && var->IsUnallocated()) { in LookupRecursive()
1610 var->set_is_used(); in LookupRecursive()
1611 var->ForceContextAllocation(); in LookupRecursive()
1612 if (proxy->is_assigned()) var->set_maybe_assigned(); in LookupRecursive()
1625 if (var->IsGlobalObjectProperty()) { in LookupRecursive()
1629 if (var->is_dynamic()) return var; in LookupRecursive()
1631 Variable* invalidated = var; in LookupRecursive()
1632 var = NonLocal(proxy->raw_name(), DYNAMIC_LOCAL); in LookupRecursive()
1633 var->set_local_if_not_shadowed(invalidated); in LookupRecursive()
1636 return var; in LookupRecursive()
1642 Variable* var = LookupRecursive(proxy, nullptr); in ResolveVariable() local
1643 ResolveTo(info, proxy, var); in ResolveVariable()
1651 var = scope->LookupLocal(proxy->raw_name()); in ResolveVariable()
1652 if (var != nullptr) { in ResolveVariable()
1655 if (!var->is_dynamic() && !var->is_this() && in ResolveVariable()
1656 !var->has_forced_context_allocation()) { in ResolveVariable()
1657 var->ForceContextAllocation(); in ResolveVariable()
1658 var->set_is_used(); in ResolveVariable()
1661 var->set_maybe_assigned(); in ResolveVariable()
1671 bool AccessNeedsHoleCheck(Variable* var, VariableProxy* proxy, Scope* scope) { in AccessNeedsHoleCheck() argument
1672 if (!var->binding_needs_init()) { in AccessNeedsHoleCheck()
1679 if (var->location() == VariableLocation::MODULE && !var->IsExport()) { in AccessNeedsHoleCheck()
1701 if (var->scope()->GetDeclarationScope() != scope->GetDeclarationScope()) { in AccessNeedsHoleCheck()
1705 if (var->is_this()) { in AccessNeedsHoleCheck()
1713 DCHECK(var->initializer_position() != kNoSourcePosition); in AccessNeedsHoleCheck()
1716 return var->scope()->is_nonlinear() || in AccessNeedsHoleCheck()
1717 var->initializer_position() >= proxy->position(); in AccessNeedsHoleCheck()
1722 void Scope::ResolveTo(ParseInfo* info, VariableProxy* proxy, Variable* var) { in ResolveTo() argument
1729 if (var->IsGlobalObjectProperty()) { in ResolveTo()
1736 VariableLocation location = var->location(); in ResolveTo()
1744 DCHECK_NOT_NULL(var); in ResolveTo()
1745 if (proxy->is_assigned()) var->set_maybe_assigned(); in ResolveTo()
1746 if (AccessNeedsHoleCheck(var, proxy, this)) proxy->set_needs_hole_check(); in ResolveTo()
1747 proxy->BindTo(var); in ResolveTo()
1772 Variable* var = nullptr; in FetchFreeVariables() local
1774 var = LookupRecursive(proxy, max_outer_scope->outer_scope()); in FetchFreeVariables()
1776 if (var == nullptr) { in FetchFreeVariables()
1780 ResolveTo(info, proxy, var); in FetchFreeVariables()
1782 var->set_is_used(); in FetchFreeVariables()
1797 bool Scope::MustAllocate(Variable* var) { in MustAllocate() argument
1798 DCHECK(var->location() != VariableLocation::MODULE); in MustAllocate()
1802 if ((var->is_this() || !var->raw_name()->IsEmpty()) && in MustAllocate()
1804 var->set_is_used(); in MustAllocate()
1805 if (inner_scope_calls_eval_) var->set_maybe_assigned(); in MustAllocate()
1807 DCHECK(!var->has_forced_context_allocation() || var->is_used()); in MustAllocate()
1809 return !var->IsGlobalObjectProperty() && var->is_used(); in MustAllocate()
1813 bool Scope::MustAllocateInContext(Variable* var) { in MustAllocateInContext() argument
1824 if (var->mode() == TEMPORARY) return false; in MustAllocateInContext()
1826 if (is_script_scope() && IsLexicalVariableMode(var->mode())) return true; in MustAllocateInContext()
1827 return var->has_forced_context_allocation() || inner_scope_calls_eval_; in MustAllocateInContext()
1831 void Scope::AllocateStackSlot(Variable* var) { in AllocateStackSlot() argument
1833 outer_scope()->GetDeclarationScope()->AllocateStackSlot(var); in AllocateStackSlot()
1835 var->AllocateTo(VariableLocation::LOCAL, num_stack_slots_++); in AllocateStackSlot()
1840 void Scope::AllocateHeapSlot(Variable* var) { in AllocateHeapSlot() argument
1841 var->AllocateTo(VariableLocation::CONTEXT, num_heap_slots_++); in AllocateHeapSlot()
1878 Variable* var = params_[i]; in AllocateParameterLocals() local
1879 DCHECK(!has_rest_ || var != rest_parameter()); in AllocateParameterLocals()
1880 DCHECK_EQ(this, var->scope()); in AllocateParameterLocals()
1882 var->set_is_used(); in AllocateParameterLocals()
1883 var->ForceContextAllocation(); in AllocateParameterLocals()
1885 AllocateParameter(var, i); in AllocateParameterLocals()
1889 void DeclarationScope::AllocateParameter(Variable* var, int index) { in AllocateParameter() argument
1890 if (MustAllocate(var)) { in AllocateParameter()
1891 if (MustAllocateInContext(var)) { in AllocateParameter()
1892 DCHECK(var->IsUnallocated() || var->IsContextSlot()); in AllocateParameter()
1893 if (var->IsUnallocated()) { in AllocateParameter()
1894 AllocateHeapSlot(var); in AllocateParameter()
1897 DCHECK(var->IsUnallocated() || var->IsParameter()); in AllocateParameter()
1898 if (var->IsUnallocated()) { in AllocateParameter()
1899 var->AllocateTo(VariableLocation::PARAMETER, index); in AllocateParameter()
1912 void Scope::AllocateNonParameterLocal(Variable* var) { in AllocateNonParameterLocal() argument
1913 DCHECK(var->scope() == this); in AllocateNonParameterLocal()
1914 if (var->IsUnallocated() && MustAllocate(var)) { in AllocateNonParameterLocal()
1915 if (MustAllocateInContext(var)) { in AllocateNonParameterLocal()
1916 AllocateHeapSlot(var); in AllocateNonParameterLocal()
1918 AllocateStackSlot(var); in AllocateNonParameterLocal()
1956 Variable* var = LookupLocal(it.first); in AllocateModuleVariables() local
1957 var->AllocateTo(VariableLocation::MODULE, it.second->cell_index); in AllocateModuleVariables()
1958 DCHECK(!var->IsExport()); in AllocateModuleVariables()
1962 Variable* var = LookupLocal(it.first); in AllocateModuleVariables() local
1963 var->AllocateTo(VariableLocation::MODULE, it.second->cell_index); in AllocateModuleVariables()
1964 DCHECK(var->IsExport()); in AllocateModuleVariables()