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/parsing/parser.h" | 5 #include "src/parsing/parser.h" |
6 | 6 |
7 #include "src/api.h" | 7 #include "src/api.h" |
8 #include "src/ast/ast.h" | 8 #include "src/ast/ast.h" |
9 #include "src/ast/ast-expression-rewriter.h" | 9 #include "src/ast/ast-expression-rewriter.h" |
10 #include "src/ast/ast-expression-visitor.h" | 10 #include "src/ast/ast-expression-visitor.h" |
(...skipping 5309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5320 } else { | 5320 } else { |
5321 uint32_t hash = ComputeTemplateLiteralHash(lit); | 5321 uint32_t hash = ComputeTemplateLiteralHash(lit); |
5322 | 5322 |
5323 int cooked_idx = function_state_->NextMaterializedLiteralIndex(); | 5323 int cooked_idx = function_state_->NextMaterializedLiteralIndex(); |
5324 int raw_idx = function_state_->NextMaterializedLiteralIndex(); | 5324 int raw_idx = function_state_->NextMaterializedLiteralIndex(); |
5325 | 5325 |
5326 // $getTemplateCallSite | 5326 // $getTemplateCallSite |
5327 ZoneList<Expression*>* args = new (zone()) ZoneList<Expression*>(4, zone()); | 5327 ZoneList<Expression*>* args = new (zone()) ZoneList<Expression*>(4, zone()); |
5328 args->Add(factory()->NewArrayLiteral( | 5328 args->Add(factory()->NewArrayLiteral( |
5329 const_cast<ZoneList<Expression*>*>(cooked_strings), | 5329 const_cast<ZoneList<Expression*>*>(cooked_strings), |
5330 cooked_idx, is_strong(language_mode()), pos), | 5330 cooked_idx, pos), |
5331 zone()); | 5331 zone()); |
5332 args->Add( | 5332 args->Add( |
5333 factory()->NewArrayLiteral( | 5333 factory()->NewArrayLiteral( |
5334 const_cast<ZoneList<Expression*>*>(raw_strings), raw_idx, | 5334 const_cast<ZoneList<Expression*>*>(raw_strings), raw_idx, pos), |
5335 is_strong(language_mode()), pos), | |
5336 zone()); | 5335 zone()); |
5337 | 5336 |
5338 // Ensure hash is suitable as a Smi value | 5337 // Ensure hash is suitable as a Smi value |
5339 Smi* hash_obj = Smi::cast(Internals::IntToSmi(static_cast<int>(hash))); | 5338 Smi* hash_obj = Smi::cast(Internals::IntToSmi(static_cast<int>(hash))); |
5340 args->Add(factory()->NewSmiLiteral(hash_obj->value(), pos), zone()); | 5339 args->Add(factory()->NewSmiLiteral(hash_obj->value(), pos), zone()); |
5341 | 5340 |
5342 Expression* call_site = factory()->NewCallRuntime( | 5341 Expression* call_site = factory()->NewCallRuntime( |
5343 Context::GET_TEMPLATE_CALL_SITE_INDEX, args, start); | 5342 Context::GET_TEMPLATE_CALL_SITE_INDEX, args, start); |
5344 | 5343 |
5345 // Call TagFn | 5344 // Call TagFn |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5414 if (!list->at(i)->IsSpread()) { | 5413 if (!list->at(i)->IsSpread()) { |
5415 ZoneList<v8::internal::Expression*>* unspread = | 5414 ZoneList<v8::internal::Expression*>* unspread = |
5416 new (zone()) ZoneList<v8::internal::Expression*>(1, zone()); | 5415 new (zone()) ZoneList<v8::internal::Expression*>(1, zone()); |
5417 | 5416 |
5418 // Push array of unspread parameters | 5417 // Push array of unspread parameters |
5419 while (i < n && !list->at(i)->IsSpread()) { | 5418 while (i < n && !list->at(i)->IsSpread()) { |
5420 unspread->Add(list->at(i++), zone()); | 5419 unspread->Add(list->at(i++), zone()); |
5421 } | 5420 } |
5422 int literal_index = function_state_->NextMaterializedLiteralIndex(); | 5421 int literal_index = function_state_->NextMaterializedLiteralIndex(); |
5423 args->Add(factory()->NewArrayLiteral(unspread, literal_index, | 5422 args->Add(factory()->NewArrayLiteral(unspread, literal_index, |
5424 is_strong(language_mode()), | |
5425 RelocInfo::kNoPosition), | 5423 RelocInfo::kNoPosition), |
5426 zone()); | 5424 zone()); |
5427 | 5425 |
5428 if (i == n) break; | 5426 if (i == n) break; |
5429 } | 5427 } |
5430 | 5428 |
5431 // Push eagerly spread argument | 5429 // Push eagerly spread argument |
5432 ZoneList<v8::internal::Expression*>* spread_list = | 5430 ZoneList<v8::internal::Expression*>* spread_list = |
5433 new (zone()) ZoneList<v8::internal::Expression*>(1, zone()); | 5431 new (zone()) ZoneList<v8::internal::Expression*>(1, zone()); |
5434 spread_list->Add(list->at(i++)->AsSpread()->expression(), zone()); | 5432 spread_list->Add(list->at(i++)->AsSpread()->expression(), zone()); |
(...skipping 1497 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6932 Expression* do_each = | 6930 Expression* do_each = |
6933 factory->NewDoExpression(new_assign_each, var_each, nopos); | 6931 factory->NewDoExpression(new_assign_each, var_each, nopos); |
6934 loop->set_assign_each(do_each); | 6932 loop->set_assign_each(do_each); |
6935 | 6933 |
6936 return final_loop; | 6934 return final_loop; |
6937 } | 6935 } |
6938 | 6936 |
6939 | 6937 |
6940 } // namespace internal | 6938 } // namespace internal |
6941 } // namespace v8 | 6939 } // namespace v8 |
OLD | NEW |