| 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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 return rewrite_ == NULL ? NULL : rewrite_->AsSlot(); | 79 return rewrite_ == NULL ? NULL : rewrite_->AsSlot(); |
| 80 } | 80 } |
| 81 | 81 |
| 82 | 82 |
| 83 bool Variable::IsStackAllocated() const { | 83 bool Variable::IsStackAllocated() const { |
| 84 Slot* slot = AsSlot(); | 84 Slot* slot = AsSlot(); |
| 85 return slot != NULL && slot->IsStackAllocated(); | 85 return slot != NULL && slot->IsStackAllocated(); |
| 86 } | 86 } |
| 87 | 87 |
| 88 | 88 |
| 89 bool Variable::IsParameter() const { |
| 90 Slot* s = AsSlot(); |
| 91 return s != NULL && s->type() == Slot::PARAMETER; |
| 92 } |
| 93 |
| 94 |
| 95 bool Variable::IsStackLocal() const { |
| 96 Slot* s = AsSlot(); |
| 97 return s != NULL && s->type() == Slot::LOCAL; |
| 98 } |
| 99 |
| 100 |
| 89 Variable::Variable(Scope* scope, | 101 Variable::Variable(Scope* scope, |
| 90 Handle<String> name, | 102 Handle<String> name, |
| 91 Mode mode, | 103 Mode mode, |
| 92 bool is_valid_LHS, | 104 bool is_valid_LHS, |
| 93 Kind kind) | 105 Kind kind) |
| 94 : scope_(scope), | 106 : scope_(scope), |
| 95 name_(name), | 107 name_(name), |
| 96 mode_(mode), | 108 mode_(mode), |
| 97 is_valid_LHS_(is_valid_LHS), | 109 is_valid_LHS_(is_valid_LHS), |
| 98 kind_(kind), | 110 kind_(kind), |
| 99 local_if_not_shadowed_(NULL), | 111 local_if_not_shadowed_(NULL), |
| 100 is_accessed_from_inner_scope_(false), | 112 is_accessed_from_inner_scope_(false), |
| 101 is_used_(false), | 113 is_used_(false), |
| 102 rewrite_(NULL) { | 114 rewrite_(NULL) { |
| 103 // names must be canonicalized for fast equality checks | 115 // names must be canonicalized for fast equality checks |
| 104 ASSERT(name->IsSymbol()); | 116 ASSERT(name->IsSymbol()); |
| 105 } | 117 } |
| 106 | 118 |
| 107 | 119 |
| 108 bool Variable::is_global() const { | 120 bool Variable::is_global() const { |
| 109 // Temporaries are never global, they must always be allocated in the | 121 // Temporaries are never global, they must always be allocated in the |
| 110 // activation frame. | 122 // activation frame. |
| 111 return mode_ != TEMPORARY && scope_ != NULL && scope_->is_global_scope(); | 123 return mode_ != TEMPORARY && scope_ != NULL && scope_->is_global_scope(); |
| 112 } | 124 } |
| 113 | 125 |
| 114 } } // namespace v8::internal | 126 } } // namespace v8::internal |
| OLD | NEW |