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 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
401 // ics must mirror FullCodeGenerator::VisitObjectLiteral. | 401 // ics must mirror FullCodeGenerator::VisitObjectLiteral. |
402 int property_index = 0; | 402 int property_index = 0; |
403 for (; property_index < properties()->length(); property_index++) { | 403 for (; property_index < properties()->length(); property_index++) { |
404 ObjectLiteral::Property* property = properties()->at(property_index); | 404 ObjectLiteral::Property* property = properties()->at(property_index); |
405 if (property->is_computed_name()) break; | 405 if (property->is_computed_name()) break; |
406 if (property->IsCompileTimeValue()) continue; | 406 if (property->IsCompileTimeValue()) continue; |
407 | 407 |
408 Literal* key = property->key()->AsLiteral(); | 408 Literal* key = property->key()->AsLiteral(); |
409 Expression* value = property->value(); | 409 Expression* value = property->value(); |
410 switch (property->kind()) { | 410 switch (property->kind()) { |
| 411 case ObjectLiteral::Property::SPREAD: |
411 case ObjectLiteral::Property::CONSTANT: | 412 case ObjectLiteral::Property::CONSTANT: |
412 UNREACHABLE(); | 413 UNREACHABLE(); |
413 case ObjectLiteral::Property::MATERIALIZED_LITERAL: | 414 case ObjectLiteral::Property::MATERIALIZED_LITERAL: |
414 // Fall through. | 415 // Fall through. |
415 case ObjectLiteral::Property::COMPUTED: | 416 case ObjectLiteral::Property::COMPUTED: |
416 // It is safe to use [[Put]] here because the boilerplate already | 417 // It is safe to use [[Put]] here because the boilerplate already |
417 // contains computed properties with an uninitialized value. | 418 // contains computed properties with an uninitialized value. |
418 if (key->value()->IsInternalizedString()) { | 419 if (key->value()->IsInternalizedString()) { |
419 if (property->emit_store()) { | 420 if (property->emit_store()) { |
420 property->SetSlot(spec->AddStoreICSlot()); | 421 property->SetSlot(spec->AddStoreICSlot()); |
(...skipping 539 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
960 // static | 961 // static |
961 bool Literal::Match(void* literal1, void* literal2) { | 962 bool Literal::Match(void* literal1, void* literal2) { |
962 const AstValue* x = static_cast<Literal*>(literal1)->raw_value(); | 963 const AstValue* x = static_cast<Literal*>(literal1)->raw_value(); |
963 const AstValue* y = static_cast<Literal*>(literal2)->raw_value(); | 964 const AstValue* y = static_cast<Literal*>(literal2)->raw_value(); |
964 return (x->IsString() && y->IsString() && x->AsString() == y->AsString()) || | 965 return (x->IsString() && y->IsString() && x->AsString() == y->AsString()) || |
965 (x->IsNumber() && y->IsNumber() && x->AsNumber() == y->AsNumber()); | 966 (x->IsNumber() && y->IsNumber() && x->AsNumber() == y->AsNumber()); |
966 } | 967 } |
967 | 968 |
968 } // namespace internal | 969 } // namespace internal |
969 } // namespace v8 | 970 } // namespace v8 |
OLD | NEW |