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 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
227 return scope()->language_mode(); | 227 return scope()->language_mode(); |
228 } | 228 } |
229 | 229 |
230 | 230 |
231 bool FunctionLiteral::NeedsHomeObject(Expression* expr) { | 231 bool FunctionLiteral::NeedsHomeObject(Expression* expr) { |
232 if (expr == nullptr || !expr->IsFunctionLiteral()) return false; | 232 if (expr == nullptr || !expr->IsFunctionLiteral()) return false; |
233 DCHECK_NOT_NULL(expr->AsFunctionLiteral()->scope()); | 233 DCHECK_NOT_NULL(expr->AsFunctionLiteral()->scope()); |
234 return expr->AsFunctionLiteral()->scope()->NeedsHomeObject(); | 234 return expr->AsFunctionLiteral()->scope()->NeedsHomeObject(); |
235 } | 235 } |
236 | 236 |
237 | |
238 ObjectLiteralProperty::ObjectLiteralProperty(Expression* key, Expression* value, | 237 ObjectLiteralProperty::ObjectLiteralProperty(Expression* key, Expression* value, |
239 Kind kind, bool is_static, | 238 Kind kind, MethodKind method_kind, |
240 bool is_computed_name) | 239 bool is_computed_name) |
241 : key_(key), | 240 : key_(key), |
242 value_(value), | 241 value_(value), |
243 kind_(kind), | 242 kind_(kind), |
| 243 method_kind_(method_kind), |
244 emit_store_(true), | 244 emit_store_(true), |
245 is_static_(is_static), | |
246 is_computed_name_(is_computed_name) {} | 245 is_computed_name_(is_computed_name) {} |
247 | 246 |
248 | |
249 ObjectLiteralProperty::ObjectLiteralProperty(AstValueFactory* ast_value_factory, | 247 ObjectLiteralProperty::ObjectLiteralProperty(AstValueFactory* ast_value_factory, |
250 Expression* key, Expression* value, | 248 Expression* key, Expression* value, |
251 bool is_static, | 249 MethodKind method_kind, |
252 bool is_computed_name) | 250 bool is_computed_name) |
253 : key_(key), | 251 : key_(key), |
254 value_(value), | 252 value_(value), |
| 253 method_kind_(method_kind), |
255 emit_store_(true), | 254 emit_store_(true), |
256 is_static_(is_static), | |
257 is_computed_name_(is_computed_name) { | 255 is_computed_name_(is_computed_name) { |
258 if (!is_computed_name && | 256 if (!is_computed_name && |
259 key->AsLiteral()->raw_value()->EqualsString( | 257 key->AsLiteral()->raw_value()->EqualsString( |
260 ast_value_factory->proto_string())) { | 258 ast_value_factory->proto_string())) { |
261 kind_ = PROTOTYPE; | 259 kind_ = PROTOTYPE; |
262 } else if (value_->AsMaterializedLiteral() != NULL) { | 260 } else if (value_->AsMaterializedLiteral() != NULL) { |
263 kind_ = MATERIALIZED_LITERAL; | 261 kind_ = MATERIALIZED_LITERAL; |
264 } else if (value_->IsLiteral()) { | 262 } else if (value_->IsLiteral()) { |
265 kind_ = CONSTANT; | 263 kind_ = CONSTANT; |
266 } else { | 264 } else { |
(...skipping 564 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
831 bool Literal::Match(void* literal1, void* literal2) { | 829 bool Literal::Match(void* literal1, void* literal2) { |
832 const AstValue* x = static_cast<Literal*>(literal1)->raw_value(); | 830 const AstValue* x = static_cast<Literal*>(literal1)->raw_value(); |
833 const AstValue* y = static_cast<Literal*>(literal2)->raw_value(); | 831 const AstValue* y = static_cast<Literal*>(literal2)->raw_value(); |
834 return (x->IsString() && y->IsString() && x->AsString() == y->AsString()) || | 832 return (x->IsString() && y->IsString() && x->AsString() == y->AsString()) || |
835 (x->IsNumber() && y->IsNumber() && x->AsNumber() == y->AsNumber()); | 833 (x->IsNumber() && y->IsNumber() && x->AsNumber() == y->AsNumber()); |
836 } | 834 } |
837 | 835 |
838 | 836 |
839 } // namespace internal | 837 } // namespace internal |
840 } // namespace v8 | 838 } // namespace v8 |
OLD | NEW |