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

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

Issue 2231813003: Make Variable::is_this always return the correct value (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebase 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 unified diff | Download patch
« no previous file with comments | « src/ast/variables.h ('k') | src/compiler/ast-graph-builder.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/ast.h" 7 #include "src/ast/ast.h"
8 #include "src/ast/scopes.h" 8 #include "src/ast/scopes.h"
9 #include "src/globals.h" 9 #include "src/globals.h"
10 10
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 // Var declared variables never need initialization. 47 // Var declared variables never need initialization.
48 DCHECK(!(mode == VAR && initialization_flag == kNeedsInitialization)); 48 DCHECK(!(mode == VAR && initialization_flag == kNeedsInitialization));
49 } 49 }
50 50
51 51
52 bool Variable::IsGlobalObjectProperty() const { 52 bool Variable::IsGlobalObjectProperty() const {
53 // Temporaries are never global, they must always be allocated in the 53 // Temporaries are never global, they must always be allocated in the
54 // activation frame. 54 // activation frame.
55 return (IsDynamicVariableMode(mode_) || 55 return (IsDynamicVariableMode(mode_) ||
56 (IsDeclaredVariableMode(mode_) && !IsLexicalVariableMode(mode_))) && 56 (IsDeclaredVariableMode(mode_) && !IsLexicalVariableMode(mode_))) &&
57 scope_ != NULL && scope_->is_script_scope() && !is_this(); 57 scope_ != NULL && scope_->is_script_scope();
58 } 58 }
59 59
60 60
61 bool Variable::IsStaticGlobalObjectProperty() const { 61 bool Variable::IsStaticGlobalObjectProperty() const {
62 // Temporaries are never global, they must always be allocated in the 62 // Temporaries are never global, they must always be allocated in the
63 // activation frame. 63 // activation frame.
64 return (IsDeclaredVariableMode(mode_) && !IsLexicalVariableMode(mode_)) && 64 return (IsDeclaredVariableMode(mode_) && !IsLexicalVariableMode(mode_)) &&
65 scope_ != NULL && scope_->is_script_scope() && !is_this(); 65 scope_ != NULL && scope_->is_script_scope();
66 } 66 }
67 67
68 68
69 int Variable::CompareIndex(Variable* const* v, Variable* const* w) { 69 int Variable::CompareIndex(Variable* const* v, Variable* const* w) {
70 int x = (*v)->index(); 70 int x = (*v)->index();
71 int y = (*w)->index(); 71 int y = (*w)->index();
72 // Consider sorting them according to type as well? 72 // Consider sorting them according to type as well?
73 return x - y; 73 return x - y;
74 } 74 }
75 75
76 } // namespace internal 76 } // namespace internal
77 } // namespace v8 77 } // namespace v8
OLDNEW
« no previous file with comments | « src/ast/variables.h ('k') | src/compiler/ast-graph-builder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698