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

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

Issue 2605893002: [builtins] More stubs to the builtin-o-sphere. (Closed)
Patch Set: Fixed compile error. 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/builtins/builtins.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"
11 #include "src/ast/scopes.h" 11 #include "src/ast/scopes.h"
12 #include "src/base/hashmap.h" 12 #include "src/base/hashmap.h"
13 #include "src/builtins/builtins-constructor.h"
13 #include "src/builtins/builtins.h" 14 #include "src/builtins/builtins.h"
14 #include "src/code-stubs.h" 15 #include "src/code-stubs.h"
15 #include "src/contexts.h" 16 #include "src/contexts.h"
16 #include "src/conversions.h" 17 #include "src/conversions.h"
17 #include "src/elements.h" 18 #include "src/elements.h"
18 #include "src/property-details.h" 19 #include "src/property-details.h"
19 #include "src/property.h" 20 #include "src/property.h"
20 #include "src/string-stream.h" 21 #include "src/string-stream.h"
21 #include "src/type-info.h" 22 #include "src/type-info.h"
22 23
(...skipping 547 matching lines...) Expand 10 before | Expand all | Expand 10 after
570 bit_field_ = FastElementsField::update( 571 bit_field_ = FastElementsField::update(
571 bit_field_, 572 bit_field_,
572 (max_element_index <= 32) || ((2 * elements) >= max_element_index)); 573 (max_element_index <= 32) || ((2 * elements) >= max_element_index));
573 bit_field_ = HasElementsField::update(bit_field_, elements > 0); 574 bit_field_ = HasElementsField::update(bit_field_, elements > 0);
574 575
575 set_is_simple(is_simple); 576 set_is_simple(is_simple);
576 set_depth(depth_acc); 577 set_depth(depth_acc);
577 } 578 }
578 579
579 bool ObjectLiteral::IsFastCloningSupported() const { 580 bool ObjectLiteral::IsFastCloningSupported() const {
580 // FastCloneShallowObjectStub doesn't copy elements, and object literals don't 581 // The FastCloneShallowObject builtin doesn't copy elements, and object
581 // support copy-on-write (COW) elements for now. 582 // literals don't support copy-on-write (COW) elements for now.
582 // TODO(mvstanton): make object literals support COW elements. 583 // TODO(mvstanton): make object literals support COW elements.
583 return fast_elements() && has_shallow_properties() && 584 return fast_elements() && has_shallow_properties() &&
584 properties_count() <= 585 properties_count() <= ConstructorBuiltinsAssembler::
585 FastCloneShallowObjectStub::kMaximumClonedProperties; 586 kMaximumClonedShallowObjectProperties;
586 } 587 }
587 588
588 void ArrayLiteral::BuildConstantElements(Isolate* isolate) { 589 void ArrayLiteral::BuildConstantElements(Isolate* isolate) {
589 DCHECK_LT(first_spread_index_, 0); 590 DCHECK_LT(first_spread_index_, 0);
590 591
591 if (!constant_elements_.is_null()) return; 592 if (!constant_elements_.is_null()) return;
592 593
593 int constants_length = values()->length(); 594 int constants_length = values()->length();
594 ElementsKind kind = FIRST_FAST_ELEMENTS_KIND; 595 ElementsKind kind = FIRST_FAST_ELEMENTS_KIND;
595 Handle<FixedArray> fixed_array = 596 Handle<FixedArray> fixed_array =
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
652 isolate->factory()->NewConstantElementsPair(kind, elements); 653 isolate->factory()->NewConstantElementsPair(kind, elements);
653 654
654 constant_elements_ = literals; 655 constant_elements_ = literals;
655 set_is_simple(is_simple); 656 set_is_simple(is_simple);
656 set_depth(depth_acc); 657 set_depth(depth_acc);
657 } 658 }
658 659
659 bool ArrayLiteral::IsFastCloningSupported() const { 660 bool ArrayLiteral::IsFastCloningSupported() const {
660 return depth() <= 1 && 661 return depth() <= 1 &&
661 values()->length() <= 662 values()->length() <=
662 FastCloneShallowArrayStub::kMaximumClonedElements; 663 ConstructorBuiltinsAssembler::kMaximumClonedShallowArrayElements;
663 } 664 }
664 665
665 void ArrayLiteral::AssignFeedbackVectorSlots(Isolate* isolate, 666 void ArrayLiteral::AssignFeedbackVectorSlots(Isolate* isolate,
666 FeedbackVectorSpec* spec, 667 FeedbackVectorSpec* spec,
667 FeedbackVectorSlotCache* cache) { 668 FeedbackVectorSlotCache* cache) {
668 // This logic that computes the number of slots needed for vector store 669 // This logic that computes the number of slots needed for vector store
669 // ics must mirror FullCodeGenerator::VisitArrayLiteral. 670 // ics must mirror FullCodeGenerator::VisitArrayLiteral.
670 for (int array_index = 0; array_index < values()->length(); array_index++) { 671 for (int array_index = 0; array_index < values()->length(); array_index++) {
671 Expression* subexpr = values()->at(array_index); 672 Expression* subexpr = values()->at(array_index);
672 DCHECK(!subexpr->IsSpread()); 673 DCHECK(!subexpr->IsSpread());
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
OLDNEW
« no previous file with comments | « src/ast/ast.h ('k') | src/builtins/builtins.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698