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-expression-rewriter.h" | 10 #include "src/ast/ast-expression-rewriter.h" |
(...skipping 3791 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3802 isolate->CountUsage(v8::Isolate::kHtmlCommentInExternalScript); | 3802 isolate->CountUsage(v8::Isolate::kHtmlCommentInExternalScript); |
3803 } | 3803 } |
3804 } | 3804 } |
3805 isolate->counters()->total_preparse_skipped()->Increment( | 3805 isolate->counters()->total_preparse_skipped()->Increment( |
3806 total_preparse_skipped_); | 3806 total_preparse_skipped_); |
3807 if (!parsing_on_main_thread_ && | 3807 if (!parsing_on_main_thread_ && |
3808 FLAG_runtime_stats == | 3808 FLAG_runtime_stats == |
3809 v8::tracing::TracingCategoryObserver::ENABLED_BY_NATIVE) { | 3809 v8::tracing::TracingCategoryObserver::ENABLED_BY_NATIVE) { |
3810 // Copy over the counters from the background thread to the main counters on | 3810 // Copy over the counters from the background thread to the main counters on |
3811 // the isolate. | 3811 // the isolate. |
3812 // TODO(cbruni,lpy): properly attach the runtime stats to the trace for | |
3813 // background parsing. | |
3814 isolate->counters()->runtime_call_stats()->Add(runtime_call_stats_); | 3812 isolate->counters()->runtime_call_stats()->Add(runtime_call_stats_); |
3815 } | 3813 } |
3816 } | 3814 } |
3817 | 3815 |
3818 void Parser::ParseOnBackground(ParseInfo* info) { | 3816 void Parser::ParseOnBackground(ParseInfo* info) { |
3819 parsing_on_main_thread_ = false; | 3817 parsing_on_main_thread_ = false; |
3820 | 3818 |
3821 DCHECK(info->literal() == NULL); | 3819 DCHECK(info->literal() == NULL); |
3822 FunctionLiteral* result = NULL; | 3820 FunctionLiteral* result = NULL; |
3823 | 3821 |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3866 | 3864 |
3867 info->set_literal(result); | 3865 info->set_literal(result); |
3868 | 3866 |
3869 // We cannot internalize on a background thread; a foreground task will take | 3867 // We cannot internalize on a background thread; a foreground task will take |
3870 // care of calling Parser::Internalize just before compilation. | 3868 // care of calling Parser::Internalize just before compilation. |
3871 | 3869 |
3872 if (produce_cached_parse_data()) { | 3870 if (produce_cached_parse_data()) { |
3873 if (result != NULL) *info->cached_data() = logger.GetScriptData(); | 3871 if (result != NULL) *info->cached_data() = logger.GetScriptData(); |
3874 log_ = NULL; | 3872 log_ = NULL; |
3875 } | 3873 } |
3876 if (FLAG_runtime_stats) { | 3874 if (FLAG_runtime_stats & |
3877 // TODO(cbruni,lpy): properly attach the runtime stats to the trace for | 3875 v8::tracing::TracingCategoryObserver::ENABLED_BY_TRACING) { |
3878 // background parsing. | 3876 auto value = v8::tracing::TracedValue::Create(); |
| 3877 runtime_call_stats_->Dump(value.get()); |
| 3878 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("v8.runtime_stats"), |
| 3879 "V8.RuntimeStats", TRACE_EVENT_SCOPE_THREAD, |
| 3880 "runtime-call-stats", std::move(value)); |
3879 } | 3881 } |
3880 } | 3882 } |
3881 | 3883 |
3882 Parser::TemplateLiteralState Parser::OpenTemplateLiteral(int pos) { | 3884 Parser::TemplateLiteralState Parser::OpenTemplateLiteral(int pos) { |
3883 return new (zone()) TemplateLiteral(zone(), pos); | 3885 return new (zone()) TemplateLiteral(zone(), pos); |
3884 } | 3886 } |
3885 | 3887 |
3886 | 3888 |
3887 void Parser::AddTemplateSpan(TemplateLiteralState* state, bool tail) { | 3889 void Parser::AddTemplateSpan(TemplateLiteralState* state, bool tail) { |
3888 int pos = scanner()->location().beg_pos; | 3890 int pos = scanner()->location().beg_pos; |
(...skipping 1556 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5445 | 5447 |
5446 return final_loop; | 5448 return final_loop; |
5447 } | 5449 } |
5448 | 5450 |
5449 #undef CHECK_OK | 5451 #undef CHECK_OK |
5450 #undef CHECK_OK_VOID | 5452 #undef CHECK_OK_VOID |
5451 #undef CHECK_FAILED | 5453 #undef CHECK_FAILED |
5452 | 5454 |
5453 } // namespace internal | 5455 } // namespace internal |
5454 } // namespace v8 | 5456 } // namespace v8 |
OLD | NEW |