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