| 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 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 return false; | 158 return false; |
| 159 } | 159 } |
| 160 } | 160 } |
| 161 | 161 |
| 162 VariableProxy::VariableProxy(Variable* var, int start_position, | 162 VariableProxy::VariableProxy(Variable* var, int start_position, |
| 163 int end_position) | 163 int end_position) |
| 164 : Expression(start_position, kVariableProxy), | 164 : Expression(start_position, kVariableProxy), |
| 165 end_position_(end_position), | 165 end_position_(end_position), |
| 166 raw_name_(var->raw_name()), | 166 raw_name_(var->raw_name()), |
| 167 next_unresolved_(nullptr) { | 167 next_unresolved_(nullptr) { |
| 168 bit_field_ |= IsThisField::encode(var->is_this()) | | 168 bit_field_ |= |
| 169 IsAssignedField::encode(false) | IsResolvedField::encode(false); | 169 IsThisField::encode(var->is_this()) | IsAssignedField::encode(false) | |
| 170 IsResolvedField::encode(false) | NeedsHoleCheckField::encode(false); |
| 170 BindTo(var); | 171 BindTo(var); |
| 171 } | 172 } |
| 172 | 173 |
| 173 VariableProxy::VariableProxy(const AstRawString* name, | 174 VariableProxy::VariableProxy(const AstRawString* name, |
| 174 VariableKind variable_kind, int start_position, | 175 VariableKind variable_kind, int start_position, |
| 175 int end_position) | 176 int end_position) |
| 176 : Expression(start_position, kVariableProxy), | 177 : Expression(start_position, kVariableProxy), |
| 177 end_position_(end_position), | 178 end_position_(end_position), |
| 178 raw_name_(name), | 179 raw_name_(name), |
| 179 next_unresolved_(nullptr) { | 180 next_unresolved_(nullptr) { |
| 180 bit_field_ |= IsThisField::encode(variable_kind == THIS_VARIABLE) | | 181 bit_field_ |= IsThisField::encode(variable_kind == THIS_VARIABLE) | |
| 181 IsAssignedField::encode(false) | IsResolvedField::encode(false); | 182 IsAssignedField::encode(false) | |
| 183 IsResolvedField::encode(false) | |
| 184 NeedsHoleCheckField::encode(false); |
| 182 } | 185 } |
| 183 | 186 |
| 184 VariableProxy::VariableProxy(const VariableProxy* copy_from) | 187 VariableProxy::VariableProxy(const VariableProxy* copy_from) |
| 185 : Expression(copy_from->position(), kVariableProxy), | 188 : Expression(copy_from->position(), kVariableProxy), |
| 186 end_position_(copy_from->end_position_), | 189 end_position_(copy_from->end_position_), |
| 187 next_unresolved_(nullptr) { | 190 next_unresolved_(nullptr) { |
| 188 bit_field_ = copy_from->bit_field_; | 191 bit_field_ = copy_from->bit_field_; |
| 189 DCHECK(!copy_from->is_resolved()); | 192 DCHECK(!copy_from->is_resolved()); |
| 190 raw_name_ = copy_from->raw_name_; | 193 raw_name_ = copy_from->raw_name_; |
| 191 } | 194 } |
| (...skipping 752 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 944 // static | 947 // static |
| 945 bool Literal::Match(void* literal1, void* literal2) { | 948 bool Literal::Match(void* literal1, void* literal2) { |
| 946 const AstValue* x = static_cast<Literal*>(literal1)->raw_value(); | 949 const AstValue* x = static_cast<Literal*>(literal1)->raw_value(); |
| 947 const AstValue* y = static_cast<Literal*>(literal2)->raw_value(); | 950 const AstValue* y = static_cast<Literal*>(literal2)->raw_value(); |
| 948 return (x->IsString() && y->IsString() && x->AsString() == y->AsString()) || | 951 return (x->IsString() && y->IsString() && x->AsString() == y->AsString()) || |
| 949 (x->IsNumber() && y->IsNumber() && x->AsNumber() == y->AsNumber()); | 952 (x->IsNumber() && y->IsNumber() && x->AsNumber() == y->AsNumber()); |
| 950 } | 953 } |
| 951 | 954 |
| 952 } // namespace internal | 955 } // namespace internal |
| 953 } // namespace v8 | 956 } // namespace v8 |
| OLD | NEW |