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 848 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
859 FunctionLiteral* Parser::ParseProgram(Isolate* isolate, ParseInfo* info) { | 859 FunctionLiteral* Parser::ParseProgram(Isolate* isolate, ParseInfo* info) { |
860 // TODO(bmeurer): We temporarily need to pass allow_nesting = true here, | 860 // TODO(bmeurer): We temporarily need to pass allow_nesting = true here, |
861 // see comment for HistogramTimerScope class. | 861 // see comment for HistogramTimerScope class. |
862 | 862 |
863 // It's OK to use the Isolate & counters here, since this function is only | 863 // It's OK to use the Isolate & counters here, since this function is only |
864 // called in the main thread. | 864 // called in the main thread. |
865 DCHECK(parsing_on_main_thread_); | 865 DCHECK(parsing_on_main_thread_); |
866 | 866 |
867 HistogramTimerScope timer_scope(isolate->counters()->parse(), true); | 867 HistogramTimerScope timer_scope(isolate->counters()->parse(), true); |
868 RuntimeCallTimerScope runtime_timer(isolate, &RuntimeCallStats::Parse); | 868 RuntimeCallTimerScope runtime_timer(isolate, &RuntimeCallStats::Parse); |
869 TRACE_EVENT_RUNTIME_CALL_STATS_TRACING_SCOPED( | 869 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.compile"), "V8.Parse"); |
870 isolate, &tracing::TraceEventStatsTable::Parse); | |
871 Handle<String> source(String::cast(info->script()->source())); | 870 Handle<String> source(String::cast(info->script()->source())); |
872 isolate->counters()->total_parse_size()->Increment(source->length()); | 871 isolate->counters()->total_parse_size()->Increment(source->length()); |
873 base::ElapsedTimer timer; | 872 base::ElapsedTimer timer; |
874 if (FLAG_trace_parse) { | 873 if (FLAG_trace_parse) { |
875 timer.Start(); | 874 timer.Start(); |
876 } | 875 } |
877 fni_ = new (zone()) FuncNameInferrer(ast_value_factory(), zone()); | 876 fni_ = new (zone()) FuncNameInferrer(ast_value_factory(), zone()); |
878 | 877 |
879 // Initialize parser state. | 878 // Initialize parser state. |
880 CompleteParserRecorder recorder; | 879 CompleteParserRecorder recorder; |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1032 return result; | 1031 return result; |
1033 } | 1032 } |
1034 | 1033 |
1035 | 1034 |
1036 FunctionLiteral* Parser::ParseLazy(Isolate* isolate, ParseInfo* info) { | 1035 FunctionLiteral* Parser::ParseLazy(Isolate* isolate, ParseInfo* info) { |
1037 // It's OK to use the Isolate & counters here, since this function is only | 1036 // It's OK to use the Isolate & counters here, since this function is only |
1038 // called in the main thread. | 1037 // called in the main thread. |
1039 DCHECK(parsing_on_main_thread_); | 1038 DCHECK(parsing_on_main_thread_); |
1040 RuntimeCallTimerScope runtime_timer(isolate, &RuntimeCallStats::ParseLazy); | 1039 RuntimeCallTimerScope runtime_timer(isolate, &RuntimeCallStats::ParseLazy); |
1041 HistogramTimerScope timer_scope(isolate->counters()->parse_lazy()); | 1040 HistogramTimerScope timer_scope(isolate->counters()->parse_lazy()); |
1042 TRACE_EVENT_RUNTIME_CALL_STATS_TRACING_SCOPED( | 1041 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.compile"), "V8.ParseLazy"); |
1043 isolate, &tracing::TraceEventStatsTable::ParseLazy); | |
1044 Handle<String> source(String::cast(info->script()->source())); | 1042 Handle<String> source(String::cast(info->script()->source())); |
1045 isolate->counters()->total_parse_size()->Increment(source->length()); | 1043 isolate->counters()->total_parse_size()->Increment(source->length()); |
1046 base::ElapsedTimer timer; | 1044 base::ElapsedTimer timer; |
1047 if (FLAG_trace_parse) { | 1045 if (FLAG_trace_parse) { |
1048 timer.Start(); | 1046 timer.Start(); |
1049 } | 1047 } |
1050 Handle<SharedFunctionInfo> shared_info = info->shared_info(); | 1048 Handle<SharedFunctionInfo> shared_info = info->shared_info(); |
1051 | 1049 |
1052 // Initialize parser state. | 1050 // Initialize parser state. |
1053 source = String::Flatten(source); | 1051 source = String::Flatten(source); |
(...skipping 6036 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7090 node->Print(Isolate::Current()); | 7088 node->Print(Isolate::Current()); |
7091 } | 7089 } |
7092 #endif // DEBUG | 7090 #endif // DEBUG |
7093 | 7091 |
7094 #undef CHECK_OK | 7092 #undef CHECK_OK |
7095 #undef CHECK_OK_VOID | 7093 #undef CHECK_OK_VOID |
7096 #undef CHECK_FAILED | 7094 #undef CHECK_FAILED |
7097 | 7095 |
7098 } // namespace internal | 7096 } // namespace internal |
7099 } // namespace v8 | 7097 } // namespace v8 |
OLD | NEW |