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 <memory> | 7 #include <memory> |
8 | 8 |
9 #include "src/api.h" | 9 #include "src/api.h" |
10 #include "src/ast/ast.h" | 10 #include "src/ast/ast.h" |
(...skipping 770 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
781 | 781 |
782 | 782 |
783 Expression* ParserTraits::GetIterator(Expression* iterable, | 783 Expression* ParserTraits::GetIterator(Expression* iterable, |
784 AstNodeFactory* factory, int pos) { | 784 AstNodeFactory* factory, int pos) { |
785 Expression* iterator_symbol_literal = | 785 Expression* iterator_symbol_literal = |
786 factory->NewSymbolLiteral("iterator_symbol", kNoSourcePosition); | 786 factory->NewSymbolLiteral("iterator_symbol", kNoSourcePosition); |
787 Expression* prop = | 787 Expression* prop = |
788 factory->NewProperty(iterable, iterator_symbol_literal, pos); | 788 factory->NewProperty(iterable, iterator_symbol_literal, pos); |
789 Zone* zone = parser_->zone(); | 789 Zone* zone = parser_->zone(); |
790 ZoneList<Expression*>* args = new (zone) ZoneList<Expression*>(0, zone); | 790 ZoneList<Expression*>* args = new (zone) ZoneList<Expression*>(0, zone); |
791 return factory->NewCall(prop, args, pos); | 791 return factory->NewCall(prop, args, pos, Call::NOT_EVAL); |
792 } | 792 } |
793 | 793 |
794 | 794 |
795 Literal* ParserTraits::GetLiteralTheHole(int position, | 795 Literal* ParserTraits::GetLiteralTheHole(int position, |
796 AstNodeFactory* factory) { | 796 AstNodeFactory* factory) { |
797 return factory->NewTheHoleLiteral(kNoSourcePosition); | 797 return factory->NewTheHoleLiteral(kNoSourcePosition); |
798 } | 798 } |
799 | 799 |
800 | 800 |
801 Expression* ParserTraits::ParseV8Intrinsic(bool* ok) { | 801 Expression* ParserTraits::ParseV8Intrinsic(bool* ok) { |
(...skipping 2390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3192 // %ThrowIteratorResultNotAnObject(result) | 3192 // %ThrowIteratorResultNotAnObject(result) |
3193 Expression* Parser::BuildIteratorNextResult(Expression* iterator, | 3193 Expression* Parser::BuildIteratorNextResult(Expression* iterator, |
3194 Variable* result, int pos) { | 3194 Variable* result, int pos) { |
3195 Expression* next_literal = factory()->NewStringLiteral( | 3195 Expression* next_literal = factory()->NewStringLiteral( |
3196 ast_value_factory()->next_string(), kNoSourcePosition); | 3196 ast_value_factory()->next_string(), kNoSourcePosition); |
3197 Expression* next_property = | 3197 Expression* next_property = |
3198 factory()->NewProperty(iterator, next_literal, kNoSourcePosition); | 3198 factory()->NewProperty(iterator, next_literal, kNoSourcePosition); |
3199 ZoneList<Expression*>* next_arguments = | 3199 ZoneList<Expression*>* next_arguments = |
3200 new (zone()) ZoneList<Expression*>(0, zone()); | 3200 new (zone()) ZoneList<Expression*>(0, zone()); |
3201 Expression* next_call = | 3201 Expression* next_call = |
3202 factory()->NewCall(next_property, next_arguments, pos); | 3202 factory()->NewCall(next_property, next_arguments, pos, Call::NOT_EVAL); |
3203 Expression* result_proxy = factory()->NewVariableProxy(result); | 3203 Expression* result_proxy = factory()->NewVariableProxy(result); |
3204 Expression* left = | 3204 Expression* left = |
3205 factory()->NewAssignment(Token::ASSIGN, result_proxy, next_call, pos); | 3205 factory()->NewAssignment(Token::ASSIGN, result_proxy, next_call, pos); |
3206 | 3206 |
3207 // %_IsJSReceiver(...) | 3207 // %_IsJSReceiver(...) |
3208 ZoneList<Expression*>* is_spec_object_args = | 3208 ZoneList<Expression*>* is_spec_object_args = |
3209 new (zone()) ZoneList<Expression*>(1, zone()); | 3209 new (zone()) ZoneList<Expression*>(1, zone()); |
3210 is_spec_object_args->Add(left, zone()); | 3210 is_spec_object_args->Add(left, zone()); |
3211 Expression* is_spec_object_call = factory()->NewCallRuntime( | 3211 Expression* is_spec_object_call = factory()->NewCallRuntime( |
3212 Runtime::kInlineIsJSReceiver, is_spec_object_args, pos); | 3212 Runtime::kInlineIsJSReceiver, is_spec_object_args, pos); |
(...skipping 2338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5551 const_cast<ZoneList<Expression*>*>(raw_strings), raw_idx, pos), | 5551 const_cast<ZoneList<Expression*>*>(raw_strings), raw_idx, pos), |
5552 zone()); | 5552 zone()); |
5553 | 5553 |
5554 // Ensure hash is suitable as a Smi value | 5554 // Ensure hash is suitable as a Smi value |
5555 Smi* hash_obj = Smi::cast(Internals::IntToSmi(static_cast<int>(hash))); | 5555 Smi* hash_obj = Smi::cast(Internals::IntToSmi(static_cast<int>(hash))); |
5556 args->Add(factory()->NewSmiLiteral(hash_obj->value(), pos), zone()); | 5556 args->Add(factory()->NewSmiLiteral(hash_obj->value(), pos), zone()); |
5557 | 5557 |
5558 Expression* call_site = factory()->NewCallRuntime( | 5558 Expression* call_site = factory()->NewCallRuntime( |
5559 Context::GET_TEMPLATE_CALL_SITE_INDEX, args, start); | 5559 Context::GET_TEMPLATE_CALL_SITE_INDEX, args, start); |
5560 | 5560 |
5561 Call::PossiblyEval is_possibly_eval = CheckPossibleEvalCall(tag, scope()); | |
rmcilroy
2016/08/11 21:27:59
This call updates the scopes to record the eval ca
adamk
2016/08/11 21:42:31
There used to be a call to CheckPossibleEvalCall h
rmcilroy
2016/08/12 09:18:20
The reason I added this is that when I took it out
| |
5562 | |
5561 // Call TagFn | 5563 // Call TagFn |
5562 ZoneList<Expression*>* call_args = | 5564 ZoneList<Expression*>* call_args = |
5563 new (zone()) ZoneList<Expression*>(expressions->length() + 1, zone()); | 5565 new (zone()) ZoneList<Expression*>(expressions->length() + 1, zone()); |
5564 call_args->Add(call_site, zone()); | 5566 call_args->Add(call_site, zone()); |
5565 call_args->AddAll(*expressions, zone()); | 5567 call_args->AddAll(*expressions, zone()); |
5566 return factory()->NewCall(tag, call_args, pos); | 5568 return factory()->NewCall(tag, call_args, pos, is_possibly_eval); |
5567 } | 5569 } |
5568 } | 5570 } |
5569 | 5571 |
5570 | 5572 |
5571 uint32_t Parser::ComputeTemplateLiteralHash(const TemplateLiteral* lit) { | 5573 uint32_t Parser::ComputeTemplateLiteralHash(const TemplateLiteral* lit) { |
5572 const ZoneList<Expression*>* raw_strings = lit->raw(); | 5574 const ZoneList<Expression*>* raw_strings = lit->raw(); |
5573 int total = raw_strings->length(); | 5575 int total = raw_strings->length(); |
5574 DCHECK(total); | 5576 DCHECK(total); |
5575 | 5577 |
5576 uint32_t running_hash = 0; | 5578 uint32_t running_hash = 0; |
(...skipping 692 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6269 Statement* call_next; | 6271 Statement* call_next; |
6270 { | 6272 { |
6271 Expression* iterator_proxy = factory->NewVariableProxy(var_iterator); | 6273 Expression* iterator_proxy = factory->NewVariableProxy(var_iterator); |
6272 Expression* literal = | 6274 Expression* literal = |
6273 factory->NewStringLiteral(avfactory->next_string(), nopos); | 6275 factory->NewStringLiteral(avfactory->next_string(), nopos); |
6274 Expression* next_property = | 6276 Expression* next_property = |
6275 factory->NewProperty(iterator_proxy, literal, nopos); | 6277 factory->NewProperty(iterator_proxy, literal, nopos); |
6276 Expression* input_proxy = factory->NewVariableProxy(var_input); | 6278 Expression* input_proxy = factory->NewVariableProxy(var_input); |
6277 auto args = new (zone) ZoneList<Expression*>(1, zone); | 6279 auto args = new (zone) ZoneList<Expression*>(1, zone); |
6278 args->Add(input_proxy, zone); | 6280 args->Add(input_proxy, zone); |
6279 Expression* call = factory->NewCall(next_property, args, nopos); | 6281 Expression* call = |
6282 factory->NewCall(next_property, args, nopos, Call::NOT_EVAL); | |
6280 Expression* output_proxy = factory->NewVariableProxy(var_output); | 6283 Expression* output_proxy = factory->NewVariableProxy(var_output); |
6281 Expression* assignment = | 6284 Expression* assignment = |
6282 factory->NewAssignment(Token::ASSIGN, output_proxy, call, nopos); | 6285 factory->NewAssignment(Token::ASSIGN, output_proxy, call, nopos); |
6283 call_next = factory->NewExpressionStatement(assignment, nopos); | 6286 call_next = factory->NewExpressionStatement(assignment, nopos); |
6284 } | 6287 } |
6285 | 6288 |
6286 | 6289 |
6287 // if (!IS_RECEIVER(output)) %ThrowIterResultNotAnObject(output); | 6290 // if (!IS_RECEIVER(output)) %ThrowIterResultNotAnObject(output); |
6288 Statement* validate_next_output; | 6291 Statement* validate_next_output; |
6289 { | 6292 { |
(...skipping 780 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
7070 node->Print(Isolate::Current()); | 7073 node->Print(Isolate::Current()); |
7071 } | 7074 } |
7072 #endif // DEBUG | 7075 #endif // DEBUG |
7073 | 7076 |
7074 #undef CHECK_OK | 7077 #undef CHECK_OK |
7075 #undef CHECK_OK_VOID | 7078 #undef CHECK_OK_VOID |
7076 #undef CHECK_FAILED | 7079 #undef CHECK_FAILED |
7077 | 7080 |
7078 } // namespace internal | 7081 } // namespace internal |
7079 } // namespace v8 | 7082 } // namespace v8 |
OLD | NEW |