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 | |
219 void VariableProxy::BindTo(Variable* var) { | 207 void VariableProxy::BindTo(Variable* var) { |
220 DCHECK((is_this() && var->is_this()) || raw_name() == var->raw_name()); | 208 DCHECK((is_this() && var->is_this()) || raw_name() == var->raw_name()); |
221 set_var(var); | 209 set_var(var); |
222 set_is_resolved(); | 210 set_is_resolved(); |
223 var->set_is_used(); | 211 var->set_is_used(); |
224 } | 212 } |
225 | 213 |
226 | 214 |
227 void VariableProxy::AssignFeedbackVectorSlots(Isolate* isolate, | 215 void VariableProxy::AssignFeedbackVectorSlots(Isolate* isolate, |
228 FeedbackVectorSpec* spec, | 216 FeedbackVectorSpec* spec, |
(...skipping 730 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
959 bool Literal::Match(void* literal1, void* literal2) { | 947 bool Literal::Match(void* literal1, void* literal2) { |
960 const AstValue* x = static_cast<Literal*>(literal1)->raw_value(); | 948 const AstValue* x = static_cast<Literal*>(literal1)->raw_value(); |
961 const AstValue* y = static_cast<Literal*>(literal2)->raw_value(); | 949 const AstValue* y = static_cast<Literal*>(literal2)->raw_value(); |
962 return (x->IsString() && y->IsString() && x->AsString() == y->AsString()) || | 950 return (x->IsString() && y->IsString() && x->AsString() == y->AsString()) || |
963 (x->IsNumber() && y->IsNumber() && x->AsNumber() == y->AsNumber()); | 951 (x->IsNumber() && y->IsNumber() && x->AsNumber() == y->AsNumber()); |
964 } | 952 } |
965 | 953 |
966 | 954 |
967 } // namespace internal | 955 } // namespace internal |
968 } // namespace v8 | 956 } // namespace v8 |
OLD | NEW |