v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
variables.cc
Go to the documentation of this file.
1// Copyright 2011 the V8 project authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#include "src/ast/variables.h"
6
7#include "src/ast/scopes.h"
9
10namespace v8 {
11namespace internal {
12
13// ----------------------------------------------------------------------------
14// Implementation Variable.
15
16Variable::Variable(Variable* other)
17 : scope_(other->scope_),
18 name_(other->name_),
19 local_if_not_shadowed_(nullptr),
20 next_(nullptr),
21 index_(other->index_),
22 initializer_position_(other->initializer_position_),
23 bit_field_(other->bit_field_) {}
24
25bool Variable::IsGlobalObjectProperty() const {
26 // Temporaries are never global, they must always be allocated in the
27 // activation frame.
29 scope_ != nullptr && scope_->is_script_scope();
30}
31
32bool Variable::IsReplGlobal() const {
33 return scope()->is_repl_mode_scope() &&
37}
38
49
50void Variable::AssignHoleCheckBitmapIndex(ZoneVector<Variable*>& list,
51 uint8_t next_index) {
52 DCHECK_EQ(next_index, list.size() + 1);
57 list.push_back(this);
58}
59
60} // namespace internal
61} // namespace v8
uint32_t bit_field_
static V8_NODISCARD constexpr U update(U previous, T value)
Definition bit-field.h:61
bool is_repl_mode_scope() const
Definition scopes.h:610
bool is_script_scope() const
Definition scopes.h:364
VariableMode mode() const
Definition variables.h:66
static constexpr uint8_t kUncacheableHoleCheckBitmapIndex
Definition variables.h:216
uint16_t hole_check_analysis_bit_field_
Definition variables.h:335
VariableLocation location() const
Definition variables.h:276
static constexpr uint8_t kHoleCheckBitmapBits
Definition variables.h:217
Scope * scope() const
Definition variables.h:58
void push_back(const T &value)
Register const index_
DeclarationScope * scope_
const char * name_
bool IsDynamicVariableMode(VariableMode mode)
Definition globals.h:2116
#define DCHECK_NE(v1, v2)
Definition logging.h:486
#define DCHECK(condition)
Definition logging.h:482
#define DCHECK_LT(v1, v2)
Definition logging.h:489
#define DCHECK_EQ(v1, v2)
Definition logging.h:485