Chromium Code Reviews| OLD | NEW |
|---|---|
| 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/zone.h" | 9 #include "src/zone.h" |
| 10 | 10 |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 36 // parameter initializers. | 36 // parameter initializers. |
| 37 void set_scope(Scope* scope) { scope_ = scope; } | 37 void set_scope(Scope* scope) { scope_ = scope; } |
| 38 | 38 |
| 39 Handle<String> name() const { return name_->string(); } | 39 Handle<String> name() const { return name_->string(); } |
| 40 const AstRawString* raw_name() const { return name_; } | 40 const AstRawString* raw_name() const { return name_; } |
| 41 VariableMode mode() const { return mode_; } | 41 VariableMode mode() const { return mode_; } |
| 42 bool has_forced_context_allocation() const { | 42 bool has_forced_context_allocation() const { |
| 43 return force_context_allocation_; | 43 return force_context_allocation_; |
| 44 } | 44 } |
| 45 void ForceContextAllocation() { | 45 void ForceContextAllocation() { |
| 46 DCHECK(IsUnallocated() || IsContextSlot()); | |
|
Toon Verwaest
2016/08/19 12:48:52
This is surprising. I'd hope we wouldn't call Forc
| |
| 46 force_context_allocation_ = true; | 47 force_context_allocation_ = true; |
| 47 } | 48 } |
| 48 bool is_used() { return is_used_; } | 49 bool is_used() { return is_used_; } |
| 49 void set_is_used() { is_used_ = true; } | 50 void set_is_used() { is_used_ = true; } |
| 50 MaybeAssignedFlag maybe_assigned() const { return maybe_assigned_; } | 51 MaybeAssignedFlag maybe_assigned() const { return maybe_assigned_; } |
| 51 void set_maybe_assigned() { maybe_assigned_ = kMaybeAssigned; } | 52 void set_maybe_assigned() { maybe_assigned_ = kMaybeAssigned; } |
| 52 | 53 |
| 53 int initializer_position() { return initializer_position_; } | 54 int initializer_position() { return initializer_position_; } |
| 54 void set_initializer_position(int pos) { initializer_position_ = pos; } | 55 void set_initializer_position(int pos) { initializer_position_ = pos; } |
| 55 | 56 |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 89 local_if_not_shadowed_ = local; | 90 local_if_not_shadowed_ = local; |
| 90 } | 91 } |
| 91 | 92 |
| 92 VariableLocation location() const { return location_; } | 93 VariableLocation location() const { return location_; } |
| 93 int index() const { return index_; } | 94 int index() const { return index_; } |
| 94 InitializationFlag initialization_flag() const { | 95 InitializationFlag initialization_flag() const { |
| 95 return initialization_flag_; | 96 return initialization_flag_; |
| 96 } | 97 } |
| 97 | 98 |
| 98 void AllocateTo(VariableLocation location, int index) { | 99 void AllocateTo(VariableLocation location, int index) { |
| 100 DCHECK(IsUnallocated() || (location_ == location && index_ == index)); | |
|
Toon Verwaest
2016/08/19 12:48:52
Same here...
| |
| 99 location_ = location; | 101 location_ = location; |
| 100 index_ = index; | 102 index_ = index; |
| 101 } | 103 } |
| 102 | 104 |
| 103 static int CompareIndex(Variable* const* v, Variable* const* w); | 105 static int CompareIndex(Variable* const* v, Variable* const* w); |
| 104 | 106 |
| 105 private: | 107 private: |
| 106 Scope* scope_; | 108 Scope* scope_; |
| 107 const AstRawString* name_; | 109 const AstRawString* name_; |
| 108 VariableMode mode_; | 110 VariableMode mode_; |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 120 // Usage info. | 122 // Usage info. |
| 121 bool force_context_allocation_; // set by variable resolver | 123 bool force_context_allocation_; // set by variable resolver |
| 122 bool is_used_; | 124 bool is_used_; |
| 123 InitializationFlag initialization_flag_; | 125 InitializationFlag initialization_flag_; |
| 124 MaybeAssignedFlag maybe_assigned_; | 126 MaybeAssignedFlag maybe_assigned_; |
| 125 }; | 127 }; |
| 126 } // namespace internal | 128 } // namespace internal |
| 127 } // namespace v8 | 129 } // namespace v8 |
| 128 | 130 |
| 129 #endif // V8_AST_VARIABLES_H_ | 131 #endif // V8_AST_VARIABLES_H_ |
| OLD | NEW |