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

Side by Side Diff: src/ast/variables.h

Issue 2950993002: Make some functions that are hit during renderer startup available for inlining (Closed)
Patch Set: rebase Created 3 years, 5 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 unified diff | Download patch
« no previous file with comments | « src/ast/scopes.cc ('k') | src/ast/variables.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef V8_AST_VARIABLES_H_ 5 #ifndef V8_AST_VARIABLES_H_
6 #define V8_AST_VARIABLES_H_ 6 #define V8_AST_VARIABLES_H_
7 7
8 #include "src/ast/ast-value-factory.h" 8 #include "src/ast/ast-value-factory.h"
9 #include "src/globals.h" 9 #include "src/globals.h"
10 #include "src/zone/zone.h" 10 #include "src/zone/zone.h"
11 11
12 namespace v8 { 12 namespace v8 {
13 namespace internal { 13 namespace internal {
14 14
15 // The AST refers to variables via VariableProxies - placeholders for the actual 15 // The AST refers to variables via VariableProxies - placeholders for the actual
16 // variables. Variables themselves are never directly referred to from the AST, 16 // variables. Variables themselves are never directly referred to from the AST,
17 // they are maintained by scopes, and referred to from VariableProxies and Slots 17 // they are maintained by scopes, and referred to from VariableProxies and Slots
18 // after binding and variable allocation. 18 // after binding and variable allocation.
19 class Variable final : public ZoneObject { 19 class Variable final : public ZoneObject {
20 public: 20 public:
21 Variable(Scope* scope, const AstRawString* name, VariableMode mode, 21 Variable(Scope* scope, const AstRawString* name, VariableMode mode,
22 VariableKind kind, InitializationFlag initialization_flag, 22 VariableKind kind, InitializationFlag initialization_flag,
23 MaybeAssignedFlag maybe_assigned_flag = kNotAssigned); 23 MaybeAssignedFlag maybe_assigned_flag = kNotAssigned)
24 : scope_(scope),
25 name_(name),
26 local_if_not_shadowed_(nullptr),
27 next_(nullptr),
28 index_(-1),
29 initializer_position_(kNoSourcePosition),
30 bit_field_(MaybeAssignedFlagField::encode(maybe_assigned_flag) |
31 InitializationFlagField::encode(initialization_flag) |
32 VariableModeField::encode(mode) |
33 IsUsedField::encode(false) |
34 ForceContextAllocationField::encode(false) |
35 ForceHoleInitializationField::encode(false) |
36 LocationField::encode(VariableLocation::UNALLOCATED) |
37 VariableKindField::encode(kind)) {
38 // Var declared variables never need initialization.
39 DCHECK(!(mode == VAR && initialization_flag == kNeedsInitialization));
40 }
24 41
25 explicit Variable(Variable* other); 42 explicit Variable(Variable* other);
26 43
27 // The source code for an eval() call may refer to a variable that is 44 // The source code for an eval() call may refer to a variable that is
28 // in an outer scope about which we don't know anything (it may not 45 // in an outer scope about which we don't know anything (it may not
29 // be the script scope). scope() is NULL in that case. Currently the 46 // be the script scope). scope() is NULL in that case. Currently the
30 // scope is only used to follow the context chain length. 47 // scope is only used to follow the context chain length.
31 Scope* scope() const { return scope_; } 48 Scope* scope() const { return scope_; }
32 49
33 // This is for adjusting the scope of temporaries used when desugaring 50 // This is for adjusting the scope of temporaries used when desugaring
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 class MaybeAssignedFlagField 210 class MaybeAssignedFlagField
194 : public BitField16<MaybeAssignedFlag, 211 : public BitField16<MaybeAssignedFlag,
195 ForceHoleInitializationField::kNext, 1> {}; 212 ForceHoleInitializationField::kNext, 1> {};
196 Variable** next() { return &next_; } 213 Variable** next() { return &next_; }
197 friend List; 214 friend List;
198 }; 215 };
199 } // namespace internal 216 } // namespace internal
200 } // namespace v8 217 } // namespace v8
201 218
202 #endif // V8_AST_VARIABLES_H_ 219 #endif // V8_AST_VARIABLES_H_
OLDNEW
« no previous file with comments | « src/ast/scopes.cc ('k') | src/ast/variables.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698