Commit e7ccf0c2 authored by hablich's avatar hablich Committed by Commit bot

Revert of Better pack fields in Variable (patchset #1 id:1 of...

Revert of Better pack fields in Variable (patchset #1 id:1 of https://codereview.chromium.org/2253513002/ )

Reason for revert:
Revert: Breaks ARM build: https://uberchromegw.corp.google.com/i/client.v8.ports/builders/V8%20Arm%20-%20builder/builds/2999

Original issue's description:
> Better pack fields in Variable
>
> This reduces sizeof(Variable) from 64 to 40 on x64
>
> BUG=v8:5209
>
> Committed: https://crrev.com/d84343568047c8621a6b8f88f20a7f34586321b8
> Cr-Commit-Position: refs/heads/master@{#38659}

TBR=marja@chromium.org,jkummerow@chromium.org,verwaest@chromium.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=v8:5209

Review-Url: https://codereview.chromium.org/2249203002
Cr-Commit-Position: refs/heads/master@{#38666}
parent 95db63ab
...@@ -34,12 +34,12 @@ Variable::Variable(Scope* scope, const AstRawString* name, VariableMode mode, ...@@ -34,12 +34,12 @@ Variable::Variable(Scope* scope, const AstRawString* name, VariableMode mode,
MaybeAssignedFlag maybe_assigned_flag) MaybeAssignedFlag maybe_assigned_flag)
: scope_(scope), : scope_(scope),
name_(name), name_(name),
local_if_not_shadowed_(nullptr),
index_(-1),
initializer_position_(kNoSourcePosition),
mode_(mode), mode_(mode),
kind_(kind), kind_(kind),
location_(VariableLocation::UNALLOCATED), location_(VariableLocation::UNALLOCATED),
index_(-1),
initializer_position_(kNoSourcePosition),
local_if_not_shadowed_(NULL),
force_context_allocation_(false), force_context_allocation_(false),
is_used_(false), is_used_(false),
initialization_flag_(initialization_flag), initialization_flag_(initialization_flag),
......
...@@ -17,13 +17,7 @@ namespace internal { ...@@ -17,13 +17,7 @@ namespace internal {
// after binding and variable allocation. // after binding and variable allocation.
class Variable final : public ZoneObject { class Variable final : public ZoneObject {
public: public:
enum Kind : uint8_t { enum Kind { NORMAL, FUNCTION, THIS, ARGUMENTS };
NORMAL,
FUNCTION,
THIS,
ARGUMENTS,
kLastKind = ARGUMENTS
};
Variable(Scope* scope, const AstRawString* name, VariableMode mode, Kind kind, Variable(Scope* scope, const AstRawString* name, VariableMode mode, Kind kind,
InitializationFlag initialization_flag, InitializationFlag initialization_flag,
...@@ -111,27 +105,23 @@ class Variable final : public ZoneObject { ...@@ -111,27 +105,23 @@ class Variable final : public ZoneObject {
private: private:
Scope* scope_; Scope* scope_;
const AstRawString* name_; const AstRawString* name_;
VariableMode mode_;
Kind kind_;
VariableLocation location_;
int index_;
int initializer_position_;
// If this field is set, this variable references the stored locally bound // If this field is set, this variable references the stored locally bound
// variable, but it might be shadowed by variable bindings introduced by // variable, but it might be shadowed by variable bindings introduced by
// sloppy 'eval' calls between the reference scope (inclusive) and the // sloppy 'eval' calls between the reference scope (inclusive) and the
// binding scope (exclusive). // binding scope (exclusive).
Variable* local_if_not_shadowed_; Variable* local_if_not_shadowed_;
int index_;
int initializer_position_;
STATIC_ASSERT(kLastVariableMode < (1 << 3));
VariableMode mode_ : 3;
STATIC_ASSERT(kLastKind < (1 << 2));
Kind kind_ : 2;
STATIC_ASSERT(static_cast<uint8_t>(VariableLocation::kLastVariableLocation) <
(1 << 3));
VariableLocation location_ : 3;
// Usage info. // Usage info.
bool force_context_allocation_ : 1; // set by variable resolver bool force_context_allocation_; // set by variable resolver
bool is_used_ : 1; bool is_used_;
InitializationFlag initialization_flag_ : 2; InitializationFlag initialization_flag_;
MaybeAssignedFlag maybe_assigned_ : 2; MaybeAssignedFlag maybe_assigned_;
}; };
} // namespace internal } // namespace internal
} // namespace v8 } // namespace v8
......
...@@ -878,7 +878,7 @@ const double kMaxSafeInteger = 9007199254740991.0; // 2^53-1 ...@@ -878,7 +878,7 @@ const double kMaxSafeInteger = 9007199254740991.0; // 2^53-1
// The order of this enum has to be kept in sync with the predicates below. // The order of this enum has to be kept in sync with the predicates below.
enum VariableMode : uint8_t { enum VariableMode {
// User declared variables: // User declared variables:
VAR, // declared via 'var', and 'function' declarations VAR, // declared via 'var', and 'function' declarations
...@@ -899,12 +899,10 @@ enum VariableMode : uint8_t { ...@@ -899,12 +899,10 @@ enum VariableMode : uint8_t {
// variable is global unless it has been shadowed // variable is global unless it has been shadowed
// by an eval-introduced variable // by an eval-introduced variable
DYNAMIC_LOCAL, // requires dynamic lookup, but we know that the DYNAMIC_LOCAL // requires dynamic lookup, but we know that the
// variable is local and where it is unless it // variable is local and where it is unless it
// has been shadowed by an eval-introduced // has been shadowed by an eval-introduced
// variable // variable
kLastVariableMode = DYNAMIC_LOCAL
}; };
inline bool IsDynamicVariableMode(VariableMode mode) { inline bool IsDynamicVariableMode(VariableMode mode) {
...@@ -926,7 +924,7 @@ inline bool IsImmutableVariableMode(VariableMode mode) { ...@@ -926,7 +924,7 @@ inline bool IsImmutableVariableMode(VariableMode mode) {
return mode == CONST || mode == CONST_LEGACY; return mode == CONST || mode == CONST_LEGACY;
} }
enum class VariableLocation : uint8_t { enum class VariableLocation {
// Before and during variable allocation, a variable whose location is // Before and during variable allocation, a variable whose location is
// not yet determined. After allocation, a variable looked up as a // not yet determined. After allocation, a variable looked up as a
// property on the global object (and possibly absent). name() is the // property on the global object (and possibly absent). name() is the
...@@ -959,9 +957,7 @@ enum class VariableLocation : uint8_t { ...@@ -959,9 +957,7 @@ enum class VariableLocation : uint8_t {
LOOKUP, LOOKUP,
// A named slot in a module's export table. // A named slot in a module's export table.
MODULE, MODULE
kLastVariableLocation = MODULE
}; };
// ES6 Draft Rev3 10.2 specifies declarative environment records with mutable // ES6 Draft Rev3 10.2 specifies declarative environment records with mutable
...@@ -995,9 +991,14 @@ enum class VariableLocation : uint8_t { ...@@ -995,9 +991,14 @@ enum class VariableLocation : uint8_t {
// The following enum specifies a flag that indicates if the binding needs a // The following enum specifies a flag that indicates if the binding needs a
// distinct initialization step (kNeedsInitialization) or if the binding is // distinct initialization step (kNeedsInitialization) or if the binding is
// immediately initialized upon creation (kCreatedInitialized). // immediately initialized upon creation (kCreatedInitialized).
enum InitializationFlag : uint8_t { kNeedsInitialization, kCreatedInitialized }; enum InitializationFlag {
kNeedsInitialization,
kCreatedInitialized
};
enum MaybeAssignedFlag { kNotAssigned, kMaybeAssigned };
enum MaybeAssignedFlag : uint8_t { kNotAssigned, kMaybeAssigned };
// Serialized in PreparseData, so numeric values should not be changed. // Serialized in PreparseData, so numeric values should not be changed.
enum ParseErrorType { kSyntaxError = 0, kReferenceError = 1 }; enum ParseErrorType { kSyntaxError = 0, kReferenceError = 1 };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment