OLD | NEW |
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 return s != NULL && s->type() == Slot::PARAMETER; | 91 return s != NULL && s->type() == Slot::PARAMETER; |
92 } | 92 } |
93 | 93 |
94 | 94 |
95 bool Variable::IsStackLocal() const { | 95 bool Variable::IsStackLocal() const { |
96 Slot* s = AsSlot(); | 96 Slot* s = AsSlot(); |
97 return s != NULL && s->type() == Slot::LOCAL; | 97 return s != NULL && s->type() == Slot::LOCAL; |
98 } | 98 } |
99 | 99 |
100 | 100 |
| 101 bool Variable::IsContextSlot() const { |
| 102 Slot* s = AsSlot(); |
| 103 return s != NULL && s->type() == Slot::CONTEXT; |
| 104 } |
| 105 |
| 106 |
101 Variable::Variable(Scope* scope, | 107 Variable::Variable(Scope* scope, |
102 Handle<String> name, | 108 Handle<String> name, |
103 Mode mode, | 109 Mode mode, |
104 bool is_valid_LHS, | 110 bool is_valid_LHS, |
105 Kind kind) | 111 Kind kind) |
106 : scope_(scope), | 112 : scope_(scope), |
107 name_(name), | 113 name_(name), |
108 mode_(mode), | 114 mode_(mode), |
109 is_valid_LHS_(is_valid_LHS), | 115 is_valid_LHS_(is_valid_LHS), |
110 kind_(kind), | 116 kind_(kind), |
111 local_if_not_shadowed_(NULL), | 117 local_if_not_shadowed_(NULL), |
112 is_accessed_from_inner_scope_(false), | 118 is_accessed_from_inner_scope_(false), |
113 is_used_(false), | 119 is_used_(false), |
114 rewrite_(NULL) { | 120 rewrite_(NULL) { |
115 // names must be canonicalized for fast equality checks | 121 // names must be canonicalized for fast equality checks |
116 ASSERT(name->IsSymbol()); | 122 ASSERT(name->IsSymbol()); |
117 } | 123 } |
118 | 124 |
119 | 125 |
120 bool Variable::is_global() const { | 126 bool Variable::is_global() const { |
121 // Temporaries are never global, they must always be allocated in the | 127 // Temporaries are never global, they must always be allocated in the |
122 // activation frame. | 128 // activation frame. |
123 return mode_ != TEMPORARY && scope_ != NULL && scope_->is_global_scope(); | 129 return mode_ != TEMPORARY && scope_ != NULL && scope_->is_global_scope(); |
124 } | 130 } |
125 | 131 |
126 } } // namespace v8::internal | 132 } } // namespace v8::internal |
OLD | NEW |