| 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.h" | 5 #include "src/ast.h" |
| 6 | 6 |
| 7 #include <cmath> // For isfinite. | 7 #include <cmath> // For isfinite. |
| 8 #include "src/builtins.h" | 8 #include "src/builtins.h" |
| 9 #include "src/code-stubs.h" | 9 #include "src/code-stubs.h" |
| 10 #include "src/contexts.h" | 10 #include "src/contexts.h" |
| (...skipping 529 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 540 | 540 |
| 541 literals->set(0, Smi::FromInt(kind)); | 541 literals->set(0, Smi::FromInt(kind)); |
| 542 literals->set(1, *element_values); | 542 literals->set(1, *element_values); |
| 543 | 543 |
| 544 constant_elements_ = literals; | 544 constant_elements_ = literals; |
| 545 set_is_simple(is_simple); | 545 set_is_simple(is_simple); |
| 546 set_depth(depth_acc); | 546 set_depth(depth_acc); |
| 547 } | 547 } |
| 548 | 548 |
| 549 | 549 |
| 550 void ArrayLiteral::AssignFeedbackVectorSlots(Isolate* isolate, |
| 551 FeedbackVectorSpec* spec, |
| 552 FeedbackVectorSlotCache* cache) { |
| 553 if (!FLAG_vector_stores) return; |
| 554 |
| 555 // This logic that computes the number of slots needed for vector store |
| 556 // ics must mirror FullCodeGenerator::VisitArrayLiteral. |
| 557 int array_index = 0; |
| 558 for (; array_index < values()->length(); array_index++) { |
| 559 Expression* subexpr = values()->at(array_index); |
| 560 if (subexpr->IsSpread()) break; |
| 561 if (CompileTimeValue::IsCompileTimeValue(subexpr)) continue; |
| 562 |
| 563 // We'll reuse the same literal slot for all of the non-constant |
| 564 // subexpressions that use a keyed store IC. |
| 565 literal_slot_ = spec->AddKeyedStoreICSlot(); |
| 566 return; |
| 567 } |
| 568 } |
| 569 |
| 570 |
| 550 Handle<Object> MaterializedLiteral::GetBoilerplateValue(Expression* expression, | 571 Handle<Object> MaterializedLiteral::GetBoilerplateValue(Expression* expression, |
| 551 Isolate* isolate) { | 572 Isolate* isolate) { |
| 552 if (expression->IsLiteral()) { | 573 if (expression->IsLiteral()) { |
| 553 return expression->AsLiteral()->value(); | 574 return expression->AsLiteral()->value(); |
| 554 } | 575 } |
| 555 if (CompileTimeValue::IsCompileTimeValue(expression)) { | 576 if (CompileTimeValue::IsCompileTimeValue(expression)) { |
| 556 return CompileTimeValue::GetValue(isolate, expression); | 577 return CompileTimeValue::GetValue(isolate, expression); |
| 557 } | 578 } |
| 558 return isolate->factory()->uninitialized_value(); | 579 return isolate->factory()->uninitialized_value(); |
| 559 } | 580 } |
| (...skipping 563 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1123 bool Literal::Match(void* literal1, void* literal2) { | 1144 bool Literal::Match(void* literal1, void* literal2) { |
| 1124 const AstValue* x = static_cast<Literal*>(literal1)->raw_value(); | 1145 const AstValue* x = static_cast<Literal*>(literal1)->raw_value(); |
| 1125 const AstValue* y = static_cast<Literal*>(literal2)->raw_value(); | 1146 const AstValue* y = static_cast<Literal*>(literal2)->raw_value(); |
| 1126 return (x->IsString() && y->IsString() && x->AsString() == y->AsString()) || | 1147 return (x->IsString() && y->IsString() && x->AsString() == y->AsString()) || |
| 1127 (x->IsNumber() && y->IsNumber() && x->AsNumber() == y->AsNumber()); | 1148 (x->IsNumber() && y->IsNumber() && x->AsNumber() == y->AsNumber()); |
| 1128 } | 1149 } |
| 1129 | 1150 |
| 1130 | 1151 |
| 1131 } // namespace internal | 1152 } // namespace internal |
| 1132 } // namespace v8 | 1153 } // namespace v8 |
| OLD | NEW |