| 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 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 next_unresolved_(nullptr) { | 179 next_unresolved_(nullptr) { |
| 180 bit_field_ |= IsThisField::encode(variable_kind == THIS_VARIABLE) | | 180 bit_field_ |= IsThisField::encode(variable_kind == THIS_VARIABLE) | |
| 181 IsAssignedField::encode(false) | IsResolvedField::encode(false); | 181 IsAssignedField::encode(false) | IsResolvedField::encode(false); |
| 182 } | 182 } |
| 183 | 183 |
| 184 VariableProxy::VariableProxy(const VariableProxy* copy_from) | 184 VariableProxy::VariableProxy(const VariableProxy* copy_from) |
| 185 : Expression(copy_from->position(), kVariableProxy), | 185 : Expression(copy_from->position(), kVariableProxy), |
| 186 end_position_(copy_from->end_position_), | 186 end_position_(copy_from->end_position_), |
| 187 next_unresolved_(nullptr) { | 187 next_unresolved_(nullptr) { |
| 188 bit_field_ = copy_from->bit_field_; | 188 bit_field_ = copy_from->bit_field_; |
| 189 if (copy_from->is_resolved()) { | 189 DCHECK(!copy_from->is_resolved()); |
| 190 var_ = copy_from->var_; | 190 raw_name_ = copy_from->raw_name_; |
| 191 } else { | |
| 192 raw_name_ = copy_from->raw_name_; | |
| 193 } | |
| 194 } | 191 } |
| 195 | 192 |
| 196 void VariableProxy::BindTo(Variable* var) { | 193 void VariableProxy::BindTo(Variable* var) { |
| 197 DCHECK((is_this() && var->is_this()) || raw_name() == var->raw_name()); | 194 DCHECK((is_this() && var->is_this()) || raw_name() == var->raw_name()); |
| 198 set_var(var); | 195 set_var(var); |
| 199 set_is_resolved(); | 196 set_is_resolved(); |
| 200 var->set_is_used(); | 197 var->set_is_used(); |
| 201 } | 198 } |
| 202 | 199 |
| 203 | 200 |
| (...skipping 760 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 964 // static | 961 // static |
| 965 bool Literal::Match(void* literal1, void* literal2) { | 962 bool Literal::Match(void* literal1, void* literal2) { |
| 966 const AstValue* x = static_cast<Literal*>(literal1)->raw_value(); | 963 const AstValue* x = static_cast<Literal*>(literal1)->raw_value(); |
| 967 const AstValue* y = static_cast<Literal*>(literal2)->raw_value(); | 964 const AstValue* y = static_cast<Literal*>(literal2)->raw_value(); |
| 968 return (x->IsString() && y->IsString() && x->AsString() == y->AsString()) || | 965 return (x->IsString() && y->IsString() && x->AsString() == y->AsString()) || |
| 969 (x->IsNumber() && y->IsNumber() && x->AsNumber() == y->AsNumber()); | 966 (x->IsNumber() && y->IsNumber() && x->AsNumber() == y->AsNumber()); |
| 970 } | 967 } |
| 971 | 968 |
| 972 } // namespace internal | 969 } // namespace internal |
| 973 } // namespace v8 | 970 } // namespace v8 |
| OLD | NEW |