Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(178)

Side by Side Diff: src/ast/ast.cc

Issue 2606833002: [ESnext] Implement Object spread (Closed)
Patch Set: fix test Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/ast/ast.h ('k') | src/ast/prettyprinter.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 406 matching lines...) Expand 10 before | Expand all | Expand 10 after
417 // ics must mirror FullCodeGenerator::VisitObjectLiteral. 417 // ics must mirror FullCodeGenerator::VisitObjectLiteral.
418 int property_index = 0; 418 int property_index = 0;
419 for (; property_index < properties()->length(); property_index++) { 419 for (; property_index < properties()->length(); property_index++) {
420 ObjectLiteral::Property* property = properties()->at(property_index); 420 ObjectLiteral::Property* property = properties()->at(property_index);
421 if (property->is_computed_name()) break; 421 if (property->is_computed_name()) break;
422 if (property->IsCompileTimeValue()) continue; 422 if (property->IsCompileTimeValue()) continue;
423 423
424 Literal* key = property->key()->AsLiteral(); 424 Literal* key = property->key()->AsLiteral();
425 Expression* value = property->value(); 425 Expression* value = property->value();
426 switch (property->kind()) { 426 switch (property->kind()) {
427 case ObjectLiteral::Property::SPREAD:
427 case ObjectLiteral::Property::CONSTANT: 428 case ObjectLiteral::Property::CONSTANT:
428 UNREACHABLE(); 429 UNREACHABLE();
429 case ObjectLiteral::Property::MATERIALIZED_LITERAL: 430 case ObjectLiteral::Property::MATERIALIZED_LITERAL:
430 // Fall through. 431 // Fall through.
431 case ObjectLiteral::Property::COMPUTED: 432 case ObjectLiteral::Property::COMPUTED:
432 // It is safe to use [[Put]] here because the boilerplate already 433 // It is safe to use [[Put]] here because the boilerplate already
433 // contains computed properties with an uninitialized value. 434 // contains computed properties with an uninitialized value.
434 if (key->value()->IsInternalizedString()) { 435 if (key->value()->IsInternalizedString()) {
435 if (property->emit_store()) { 436 if (property->emit_store()) {
436 property->SetSlot(spec->AddStoreICSlot()); 437 property->SetSlot(spec->AddStoreICSlot());
(...skipping 541 matching lines...) Expand 10 before | Expand all | Expand 10 after
978 // static 979 // static
979 bool Literal::Match(void* literal1, void* literal2) { 980 bool Literal::Match(void* literal1, void* literal2) {
980 const AstValue* x = static_cast<Literal*>(literal1)->raw_value(); 981 const AstValue* x = static_cast<Literal*>(literal1)->raw_value();
981 const AstValue* y = static_cast<Literal*>(literal2)->raw_value(); 982 const AstValue* y = static_cast<Literal*>(literal2)->raw_value();
982 return (x->IsString() && y->IsString() && x->AsString() == y->AsString()) || 983 return (x->IsString() && y->IsString() && x->AsString() == y->AsString()) ||
983 (x->IsNumber() && y->IsNumber() && x->AsNumber() == y->AsNumber()); 984 (x->IsNumber() && y->IsNumber() && x->AsNumber() == y->AsNumber());
984 } 985 }
985 986
986 } // namespace internal 987 } // namespace internal
987 } // namespace v8 988 } // namespace v8
OLDNEW
« no previous file with comments | « src/ast/ast.h ('k') | src/ast/prettyprinter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698