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 740 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
751 pre_parse_timer_(NULL) { | 751 pre_parse_timer_(NULL) { |
752 DCHECK(!script().is_null() || info->source_stream() != NULL); | 752 DCHECK(!script().is_null() || info->source_stream() != NULL); |
753 set_allow_harmony_scoping(!info->is_native() && FLAG_harmony_scoping); | 753 set_allow_harmony_scoping(!info->is_native() && FLAG_harmony_scoping); |
754 set_allow_modules(!info->is_native() && FLAG_harmony_modules); | 754 set_allow_modules(!info->is_native() && FLAG_harmony_modules); |
755 set_allow_natives_syntax(FLAG_allow_natives_syntax || info->is_native()); | 755 set_allow_natives_syntax(FLAG_allow_natives_syntax || info->is_native()); |
756 set_allow_lazy(false); // Must be explicitly enabled. | 756 set_allow_lazy(false); // Must be explicitly enabled. |
757 set_allow_arrow_functions(FLAG_harmony_arrow_functions); | 757 set_allow_arrow_functions(FLAG_harmony_arrow_functions); |
758 set_allow_harmony_numeric_literals(FLAG_harmony_numeric_literals); | 758 set_allow_harmony_numeric_literals(FLAG_harmony_numeric_literals); |
759 set_allow_classes(FLAG_harmony_classes); | 759 set_allow_classes(FLAG_harmony_classes); |
760 set_allow_harmony_object_literals(FLAG_harmony_object_literals); | 760 set_allow_harmony_object_literals(FLAG_harmony_object_literals); |
| 761 set_allow_harmony_templates(FLAG_harmony_templates); |
761 for (int feature = 0; feature < v8::Isolate::kUseCounterFeatureCount; | 762 for (int feature = 0; feature < v8::Isolate::kUseCounterFeatureCount; |
762 ++feature) { | 763 ++feature) { |
763 use_counts_[feature] = 0; | 764 use_counts_[feature] = 0; |
764 } | 765 } |
765 if (info->ast_value_factory() == NULL) { | 766 if (info->ast_value_factory() == NULL) { |
766 // info takes ownership of AstValueFactory. | 767 // info takes ownership of AstValueFactory. |
767 info->SetAstValueFactory( | 768 info->SetAstValueFactory( |
768 new AstValueFactory(zone(), parse_info->hash_seed)); | 769 new AstValueFactory(zone(), parse_info->hash_seed)); |
769 } | 770 } |
770 } | 771 } |
(...skipping 4189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4960 info()->SetFunction(result); | 4961 info()->SetFunction(result); |
4961 | 4962 |
4962 // We cannot internalize on a background thread; a foreground task will take | 4963 // We cannot internalize on a background thread; a foreground task will take |
4963 // care of calling Parser::Internalize just before compilation. | 4964 // care of calling Parser::Internalize just before compilation. |
4964 | 4965 |
4965 if (compile_options() == ScriptCompiler::kProduceParserCache) { | 4966 if (compile_options() == ScriptCompiler::kProduceParserCache) { |
4966 if (result != NULL) *info_->cached_data() = recorder.GetScriptData(); | 4967 if (result != NULL) *info_->cached_data() = recorder.GetScriptData(); |
4967 log_ = NULL; | 4968 log_ = NULL; |
4968 } | 4969 } |
4969 } | 4970 } |
| 4971 |
| 4972 |
| 4973 void Parser::AddTemplateSpan(TemplateLiteralState* state) { |
| 4974 // TODO: Make this work properly... |
| 4975 /*if (!state->spans_) { |
| 4976 state->spans_ = new (zone()) ZoneList<const AstTemplateSpan*>(8, zone()); |
| 4977 } |
| 4978 const AstRawString* tv = scanner()->CurrentSymbol(ast_value_factory()); |
| 4979 const AstRawString* trv = scanner()->CurrentRawSymbol(ast_value_factory()); |
| 4980 const AstTemplateSpan* span = ast_value_factory()->NewTemplateSpan(tv, trv); |
| 4981 state->spans_->Add(span, zone());*/ |
| 4982 } |
| 4983 |
| 4984 void Parser::AddTemplateExpression(TemplateLiteralState* state, |
| 4985 Expression* expression) { |
| 4986 // TODO: Make this work properly... |
| 4987 /*if (!state->expressions_) { |
| 4988 state->expressions_ = new(zone()) ZoneList<Expression*>(8, zone()); |
| 4989 } |
| 4990 state->expressions_->Add(expression, zone());*/ |
| 4991 } |
| 4992 |
| 4993 Expression* Parser::CloseTemplateLiteral(TemplateLiteralState* state, int pos) { |
| 4994 Expression* lit = |
| 4995 factory()->NewTemplateLiteral(state->spans_, state->expressions_, pos); |
| 4996 state->expressions_ = NULL; |
| 4997 state->spans_ = NULL; |
| 4998 return lit; |
| 4999 } |
4970 } } // namespace v8::internal | 5000 } } // namespace v8::internal |
OLD | NEW |