| 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 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 } | 171 } |
| 172 } | 172 } |
| 173 | 173 |
| 174 VariableProxy::VariableProxy(Zone* zone, Variable* var, int start_position, | 174 VariableProxy::VariableProxy(Zone* zone, Variable* var, int start_position, |
| 175 int end_position) | 175 int end_position) |
| 176 : Expression(zone, start_position, kVariableProxy), | 176 : Expression(zone, start_position, kVariableProxy), |
| 177 bit_field_(IsThisField::encode(var->is_this()) | | 177 bit_field_(IsThisField::encode(var->is_this()) | |
| 178 IsAssignedField::encode(false) | | 178 IsAssignedField::encode(false) | |
| 179 IsResolvedField::encode(false)), | 179 IsResolvedField::encode(false)), |
| 180 end_position_(end_position), | 180 end_position_(end_position), |
| 181 raw_name_(var->raw_name()) { | 181 raw_name_(var->raw_name()), |
| 182 next_unresolved_(nullptr) { |
| 182 BindTo(var); | 183 BindTo(var); |
| 183 } | 184 } |
| 184 | 185 |
| 185 VariableProxy::VariableProxy(Zone* zone, const AstRawString* name, | 186 VariableProxy::VariableProxy(Zone* zone, const AstRawString* name, |
| 186 Variable::Kind variable_kind, int start_position, | 187 Variable::Kind variable_kind, int start_position, |
| 187 int end_position) | 188 int end_position) |
| 188 : Expression(zone, start_position, kVariableProxy), | 189 : Expression(zone, start_position, kVariableProxy), |
| 189 bit_field_(IsThisField::encode(variable_kind == Variable::THIS) | | 190 bit_field_(IsThisField::encode(variable_kind == Variable::THIS) | |
| 190 IsAssignedField::encode(false) | | 191 IsAssignedField::encode(false) | |
| 191 IsResolvedField::encode(false)), | 192 IsResolvedField::encode(false)), |
| 192 end_position_(end_position), | 193 end_position_(end_position), |
| 193 raw_name_(name) {} | 194 raw_name_(name), |
| 195 next_unresolved_(nullptr) {} |
| 194 | 196 |
| 195 void VariableProxy::BindTo(Variable* var) { | 197 void VariableProxy::BindTo(Variable* var) { |
| 196 DCHECK((is_this() && var->is_this()) || raw_name() == var->raw_name()); | 198 DCHECK((is_this() && var->is_this()) || raw_name() == var->raw_name()); |
| 197 set_var(var); | 199 set_var(var); |
| 198 set_is_resolved(); | 200 set_is_resolved(); |
| 199 var->set_is_used(); | 201 var->set_is_used(); |
| 200 } | 202 } |
| 201 | 203 |
| 202 | 204 |
| 203 void VariableProxy::AssignFeedbackVectorSlots(Isolate* isolate, | 205 void VariableProxy::AssignFeedbackVectorSlots(Isolate* isolate, |
| (...skipping 1030 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1234 bool Literal::Match(void* literal1, void* literal2) { | 1236 bool Literal::Match(void* literal1, void* literal2) { |
| 1235 const AstValue* x = static_cast<Literal*>(literal1)->raw_value(); | 1237 const AstValue* x = static_cast<Literal*>(literal1)->raw_value(); |
| 1236 const AstValue* y = static_cast<Literal*>(literal2)->raw_value(); | 1238 const AstValue* y = static_cast<Literal*>(literal2)->raw_value(); |
| 1237 return (x->IsString() && y->IsString() && x->AsString() == y->AsString()) || | 1239 return (x->IsString() && y->IsString() && x->AsString() == y->AsString()) || |
| 1238 (x->IsNumber() && y->IsNumber() && x->AsNumber() == y->AsNumber()); | 1240 (x->IsNumber() && y->IsNumber() && x->AsNumber() == y->AsNumber()); |
| 1239 } | 1241 } |
| 1240 | 1242 |
| 1241 | 1243 |
| 1242 } // namespace internal | 1244 } // namespace internal |
| 1243 } // namespace v8 | 1245 } // namespace v8 |
| OLD | NEW |