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

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

Issue 2688143002: [ast] Simplify a condition. (Closed)
Patch Set: Created 3 years, 10 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 | « no previous file | no next file » | 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 #include "src/objects-inl.h" 9 #include "src/objects-inl.h"
10 10
(...skipping 19 matching lines...) Expand all
30 LocationField::encode(VariableLocation::UNALLOCATED) | 30 LocationField::encode(VariableLocation::UNALLOCATED) |
31 VariableKindField::encode(kind)) { 31 VariableKindField::encode(kind)) {
32 // Var declared variables never need initialization. 32 // Var declared variables never need initialization.
33 DCHECK(!(mode == VAR && initialization_flag == kNeedsInitialization)); 33 DCHECK(!(mode == VAR && initialization_flag == kNeedsInitialization));
34 } 34 }
35 35
36 36
37 bool Variable::IsGlobalObjectProperty() const { 37 bool Variable::IsGlobalObjectProperty() const {
38 // Temporaries are never global, they must always be allocated in the 38 // Temporaries are never global, they must always be allocated in the
39 // activation frame. 39 // activation frame.
40 return (IsDynamicVariableMode(mode()) || 40 return (IsDynamicVariableMode(mode()) || mode() == VAR) &&
41 (IsDeclaredVariableMode(mode()) && !IsLexicalVariableMode(mode()))) && 41 scope_ != nullptr && scope_->is_script_scope();
42 scope_ != NULL && scope_->is_script_scope();
43 } 42 }
44 43
45 } // namespace internal 44 } // namespace internal
46 } // namespace v8 45 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698