Home | History | Annotate | Download | only in src

Lines Matching defs:variable

22 //       When inserting a new variable via Declare(), we rely on the fact that
23 // the handle location remains alive for the duration of that variable
24 // use. Because a Variable holding a handle with the same location exists
33 Variable* VariableMap::Declare(Scope* scope, const AstRawString* name,
35 Variable::Kind kind,
45 // The variable has not been declared yet -> insert it.
48 Variable(scope, name, mode, is_valid_lhs, kind, initialization_flag,
51 return reinterpret_cast<Variable*>(p->value);
55 Variable* VariableMap::Lookup(const AstRawString* name) {
61 return reinterpret_cast<Variable*>(p->value);
139 Variable* variable = variables_.Declare(this,
143 Variable::NORMAL,
145 AllocateHeapSlot(variable);
266 // scope and start scope resolution and variable allocation from that scope.
317 Variable* var =
322 Variable::THIS,
324 var->AllocateTo(Variable::PARAMETER, -1);
332 // Declare 'arguments' variable which exists in all functions.
334 // allocated during variable allocation.
339 Variable::ARGUMENTS,
375 Variable* Scope::LookupLocal(const AstRawString* name) {
376 Variable* result = variables_.Lookup(name);
384 // If we have a serialized scope info, we might find the variable there.
390 Variable::Location location = Variable::CONTEXT;
401 location = Variable::LOOKUP;
409 Variable* var = variables_.Declare(this, name, mode, true, Variable::NORMAL,
416 Variable* Scope::LookupFunctionVar(const AstRawString* name,
421 // If we are backed by a scope info, try to lookup the variable there.
425 Variable* var = new(zone()) Variable(
427 Variable::NORMAL, kCreatedInitialized);
432 var->AllocateTo(Variable::CONTEXT, index);
440 Variable* Scope::Lookup(const AstRawString* name) {
444 Variable* var = scope->LookupLocal(name);
451 Variable* Scope::DeclareParameter(const AstRawString* name, VariableMode mode) {
454 Variable* var = variables_.Declare(this, name, mode, true, Variable::NORMAL,
461 Variable* Scope::DeclareLocal(const AstRawString* name, VariableMode mode,
467 // introduces during variable allocation, INTERNAL variables are allocated
471 return variables_.Declare(this, name, mode, true, Variable::NORMAL, init_flag,
476 Variable* Scope::DeclareDynamicGlobal(const AstRawString* name) {
482 Variable::NORMAL,
488 // Most likely (always?) any variable we want to remove
499 Variable* Scope::NewInternal(const AstRawString* name) {
501 Variable* var = new(zone()) Variable(this,
505 Variable::NORMAL,
512 Variable* Scope::NewTemporary(const AstRawString* name) {
514 Variable* var = new(zone()) Variable(this,
518 Variable::NORMAL,
557 Variable* other_var = current->variables_.Lookup(name);
571 VarAndOrder(Variable* var, int order) : var_(var), order_(order) { }
572 Variable* var() const { return var_; }
579 Variable* var_;
584 void Scope::CollectStackAndContextLocals(ZoneList<Variable*>* stack_locals,
585 ZoneList<Variable*>* context_locals) {
591 Variable* var = internals_[i];
601 Variable* var = temps_[i];
618 Variable* var = reinterpret_cast<Variable*>(p->value);
626 Variable* var = vars[i].var();
798 static void PrintLocation(Variable* var) {
800 case Variable::UNALLOCATED:
802 case Variable::PARAMETER:
805 case Variable::LOCAL:
808 case Variable::CONTEXT:
811 case Variable::LOOKUP:
818 static void PrintVar(int indent, Variable* var) {
820 Indent(indent, Variable::Mode2String(var->mode()));
842 Variable* var = reinterpret_cast<Variable*>(p->value);
942 Variable* Scope::NonLocal(const AstRawString* name, VariableMode mode) {
945 Variable* var = map->Lookup(name);
954 Variable::NORMAL,
957 var->AllocateTo(Variable::LOOKUP, -1);
963 Variable* Scope::LookupRecursive(VariableProxy* proxy,
968 // Short-cut: if the scope is deserialized from a scope info, variable
974 // Try to find the variable in this scope.
975 Variable* var = LookupLocal(proxy->raw_name());
977 // We found a variable and we are done. (Even if there is an 'eval' in
978 // this scope which introduces the same variable again, the resulting
979 // variable remains the same.)
985 // We did not find a variable locally. Check against the function variable,
986 // if any. We can do this for all scopes, since the function variable is
1003 // The current scope is a with scope, so the variable binding can not be
1006 // the associated variable has to be marked as potentially being accessed
1013 // A variable binding may have been found in an outer scope, but the current
1014 // scope makes a sloppy 'eval' call, so the found variable may not be
1036 // Otherwise, try to resolve the variable.
1038 Variable* var = LookupRecursive(proxy, &binding_kind, factory);
1041 // We found a variable binding.
1045 // We either found a variable binding that might be shadowed by eval or
1054 Variable* invalidated = var;
1061 // No binding has been found. Declare a variable on the global object.
1071 // The variable could not be resolved statically.
1179 bool Scope::MustAllocate(Variable* var) {
1181 // via an eval() call. This is only possible if the variable has a
1200 bool Scope::MustAllocateInContext(Variable* var) {
1233 void Scope::AllocateStackSlot(Variable* var) {
1234 var->AllocateTo(Variable::LOCAL, num_stack_slots_++);
1238 void Scope::AllocateHeapSlot(Variable* var) {
1239 var->AllocateTo(Variable::CONTEXT, num_heap_slots_++);
1245 Variable* arguments = LookupLocal(ast_value_factory_->arguments_string());
1275 Variable* var = params_[i];
1291 var->AllocateTo(Variable::PARAMETER, i);
1299 void Scope::AllocateNonParameterLocal(Variable* var) {
1327 Variable* var = reinterpret_cast<Variable*>(p->value);