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