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

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

Issue 2651533002: [ast] Simplify NewBoilerplateDescription. (Closed)
Patch Set: Fix DCHECK. 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 | « no previous file | src/factory.h » ('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 585 matching lines...) Expand 10 before | Expand all | Expand 10 after
596 596
597 Handle<Object> key = property->key()->AsLiteral()->value(); 597 Handle<Object> key = property->key()->AsLiteral()->value();
598 598
599 uint32_t element_index = 0; 599 uint32_t element_index = 0;
600 if (key->ToArrayIndex(&element_index)) { 600 if (key->ToArrayIndex(&element_index)) {
601 index_keys++; 601 index_keys++;
602 } 602 }
603 } 603 }
604 604
605 Handle<BoilerplateDescription> constant_properties = 605 Handle<BoilerplateDescription> constant_properties =
606 isolate->factory()->NewBoilerplateDescription( 606 isolate->factory()->NewBoilerplateDescription(boilerplate_properties_,
607 boilerplate_properties_, properties()->length() - index_keys, 607 properties()->length(),
608 has_seen_proto); 608 index_keys, has_seen_proto);
609 609
610 int position = 0; 610 int position = 0;
611 for (int i = 0; i < properties()->length(); i++) { 611 for (int i = 0; i < properties()->length(); i++) {
612 ObjectLiteral::Property* property = properties()->at(i); 612 ObjectLiteral::Property* property = properties()->at(i);
613 if (!IsBoilerplateProperty(property)) { 613 if (!IsBoilerplateProperty(property)) {
614 continue; 614 continue;
615 } 615 }
616 616
617 if (static_cast<uint32_t>(position) == boilerplate_properties_ * 2) { 617 if (static_cast<uint32_t>(position) == boilerplate_properties_ * 2) {
618 DCHECK(property->is_computed_name()); 618 DCHECK(property->is_computed_name());
(...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after
1058 // static 1058 // static
1059 bool Literal::Match(void* literal1, void* literal2) { 1059 bool Literal::Match(void* literal1, void* literal2) {
1060 const AstValue* x = static_cast<Literal*>(literal1)->raw_value(); 1060 const AstValue* x = static_cast<Literal*>(literal1)->raw_value();
1061 const AstValue* y = static_cast<Literal*>(literal2)->raw_value(); 1061 const AstValue* y = static_cast<Literal*>(literal2)->raw_value();
1062 return (x->IsString() && y->IsString() && x->AsString() == y->AsString()) || 1062 return (x->IsString() && y->IsString() && x->AsString() == y->AsString()) ||
1063 (x->IsNumber() && y->IsNumber() && x->AsNumber() == y->AsNumber()); 1063 (x->IsNumber() && y->IsNumber() && x->AsNumber() == y->AsNumber());
1064 } 1064 }
1065 1065
1066 } // namespace internal 1066 } // namespace internal
1067 } // namespace v8 1067 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | src/factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698