| 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/v8.h" | 5 #include "src/v8.h" |
| 6 | 6 |
| 7 #include "src/api.h" | 7 #include "src/api.h" |
| 8 #include "src/ast.h" | 8 #include "src/ast.h" |
| 9 #include "src/bailout-reason.h" | 9 #include "src/bailout-reason.h" |
| 10 #include "src/base/platform/platform.h" | 10 #include "src/base/platform/platform.h" |
| (...skipping 5551 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5562 } else { | 5562 } else { |
| 5563 uint32_t hash = ComputeTemplateLiteralHash(lit); | 5563 uint32_t hash = ComputeTemplateLiteralHash(lit); |
| 5564 | 5564 |
| 5565 int cooked_idx = function_state_->NextMaterializedLiteralIndex(); | 5565 int cooked_idx = function_state_->NextMaterializedLiteralIndex(); |
| 5566 int raw_idx = function_state_->NextMaterializedLiteralIndex(); | 5566 int raw_idx = function_state_->NextMaterializedLiteralIndex(); |
| 5567 | 5567 |
| 5568 // $getTemplateCallSite | 5568 // $getTemplateCallSite |
| 5569 ZoneList<Expression*>* args = new (zone()) ZoneList<Expression*>(4, zone()); | 5569 ZoneList<Expression*>* args = new (zone()) ZoneList<Expression*>(4, zone()); |
| 5570 args->Add(factory()->NewArrayLiteral( | 5570 args->Add(factory()->NewArrayLiteral( |
| 5571 const_cast<ZoneList<Expression*>*>(cooked_strings), | 5571 const_cast<ZoneList<Expression*>*>(cooked_strings), |
| 5572 cooked_idx, pos), | 5572 cooked_idx, is_strong(language_mode()), pos), |
| 5573 zone()); | 5573 zone()); |
| 5574 args->Add( | 5574 args->Add( |
| 5575 factory()->NewArrayLiteral( | 5575 factory()->NewArrayLiteral( |
| 5576 const_cast<ZoneList<Expression*>*>(raw_strings), raw_idx, pos), | 5576 const_cast<ZoneList<Expression*>*>(raw_strings), raw_idx, |
| 5577 is_strong(language_mode()), pos), |
| 5577 zone()); | 5578 zone()); |
| 5578 | 5579 |
| 5579 // Ensure hash is suitable as a Smi value | 5580 // Ensure hash is suitable as a Smi value |
| 5580 Smi* hash_obj = Smi::cast(Internals::IntToSmi(static_cast<int>(hash))); | 5581 Smi* hash_obj = Smi::cast(Internals::IntToSmi(static_cast<int>(hash))); |
| 5581 args->Add(factory()->NewSmiLiteral(hash_obj->value(), pos), zone()); | 5582 args->Add(factory()->NewSmiLiteral(hash_obj->value(), pos), zone()); |
| 5582 | 5583 |
| 5583 this->CheckPossibleEvalCall(tag, scope_); | 5584 this->CheckPossibleEvalCall(tag, scope_); |
| 5584 Expression* call_site = factory()->NewCallRuntime( | 5585 Expression* call_site = factory()->NewCallRuntime( |
| 5585 ast_value_factory()->get_template_callsite_string(), NULL, args, start); | 5586 ast_value_factory()->get_template_callsite_string(), NULL, args, start); |
| 5586 | 5587 |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5657 if (!list->at(i)->IsSpread()) { | 5658 if (!list->at(i)->IsSpread()) { |
| 5658 ZoneList<v8::internal::Expression*>* unspread = | 5659 ZoneList<v8::internal::Expression*>* unspread = |
| 5659 new (zone()) ZoneList<v8::internal::Expression*>(1, zone()); | 5660 new (zone()) ZoneList<v8::internal::Expression*>(1, zone()); |
| 5660 | 5661 |
| 5661 // Push array of unspread parameters | 5662 // Push array of unspread parameters |
| 5662 while (i < n && !list->at(i)->IsSpread()) { | 5663 while (i < n && !list->at(i)->IsSpread()) { |
| 5663 unspread->Add(list->at(i++), zone()); | 5664 unspread->Add(list->at(i++), zone()); |
| 5664 } | 5665 } |
| 5665 int literal_index = function_state_->NextMaterializedLiteralIndex(); | 5666 int literal_index = function_state_->NextMaterializedLiteralIndex(); |
| 5666 args->Add(factory()->NewArrayLiteral(unspread, literal_index, | 5667 args->Add(factory()->NewArrayLiteral(unspread, literal_index, |
| 5668 is_strong(language_mode()), |
| 5667 RelocInfo::kNoPosition), | 5669 RelocInfo::kNoPosition), |
| 5668 zone()); | 5670 zone()); |
| 5669 | 5671 |
| 5670 if (i == n) break; | 5672 if (i == n) break; |
| 5671 } | 5673 } |
| 5672 | 5674 |
| 5673 // Push eagerly spread argument | 5675 // Push eagerly spread argument |
| 5674 ZoneList<v8::internal::Expression*>* spread_list = | 5676 ZoneList<v8::internal::Expression*>* spread_list = |
| 5675 new (zone()) ZoneList<v8::internal::Expression*>(1, zone()); | 5677 new (zone()) ZoneList<v8::internal::Expression*>(1, zone()); |
| 5676 spread_list->Add(list->at(i++)->AsSpread()->expression(), zone()); | 5678 spread_list->Add(list->at(i++)->AsSpread()->expression(), zone()); |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5733 | 5735 |
| 5734 Expression* Parser::SpreadCallNew(Expression* function, | 5736 Expression* Parser::SpreadCallNew(Expression* function, |
| 5735 ZoneList<v8::internal::Expression*>* args, | 5737 ZoneList<v8::internal::Expression*>* args, |
| 5736 int pos) { | 5738 int pos) { |
| 5737 args->InsertAt(0, function, zone()); | 5739 args->InsertAt(0, function, zone()); |
| 5738 | 5740 |
| 5739 return factory()->NewCallRuntime( | 5741 return factory()->NewCallRuntime( |
| 5740 ast_value_factory()->reflect_construct_string(), NULL, args, pos); | 5742 ast_value_factory()->reflect_construct_string(), NULL, args, pos); |
| 5741 } | 5743 } |
| 5742 } } // namespace v8::internal | 5744 } } // namespace v8::internal |
| OLD | NEW |