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