Lines Matching defs:variable
956 void Put(SlotKind slot_kind, Variable* variable, int slot_index) {
957 PutImpl(slot_kind, 0, variable, slot_index);
970 int Get(SlotKind slot_kind, Variable* variable) const {
971 return GetImpl(slot_kind, 0, variable);
1414 // Build assignment to {new.target} variable if it is used.
1418 // {.generator_object} variable.
1539 Variable* variable = decl->var();
1541 if (!variable->is_used()) return;
1543 switch (variable->location()) {
1548 if (variable->binding_needs_init()) {
1549 Register destination(builder()->Local(variable->index()));
1554 if (variable->binding_needs_init()) {
1555 Register destination(builder()->Parameter(variable->index()));
1563 if (variable->binding_needs_init()) {
1564 DCHECK_EQ(0, execution_context()->ContextChainDepth(variable->scope()));
1566 variable->index(), 0);
1570 DCHECK_EQ(VariableMode::kDynamic, variable->mode());
1571 DCHECK(!variable->binding_needs_init());
1576 ->LoadLiteral(variable->raw_name())
1585 Variable* variable = decl->var();
1586 DCHECK(variable->mode() == VariableMode::kLet ||
1587 variable->mode() == VariableMode::kVar ||
1588 variable->mode() == VariableMode::kDynamic);
1590 if (!variable->is_used()) return;
1592 switch (variable->location()) {
1599 BuildVariableAssignment(variable, Token::INIT, HoleCheckMode::kElided);
1604 DCHECK_EQ(0, execution_context()->ContextChainDepth(variable->scope()));
1606 builder()->StoreContextSlot(execution_context()->reg(), variable->index(),
1613 ->LoadLiteral(variable->raw_name())
2681 // Initialize field's name variable with the computed name.
2706 // Assign to the home object variable. Accumulator already contains the
2724 // Assign to class variable.
2836 // The computed name is already evaluated and stored in a variable at
3520 void BytecodeGenerator::BuildVariableLoad(Variable* variable,
3523 switch (variable->location()) {
3525 Register source(builder()->Local(variable->index()));
3526 // We need to load the variable into the accumulator, even when in a
3528 // subsequent expressions assign to the same variable.
3531 BuildThrowIfHole(variable);
3537 if (variable->IsReceiver()) {
3540 source = builder()->Parameter(variable->index());
3542 // We need to load the variable into the accumulator, even when in a
3544 // subsequent expressions assign to the same variable.
3547 BuildThrowIfHole(variable);
3555 if (variable->raw_name() == ast_string_constants()->undefined_string()) {
3558 FeedbackSlot slot = GetCachedLoadGlobalICSlot(typeof_mode, variable);
3559 builder()->LoadGlobal(variable->raw_name(), feedback_index(slot),
3565 int depth = execution_context()->ContextChainDepth(variable->scope());
3576 (variable->maybe_assigned() == kNotAssigned)
3580 builder()->LoadContextSlot(context_reg, variable->index(), depth,
3583 BuildThrowIfHole(variable);
3588 switch (variable->mode()) {
3590 Variable* local_variable = variable->local_if_not_shadowed();
3593 builder()->LoadLookupContextSlot(variable->raw_name(), typeof_mode,
3596 BuildThrowIfHole(variable);
3606 builder()->LoadLookupGlobalSlot(variable->raw_name(), typeof_mode,
3611 builder()->LoadLookupSlot(variable->raw_name(), typeof_mode);
3616 int depth = execution_context()->ContextChainDepth(variable->scope());
3617 builder()->LoadModuleVariable(variable->index(), depth);
3619 BuildThrowIfHole(variable);
3624 DCHECK(variable->IsReplGlobal());
3625 FeedbackSlot slot = GetCachedLoadGlobalICSlot(typeof_mode, variable);
3626 builder()->LoadGlobal(variable->raw_name(), feedback_index(slot),
3634 Variable* variable, HoleCheckMode hole_check_mode, TypeofMode typeof_mode) {
3636 BuildVariableLoad(variable, hole_check_mode, typeof_mode);
3680 void BytecodeGenerator::BuildThrowIfHole(Variable* variable) {
3681 if (variable->is_this()) {
3682 DCHECK(variable->mode() == VariableMode::kConst);
3685 builder()->ThrowReferenceErrorIfHole(variable->raw_name());
3689 void BytecodeGenerator::BuildHoleCheckForVariableAssignment(Variable* variable,
3691 DCHECK(!IsPrivateMethodOrAccessorVariableMode(variable->mode()));
3692 if (variable->is_this() && variable->mode() == VariableMode::kConst &&
3694 // Perform an initialization check for 'this'. 'this' variable is the
3695 // only variable able to trigger bind operations outside the TDZ
3701 DCHECK(IsLexicalVariableMode(variable->mode()));
3702 BuildThrowIfHole(variable);
3707 Variable* variable, Token::Value op, HoleCheckMode hole_check_mode,
3709 VariableMode mode = variable->mode();
3712 switch (variable->location()) {
3716 if (VariableLocation::PARAMETER == variable->location()) {
3717 if (variable->IsReceiver()) {
3720 destination = builder()->Parameter(variable->index());
3723 destination = builder()->Local(variable->index());
3733 BuildHoleCheckForVariableAssignment(variable, op);
3739 } else if (variable->throw_on_const_assignment(language_mode())) {
3745 BuildStoreGlobal(variable);
3749 int depth = execution_context()->ContextChainDepth(variable->scope());
3765 .LoadContextSlot(context_reg, variable->index(), depth,
3768 BuildHoleCheckForVariableAssignment(variable, op);
3773 builder()->StoreContextSlot(context_reg, variable->index(), depth);
3774 } else if (variable->throw_on_const_assignment(language_mode())) {
3780 builder()->StoreLookupSlot(variable->raw_name(), language_mode(),
3795 DCHECK(variable->IsExport());
3797 int depth = execution_context()->ContextChainDepth(variable->scope());
3802 .LoadModuleVariable(variable->index(), depth);
3803 BuildHoleCheckForVariableAssignment(variable, op);
3806 builder()->StoreModuleVariable(variable->index(), depth);
3821 DCHECK(variable->IsReplGlobal());
3826 .LoadLiteral(variable->raw_name())
3834 BuildStoreGlobal(variable);
3867 void BytecodeGenerator::BuildStoreGlobal(Variable* variable) {
3874 FeedbackSlot slot = GetCachedStoreGlobalICSlot(language_mode(), variable);
3875 builder()->StoreGlobal(variable->raw_name(), feedback_index(slot));
3927 // Left-hand side can only be a property, a global or a variable slot.
5227 // accessed by the debugger at runtime, reference to the class variable
5427 // Load callee as a global variable.
5443 Variable* variable = callee_expr->AsVariableProxy()->var();
5445 ->LoadLiteral(variable->raw_name())
5634 // {new.target} variable.
5657 // implicit binding assignment to the 'this' variable.
5680 // keep the brand variable, so we can just get the brand variable
5778 // perform a non-contextual load in case the operand is a variable proxy.
5878 Variable* variable = expr->AsVariableProxy()->var();
5879 switch (variable->location()) {
5892 // analysis has already proven that the variable doesn't exist in
5899 ->LoadLiteral(variable->raw_name())
5919 // Left-hand side can only be a property, a global or a variable slot.
6862 Variable* variable = scope->receiver();
6864 // Context variable (at bottom of the context chain).
6865 DCHECK_EQ(0, scope->ContextChainLength(variable->scope()));
6867 execution_context()->reg(), variable->index(), 0);
6873 Variable* variable = scope->parameter(i);
6874 if (!variable->IsContextSlot()) continue;
6877 // Context variable (at bottom of the context chain).
6878 DCHECK_EQ(0, scope->ContextChainLength(variable->scope()));
6880 execution_context()->reg(), variable->index(), 0);
6918 void BytecodeGenerator::VisitArgumentsObject(Variable* variable) {
6919 if (variable == nullptr) return;
6921 DCHECK(variable->IsContextSlot() || variable->IsStackAllocated());
6924 // {arguments} variable.
6926 BuildVariableAssignment(variable, Token::ASSIGN, HoleCheckMode::kElided);
6933 // variable.
6939 void BytecodeGenerator::VisitThisFunctionVariable(Variable* variable) {
6940 if (variable == nullptr) return;
6942 // Store the closure we were called with in the given variable.
6944 BuildVariableAssignment(variable, Token::INIT, HoleCheckMode::kElided);
6947 void BytecodeGenerator::VisitNewTargetVariable(Variable* variable) {
6948 if (variable == nullptr) return;
6953 // assign anything to the new.target variable.
6956 if (variable->location() == VariableLocation::LOCAL) {
6959 GetRegisterForLocalVariable(variable).index());
6963 // Store the new target we were called with in the given variable.
6965 BuildVariableAssignment(variable, Token::INIT, HoleCheckMode::kElided);
6987 // The generator object register is already set to the variable's local
7186 Register BytecodeGenerator::GetRegisterForLocalVariable(Variable* variable) {
7187 DCHECK_EQ(VariableLocation::LOCAL, variable->location());
7188 return builder()->Local(variable->index());
7214 TypeofMode typeof_mode, Variable* variable) {
7219 FeedbackSlot slot(feedback_slot_cache()->Get(slot_kind, variable));
7224 feedback_slot_cache()->Put(slot_kind, variable, feedback_index(slot));
7229 LanguageMode language_mode, Variable* variable) {
7234 FeedbackSlot slot(feedback_slot_cache()->Get(slot_kind, variable));
7239 feedback_slot_cache()->Put(slot_kind, variable, feedback_index(slot));