OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 VariableMode mode, | 59 VariableMode mode, |
60 bool is_valid_LHS, | 60 bool is_valid_LHS, |
61 Kind kind, | 61 Kind kind, |
62 InitializationFlag initialization_flag) | 62 InitializationFlag initialization_flag) |
63 : scope_(scope), | 63 : scope_(scope), |
64 name_(name), | 64 name_(name), |
65 mode_(mode), | 65 mode_(mode), |
66 kind_(kind), | 66 kind_(kind), |
67 location_(UNALLOCATED), | 67 location_(UNALLOCATED), |
68 index_(-1), | 68 index_(-1), |
| 69 initializer_position_(RelocInfo::kNoPosition), |
69 local_if_not_shadowed_(NULL), | 70 local_if_not_shadowed_(NULL), |
70 is_valid_LHS_(is_valid_LHS), | 71 is_valid_LHS_(is_valid_LHS), |
71 is_accessed_from_inner_scope_(false), | 72 is_accessed_from_inner_scope_(false), |
72 is_used_(false), | 73 is_used_(false), |
73 initialization_flag_(initialization_flag) { | 74 initialization_flag_(initialization_flag) { |
74 // Names must be canonicalized for fast equality checks. | 75 // Names must be canonicalized for fast equality checks. |
75 ASSERT(name->IsSymbol()); | 76 ASSERT(name->IsSymbol()); |
76 // Var declared variables never need initialization. | 77 // Var declared variables never need initialization. |
77 ASSERT(!(mode == VAR && initialization_flag == NEEDS_INITIALIZATION)); | 78 ASSERT(!(mode == VAR && initialization_flag == NEEDS_INITIALIZATION)); |
78 } | 79 } |
79 | 80 |
80 | 81 |
81 bool Variable::is_global() const { | 82 bool Variable::is_global() const { |
82 // Temporaries are never global, they must always be allocated in the | 83 // Temporaries are never global, they must always be allocated in the |
83 // activation frame. | 84 // activation frame. |
84 return mode_ != TEMPORARY && scope_ != NULL && scope_->is_global_scope(); | 85 return mode_ != TEMPORARY && scope_ != NULL && scope_->is_global_scope(); |
85 } | 86 } |
86 | 87 |
87 } } // namespace v8::internal | 88 } } // namespace v8::internal |
OLD | NEW |