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 631 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
642 set_is_simple(is_simple); | 642 set_is_simple(is_simple); |
643 set_depth(depth_acc); | 643 set_depth(depth_acc); |
644 } | 644 } |
645 | 645 |
646 | 646 |
647 void ArrayLiteral::AssignFeedbackVectorSlots(Isolate* isolate, | 647 void ArrayLiteral::AssignFeedbackVectorSlots(Isolate* isolate, |
648 FeedbackVectorSpec* spec, | 648 FeedbackVectorSpec* spec, |
649 FeedbackVectorSlotCache* cache) { | 649 FeedbackVectorSlotCache* cache) { |
650 // This logic that computes the number of slots needed for vector store | 650 // This logic that computes the number of slots needed for vector store |
651 // ics must mirror FullCodeGenerator::VisitArrayLiteral. | 651 // ics must mirror FullCodeGenerator::VisitArrayLiteral. |
652 int array_index = 0; | 652 for (int array_index = 0; array_index < values()->length(); array_index++) { |
653 for (; array_index < values()->length(); array_index++) { | |
654 Expression* subexpr = values()->at(array_index); | 653 Expression* subexpr = values()->at(array_index); |
655 DCHECK(!subexpr->IsSpread()); | 654 DCHECK(!subexpr->IsSpread()); |
656 if (CompileTimeValue::IsCompileTimeValue(subexpr)) continue; | 655 if (CompileTimeValue::IsCompileTimeValue(subexpr)) continue; |
657 | 656 |
658 // We'll reuse the same literal slot for all of the non-constant | 657 // We'll reuse the same literal slot for all of the non-constant |
659 // subexpressions that use a keyed store IC. | 658 // subexpressions that use a keyed store IC. |
660 literal_slot_ = spec->AddKeyedStoreICSlot(); | 659 literal_slot_ = spec->AddKeyedStoreICSlot(); |
661 return; | 660 return; |
662 } | 661 } |
663 } | 662 } |
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
959 // static | 958 // static |
960 bool Literal::Match(void* literal1, void* literal2) { | 959 bool Literal::Match(void* literal1, void* literal2) { |
961 const AstValue* x = static_cast<Literal*>(literal1)->raw_value(); | 960 const AstValue* x = static_cast<Literal*>(literal1)->raw_value(); |
962 const AstValue* y = static_cast<Literal*>(literal2)->raw_value(); | 961 const AstValue* y = static_cast<Literal*>(literal2)->raw_value(); |
963 return (x->IsString() && y->IsString() && x->AsString() == y->AsString()) || | 962 return (x->IsString() && y->IsString() && x->AsString() == y->AsString()) || |
964 (x->IsNumber() && y->IsNumber() && x->AsNumber() == y->AsNumber()); | 963 (x->IsNumber() && y->IsNumber() && x->AsNumber() == y->AsNumber()); |
965 } | 964 } |
966 | 965 |
967 } // namespace internal | 966 } // namespace internal |
968 } // namespace v8 | 967 } // namespace v8 |
OLD | NEW |