OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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/ast.h" | 5 #include "src/ast/ast.h" |
6 | 6 |
7 #include <cmath> // For isfinite. | 7 #include <cmath> // For isfinite. |
8 | 8 |
9 #include "src/ast/compile-time-value.h" | 9 #include "src/ast/compile-time-value.h" |
10 #include "src/ast/prettyprinter.h" | 10 #include "src/ast/prettyprinter.h" |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 case k##Node: \ | 152 case k##Node: \ |
153 return static_cast<const Node*>(this)->IsJump(); | 153 return static_cast<const Node*>(this)->IsJump(); |
154 JUMP_NODE_LIST(GENERATE_CASE) | 154 JUMP_NODE_LIST(GENERATE_CASE) |
155 #undef GENERATE_CASE | 155 #undef GENERATE_CASE |
156 #undef JUMP_NODE_LIST | 156 #undef JUMP_NODE_LIST |
157 default: | 157 default: |
158 return false; | 158 return false; |
159 } | 159 } |
160 } | 160 } |
161 | 161 |
162 VariableProxy::VariableProxy(Variable* var, int start_position, | 162 VariableProxy::VariableProxy(Variable* var, int start_position) |
163 int end_position) | |
164 : Expression(start_position, kVariableProxy), | 163 : Expression(start_position, kVariableProxy), |
165 end_position_(end_position), | |
166 raw_name_(var->raw_name()), | 164 raw_name_(var->raw_name()), |
167 next_unresolved_(nullptr) { | 165 next_unresolved_(nullptr) { |
168 bit_field_ |= IsThisField::encode(var->is_this()) | | 166 bit_field_ |= IsThisField::encode(var->is_this()) | |
169 IsAssignedField::encode(false) | | 167 IsAssignedField::encode(false) | |
170 IsResolvedField::encode(false) | | 168 IsResolvedField::encode(false) | |
171 HoleCheckModeField::encode(HoleCheckMode::kElided); | 169 HoleCheckModeField::encode(HoleCheckMode::kElided); |
172 BindTo(var); | 170 BindTo(var); |
173 } | 171 } |
174 | 172 |
175 VariableProxy::VariableProxy(const AstRawString* name, | 173 VariableProxy::VariableProxy(const AstRawString* name, |
176 VariableKind variable_kind, int start_position, | 174 VariableKind variable_kind, int start_position) |
177 int end_position) | |
178 : Expression(start_position, kVariableProxy), | 175 : Expression(start_position, kVariableProxy), |
179 end_position_(end_position), | |
180 raw_name_(name), | 176 raw_name_(name), |
181 next_unresolved_(nullptr) { | 177 next_unresolved_(nullptr) { |
182 bit_field_ |= IsThisField::encode(variable_kind == THIS_VARIABLE) | | 178 bit_field_ |= IsThisField::encode(variable_kind == THIS_VARIABLE) | |
183 IsAssignedField::encode(false) | | 179 IsAssignedField::encode(false) | |
184 IsResolvedField::encode(false) | | 180 IsResolvedField::encode(false) | |
185 HoleCheckModeField::encode(HoleCheckMode::kElided); | 181 HoleCheckModeField::encode(HoleCheckMode::kElided); |
186 } | 182 } |
187 | 183 |
188 VariableProxy::VariableProxy(const VariableProxy* copy_from) | 184 VariableProxy::VariableProxy(const VariableProxy* copy_from) |
189 : Expression(copy_from->position(), kVariableProxy), | 185 : Expression(copy_from->position(), kVariableProxy), |
190 end_position_(copy_from->end_position_), | |
191 next_unresolved_(nullptr) { | 186 next_unresolved_(nullptr) { |
192 bit_field_ = copy_from->bit_field_; | 187 bit_field_ = copy_from->bit_field_; |
193 DCHECK(!copy_from->is_resolved()); | 188 DCHECK(!copy_from->is_resolved()); |
194 raw_name_ = copy_from->raw_name_; | 189 raw_name_ = copy_from->raw_name_; |
195 } | 190 } |
196 | 191 |
197 void VariableProxy::BindTo(Variable* var) { | 192 void VariableProxy::BindTo(Variable* var) { |
198 DCHECK((is_this() && var->is_this()) || raw_name() == var->raw_name()); | 193 DCHECK((is_this() && var->is_this()) || raw_name() == var->raw_name()); |
199 set_var(var); | 194 set_var(var); |
200 set_is_resolved(); | 195 set_is_resolved(); |
(...skipping 747 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
948 // static | 943 // static |
949 bool Literal::Match(void* literal1, void* literal2) { | 944 bool Literal::Match(void* literal1, void* literal2) { |
950 const AstValue* x = static_cast<Literal*>(literal1)->raw_value(); | 945 const AstValue* x = static_cast<Literal*>(literal1)->raw_value(); |
951 const AstValue* y = static_cast<Literal*>(literal2)->raw_value(); | 946 const AstValue* y = static_cast<Literal*>(literal2)->raw_value(); |
952 return (x->IsString() && y->IsString() && x->AsString() == y->AsString()) || | 947 return (x->IsString() && y->IsString() && x->AsString() == y->AsString()) || |
953 (x->IsNumber() && y->IsNumber() && x->AsNumber() == y->AsNumber()); | 948 (x->IsNumber() && y->IsNumber() && x->AsNumber() == y->AsNumber()); |
954 } | 949 } |
955 | 950 |
956 } // namespace internal | 951 } // namespace internal |
957 } // namespace v8 | 952 } // namespace v8 |
OLD | NEW |