Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(855)

Unified Diff: src/ast/variables.cc

Issue 2257493002: Better pack fields in Variable (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Merged master Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« src/ast/variables.h ('K') | « src/ast/variables.h ('k') | src/globals.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ast/variables.cc
diff --git a/src/ast/variables.cc b/src/ast/variables.cc
index 0541f942f0949fbe4642cb07f752216114a8ef74..703e3318c6e560c80508e3aac49cc2283420c85c 100644
--- a/src/ast/variables.cc
+++ b/src/ast/variables.cc
@@ -33,16 +33,15 @@ Variable::Variable(Scope* scope, const AstRawString* name, VariableMode mode,
MaybeAssignedFlag maybe_assigned_flag)
: scope_(scope),
name_(name),
- mode_(mode),
- kind_(kind),
- location_(VariableLocation::UNALLOCATED),
+ local_if_not_shadowed_(nullptr),
index_(-1),
initializer_position_(kNoSourcePosition),
- local_if_not_shadowed_(NULL),
- force_context_allocation_(false),
- is_used_(false),
- initialization_flag_(initialization_flag),
- maybe_assigned_(maybe_assigned_flag) {
+ bit_field_(MaybeAssignedFlagField::encode(maybe_assigned_flag) |
+ InitializationFlagField::encode(initialization_flag) |
+ VariableModeField::encode(mode) | IsUsedField::encode(false) |
+ ForceContextAllocationField::encode(false) |
+ LocationField::encode(VariableLocation::UNALLOCATED) |
+ KindField::encode(kind)) {
// Var declared variables never need initialization.
DCHECK(!(mode == VAR && initialization_flag == kNeedsInitialization));
}
@@ -51,8 +50,8 @@ Variable::Variable(Scope* scope, const AstRawString* name, VariableMode mode,
bool Variable::IsGlobalObjectProperty() const {
// Temporaries are never global, they must always be allocated in the
// activation frame.
- return (IsDynamicVariableMode(mode_) ||
- (IsDeclaredVariableMode(mode_) && !IsLexicalVariableMode(mode_))) &&
+ return (IsDynamicVariableMode(mode()) ||
+ (IsDeclaredVariableMode(mode()) && !IsLexicalVariableMode(mode()))) &&
scope_ != NULL && scope_->is_script_scope();
}
@@ -60,7 +59,7 @@ bool Variable::IsGlobalObjectProperty() const {
bool Variable::IsStaticGlobalObjectProperty() const {
// Temporaries are never global, they must always be allocated in the
// activation frame.
- return (IsDeclaredVariableMode(mode_) && !IsLexicalVariableMode(mode_)) &&
+ return (IsDeclaredVariableMode(mode()) && !IsLexicalVariableMode(mode())) &&
scope_ != NULL && scope_->is_script_scope();
}
« src/ast/variables.h ('K') | « src/ast/variables.h ('k') | src/globals.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698