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/prettyprinter.h" | 9 #include "src/ast/prettyprinter.h" |
10 #include "src/ast/scopes.h" | 10 #include "src/ast/scopes.h" |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 Variable::Kind variable_kind, int start_position, | 197 Variable::Kind variable_kind, int start_position, |
198 int end_position) | 198 int end_position) |
199 : Expression(zone, start_position, kVariableProxy), | 199 : Expression(zone, start_position, kVariableProxy), |
200 bit_field_(IsThisField::encode(variable_kind == Variable::THIS) | | 200 bit_field_(IsThisField::encode(variable_kind == Variable::THIS) | |
201 IsAssignedField::encode(false) | | 201 IsAssignedField::encode(false) | |
202 IsResolvedField::encode(false)), | 202 IsResolvedField::encode(false)), |
203 end_position_(end_position), | 203 end_position_(end_position), |
204 raw_name_(name), | 204 raw_name_(name), |
205 next_unresolved_(nullptr) {} | 205 next_unresolved_(nullptr) {} |
206 | 206 |
| 207 VariableProxy::VariableProxy(Zone* zone, const VariableProxy* copy_from) |
| 208 : Expression(zone, copy_from->position(), kVariableProxy), |
| 209 bit_field_(copy_from->bit_field_), |
| 210 end_position_(copy_from->end_position_), |
| 211 next_unresolved_(nullptr) { |
| 212 if (copy_from->is_resolved()) { |
| 213 var_ = copy_from->var_; |
| 214 } else { |
| 215 raw_name_ = copy_from->raw_name_; |
| 216 } |
| 217 } |
| 218 |
207 void VariableProxy::BindTo(Variable* var) { | 219 void VariableProxy::BindTo(Variable* var) { |
208 DCHECK((is_this() && var->is_this()) || raw_name() == var->raw_name()); | 220 DCHECK((is_this() && var->is_this()) || raw_name() == var->raw_name()); |
209 set_var(var); | 221 set_var(var); |
210 set_is_resolved(); | 222 set_is_resolved(); |
211 var->set_is_used(); | 223 var->set_is_used(); |
212 } | 224 } |
213 | 225 |
214 | 226 |
215 void VariableProxy::AssignFeedbackVectorSlots(Isolate* isolate, | 227 void VariableProxy::AssignFeedbackVectorSlots(Isolate* isolate, |
216 FeedbackVectorSpec* spec, | 228 FeedbackVectorSpec* spec, |
(...skipping 730 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
947 bool Literal::Match(void* literal1, void* literal2) { | 959 bool Literal::Match(void* literal1, void* literal2) { |
948 const AstValue* x = static_cast<Literal*>(literal1)->raw_value(); | 960 const AstValue* x = static_cast<Literal*>(literal1)->raw_value(); |
949 const AstValue* y = static_cast<Literal*>(literal2)->raw_value(); | 961 const AstValue* y = static_cast<Literal*>(literal2)->raw_value(); |
950 return (x->IsString() && y->IsString() && x->AsString() == y->AsString()) || | 962 return (x->IsString() && y->IsString() && x->AsString() == y->AsString()) || |
951 (x->IsNumber() && y->IsNumber() && x->AsNumber() == y->AsNumber()); | 963 (x->IsNumber() && y->IsNumber() && x->AsNumber() == y->AsNumber()); |
952 } | 964 } |
953 | 965 |
954 | 966 |
955 } // namespace internal | 967 } // namespace internal |
956 } // namespace v8 | 968 } // namespace v8 |
OLD | NEW |