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 901 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
912 FunctionLiteral* Parser::ParseProgram(Isolate* isolate, ParseInfo* info) { | 912 FunctionLiteral* Parser::ParseProgram(Isolate* isolate, ParseInfo* info) { |
913 // TODO(bmeurer): We temporarily need to pass allow_nesting = true here, | 913 // TODO(bmeurer): We temporarily need to pass allow_nesting = true here, |
914 // see comment for HistogramTimerScope class. | 914 // see comment for HistogramTimerScope class. |
915 | 915 |
916 // It's OK to use the Isolate & counters here, since this function is only | 916 // It's OK to use the Isolate & counters here, since this function is only |
917 // called in the main thread. | 917 // called in the main thread. |
918 DCHECK(parsing_on_main_thread_); | 918 DCHECK(parsing_on_main_thread_); |
919 | 919 |
920 HistogramTimerScope timer_scope(isolate->counters()->parse(), true); | 920 HistogramTimerScope timer_scope(isolate->counters()->parse(), true); |
921 RuntimeCallTimerScope runtime_timer(isolate, &RuntimeCallStats::Parse); | 921 RuntimeCallTimerScope runtime_timer(isolate, &RuntimeCallStats::Parse); |
922 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.compile"), "V8.Parse"); | 922 TRACE_EVENT_RUNTIME_CALL_STATS_TRACING_SCOPED( |
| 923 isolate, &tracing::TraceEventStatsTable::Parse); |
923 Handle<String> source(String::cast(info->script()->source())); | 924 Handle<String> source(String::cast(info->script()->source())); |
924 isolate->counters()->total_parse_size()->Increment(source->length()); | 925 isolate->counters()->total_parse_size()->Increment(source->length()); |
925 base::ElapsedTimer timer; | 926 base::ElapsedTimer timer; |
926 if (FLAG_trace_parse) { | 927 if (FLAG_trace_parse) { |
927 timer.Start(); | 928 timer.Start(); |
928 } | 929 } |
929 fni_ = new (zone()) FuncNameInferrer(ast_value_factory(), zone()); | 930 fni_ = new (zone()) FuncNameInferrer(ast_value_factory(), zone()); |
930 | 931 |
931 // Initialize parser state. | 932 // Initialize parser state. |
932 CompleteParserRecorder recorder; | 933 CompleteParserRecorder recorder; |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1076 return result; | 1077 return result; |
1077 } | 1078 } |
1078 | 1079 |
1079 | 1080 |
1080 FunctionLiteral* Parser::ParseLazy(Isolate* isolate, ParseInfo* info) { | 1081 FunctionLiteral* Parser::ParseLazy(Isolate* isolate, ParseInfo* info) { |
1081 // It's OK to use the Isolate & counters here, since this function is only | 1082 // It's OK to use the Isolate & counters here, since this function is only |
1082 // called in the main thread. | 1083 // called in the main thread. |
1083 DCHECK(parsing_on_main_thread_); | 1084 DCHECK(parsing_on_main_thread_); |
1084 RuntimeCallTimerScope runtime_timer(isolate, &RuntimeCallStats::ParseLazy); | 1085 RuntimeCallTimerScope runtime_timer(isolate, &RuntimeCallStats::ParseLazy); |
1085 HistogramTimerScope timer_scope(isolate->counters()->parse_lazy()); | 1086 HistogramTimerScope timer_scope(isolate->counters()->parse_lazy()); |
1086 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.compile"), "V8.ParseLazy"); | 1087 TRACE_EVENT_RUNTIME_CALL_STATS_TRACING_SCOPED( |
| 1088 isolate, &tracing::TraceEventStatsTable::ParseLazy); |
1087 Handle<String> source(String::cast(info->script()->source())); | 1089 Handle<String> source(String::cast(info->script()->source())); |
1088 isolate->counters()->total_parse_size()->Increment(source->length()); | 1090 isolate->counters()->total_parse_size()->Increment(source->length()); |
1089 base::ElapsedTimer timer; | 1091 base::ElapsedTimer timer; |
1090 if (FLAG_trace_parse) { | 1092 if (FLAG_trace_parse) { |
1091 timer.Start(); | 1093 timer.Start(); |
1092 } | 1094 } |
1093 Handle<SharedFunctionInfo> shared_info = info->shared_info(); | 1095 Handle<SharedFunctionInfo> shared_info = info->shared_info(); |
1094 DeserializeScopeChain(info, info->context(), | 1096 DeserializeScopeChain(info, info->context(), |
1095 Scope::DeserializationMode::kKeepScopeInfo); | 1097 Scope::DeserializationMode::kKeepScopeInfo); |
1096 | 1098 |
(...skipping 6005 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7102 node->Print(Isolate::Current()); | 7104 node->Print(Isolate::Current()); |
7103 } | 7105 } |
7104 #endif // DEBUG | 7106 #endif // DEBUG |
7105 | 7107 |
7106 #undef CHECK_OK | 7108 #undef CHECK_OK |
7107 #undef CHECK_OK_VOID | 7109 #undef CHECK_OK_VOID |
7108 #undef CHECK_FAILED | 7110 #undef CHECK_FAILED |
7109 | 7111 |
7110 } // namespace internal | 7112 } // namespace internal |
7111 } // namespace v8 | 7113 } // namespace v8 |
OLD | NEW |