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

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

Issue 2632503003: [runtime] Allocate space for computed property names (Closed)
Patch Set: Comments and reorder. 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/compiler/access-info.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 564 matching lines...) Expand 10 before | Expand all | Expand 10 after
575 (max_element_index <= 32) || ((2 * elements) >= max_element_index)); 575 (max_element_index <= 32) || ((2 * elements) >= max_element_index));
576 bit_field_ = HasElementsField::update(bit_field_, elements > 0); 576 bit_field_ = HasElementsField::update(bit_field_, elements > 0);
577 577
578 set_is_simple(is_simple); 578 set_is_simple(is_simple);
579 set_depth(depth_acc); 579 set_depth(depth_acc);
580 } 580 }
581 581
582 void ObjectLiteral::BuildConstantProperties(Isolate* isolate) { 582 void ObjectLiteral::BuildConstantProperties(Isolate* isolate) {
583 if (!constant_properties_.is_null()) return; 583 if (!constant_properties_.is_null()) return;
584 584
585 // Allocate a fixed array to hold all the constant properties. 585 Handle<BoilerplateDescription> constant_properties =
586 Handle<FixedArray> constant_properties = 586 isolate->factory()->NewBoilerplateDescription(
587 isolate->factory()->NewFixedArray(boilerplate_properties_ * 2, TENURED); 587 boilerplate_properties_, properties()->length(), has_seen_proto());
588 588
589 int position = 0; 589 int position = 0;
590 for (int i = 0; i < properties()->length(); i++) { 590 for (int i = 0; i < properties()->length(); i++) {
591 ObjectLiteral::Property* property = properties()->at(i); 591 ObjectLiteral::Property* property = properties()->at(i);
592 if (!IsBoilerplateProperty(property)) { 592 if (!IsBoilerplateProperty(property)) {
593 continue; 593 continue;
594 } 594 }
595 595
596 if (static_cast<uint32_t>(position) == boilerplate_properties_ * 2) { 596 if (static_cast<uint32_t>(position) == boilerplate_properties_ * 2) {
597 DCHECK(property->is_computed_name()); 597 DCHECK(property->is_computed_name());
(...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after
1037 // static 1037 // static
1038 bool Literal::Match(void* literal1, void* literal2) { 1038 bool Literal::Match(void* literal1, void* literal2) {
1039 const AstValue* x = static_cast<Literal*>(literal1)->raw_value(); 1039 const AstValue* x = static_cast<Literal*>(literal1)->raw_value();
1040 const AstValue* y = static_cast<Literal*>(literal2)->raw_value(); 1040 const AstValue* y = static_cast<Literal*>(literal2)->raw_value();
1041 return (x->IsString() && y->IsString() && x->AsString() == y->AsString()) || 1041 return (x->IsString() && y->IsString() && x->AsString() == y->AsString()) ||
1042 (x->IsNumber() && y->IsNumber() && x->AsNumber() == y->AsNumber()); 1042 (x->IsNumber() && y->IsNumber() && x->AsNumber() == y->AsNumber());
1043 } 1043 }
1044 1044
1045 } // namespace internal 1045 } // namespace internal
1046 } // namespace v8 1046 } // namespace v8
OLDNEW
« no previous file with comments | « src/ast/ast.h ('k') | src/compiler/access-info.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698