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

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

Issue 2475433002: Turn Scope::locals_ into a ThreadedList (Closed)
Patch Set: Addressed comments Created 4 years, 1 month 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/variables.h ('k') | src/crankshaft/typing.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 #include "src/ast/variables.h" 5 #include "src/ast/variables.h"
6 6
7 #include "src/ast/scopes.h" 7 #include "src/ast/scopes.h"
8 #include "src/globals.h" 8 #include "src/globals.h"
9 9
10 namespace v8 { 10 namespace v8 {
11 namespace internal { 11 namespace internal {
12 12
13 // ---------------------------------------------------------------------------- 13 // ----------------------------------------------------------------------------
14 // Implementation Variable. 14 // Implementation Variable.
15 15
16 Variable::Variable(Scope* scope, const AstRawString* name, VariableMode mode, 16 Variable::Variable(Scope* scope, const AstRawString* name, VariableMode mode,
17 VariableKind kind, InitializationFlag initialization_flag, 17 VariableKind kind, InitializationFlag initialization_flag,
18 MaybeAssignedFlag maybe_assigned_flag) 18 MaybeAssignedFlag maybe_assigned_flag)
19 : scope_(scope), 19 : scope_(scope),
20 name_(name), 20 name_(name),
21 local_if_not_shadowed_(nullptr), 21 local_if_not_shadowed_(nullptr),
22 next_(nullptr),
22 index_(-1), 23 index_(-1),
23 initializer_position_(kNoSourcePosition), 24 initializer_position_(kNoSourcePosition),
24 bit_field_(MaybeAssignedFlagField::encode(maybe_assigned_flag) | 25 bit_field_(MaybeAssignedFlagField::encode(maybe_assigned_flag) |
25 InitializationFlagField::encode(initialization_flag) | 26 InitializationFlagField::encode(initialization_flag) |
26 VariableModeField::encode(mode) | IsUsedField::encode(false) | 27 VariableModeField::encode(mode) | IsUsedField::encode(false) |
27 ForceContextAllocationField::encode(false) | 28 ForceContextAllocationField::encode(false) |
28 LocationField::encode(VariableLocation::UNALLOCATED) | 29 LocationField::encode(VariableLocation::UNALLOCATED) |
29 VariableKindField::encode(kind)) { 30 VariableKindField::encode(kind)) {
30 // Var declared variables never need initialization. 31 // Var declared variables never need initialization.
31 DCHECK(!(mode == VAR && initialization_flag == kNeedsInitialization)); 32 DCHECK(!(mode == VAR && initialization_flag == kNeedsInitialization));
32 } 33 }
33 34
34 35
35 bool Variable::IsGlobalObjectProperty() const { 36 bool Variable::IsGlobalObjectProperty() const {
36 // Temporaries are never global, they must always be allocated in the 37 // Temporaries are never global, they must always be allocated in the
37 // activation frame. 38 // activation frame.
38 return (IsDynamicVariableMode(mode()) || 39 return (IsDynamicVariableMode(mode()) ||
39 (IsDeclaredVariableMode(mode()) && !IsLexicalVariableMode(mode()))) && 40 (IsDeclaredVariableMode(mode()) && !IsLexicalVariableMode(mode()))) &&
40 scope_ != NULL && scope_->is_script_scope(); 41 scope_ != NULL && scope_->is_script_scope();
41 } 42 }
42 43
43 } // namespace internal 44 } // namespace internal
44 } // namespace v8 45 } // namespace v8
OLDNEW
« no previous file with comments | « src/ast/variables.h ('k') | src/crankshaft/typing.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698