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 851 matching lines...) Loading... |
862 FunctionLiteral* Parser::ParseProgram(Isolate* isolate, ParseInfo* info) { | 862 FunctionLiteral* Parser::ParseProgram(Isolate* isolate, ParseInfo* info) { |
863 // TODO(bmeurer): We temporarily need to pass allow_nesting = true here, | 863 // TODO(bmeurer): We temporarily need to pass allow_nesting = true here, |
864 // see comment for HistogramTimerScope class. | 864 // see comment for HistogramTimerScope class. |
865 | 865 |
866 // It's OK to use the Isolate & counters here, since this function is only | 866 // It's OK to use the Isolate & counters here, since this function is only |
867 // called in the main thread. | 867 // called in the main thread. |
868 DCHECK(parsing_on_main_thread_); | 868 DCHECK(parsing_on_main_thread_); |
869 | 869 |
870 HistogramTimerScope timer_scope(isolate->counters()->parse(), true); | 870 HistogramTimerScope timer_scope(isolate->counters()->parse(), true); |
871 RuntimeCallTimerScope runtime_timer(isolate, &RuntimeCallStats::Parse); | 871 RuntimeCallTimerScope runtime_timer(isolate, &RuntimeCallStats::Parse); |
872 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.compile"), "V8.Parse"); | 872 TRACE_EVENT_RUNTIME_CALL_STATS_TRACING_SCOPED( |
| 873 isolate, &tracing::TraceEventStatsTable::Parse); |
873 Handle<String> source(String::cast(info->script()->source())); | 874 Handle<String> source(String::cast(info->script()->source())); |
874 isolate->counters()->total_parse_size()->Increment(source->length()); | 875 isolate->counters()->total_parse_size()->Increment(source->length()); |
875 base::ElapsedTimer timer; | 876 base::ElapsedTimer timer; |
876 if (FLAG_trace_parse) { | 877 if (FLAG_trace_parse) { |
877 timer.Start(); | 878 timer.Start(); |
878 } | 879 } |
879 fni_ = new (zone()) FuncNameInferrer(ast_value_factory(), zone()); | 880 fni_ = new (zone()) FuncNameInferrer(ast_value_factory(), zone()); |
880 | 881 |
881 // Initialize parser state. | 882 // Initialize parser state. |
882 CompleteParserRecorder recorder; | 883 CompleteParserRecorder recorder; |
(...skipping 151 matching lines...) Loading... |
1034 return result; | 1035 return result; |
1035 } | 1036 } |
1036 | 1037 |
1037 | 1038 |
1038 FunctionLiteral* Parser::ParseLazy(Isolate* isolate, ParseInfo* info) { | 1039 FunctionLiteral* Parser::ParseLazy(Isolate* isolate, ParseInfo* info) { |
1039 // It's OK to use the Isolate & counters here, since this function is only | 1040 // It's OK to use the Isolate & counters here, since this function is only |
1040 // called in the main thread. | 1041 // called in the main thread. |
1041 DCHECK(parsing_on_main_thread_); | 1042 DCHECK(parsing_on_main_thread_); |
1042 RuntimeCallTimerScope runtime_timer(isolate, &RuntimeCallStats::ParseLazy); | 1043 RuntimeCallTimerScope runtime_timer(isolate, &RuntimeCallStats::ParseLazy); |
1043 HistogramTimerScope timer_scope(isolate->counters()->parse_lazy()); | 1044 HistogramTimerScope timer_scope(isolate->counters()->parse_lazy()); |
1044 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.compile"), "V8.ParseLazy"); | 1045 TRACE_EVENT_RUNTIME_CALL_STATS_TRACING_SCOPED( |
| 1046 isolate, &tracing::TraceEventStatsTable::ParseLazy); |
1045 Handle<String> source(String::cast(info->script()->source())); | 1047 Handle<String> source(String::cast(info->script()->source())); |
1046 isolate->counters()->total_parse_size()->Increment(source->length()); | 1048 isolate->counters()->total_parse_size()->Increment(source->length()); |
1047 base::ElapsedTimer timer; | 1049 base::ElapsedTimer timer; |
1048 if (FLAG_trace_parse) { | 1050 if (FLAG_trace_parse) { |
1049 timer.Start(); | 1051 timer.Start(); |
1050 } | 1052 } |
1051 Handle<SharedFunctionInfo> shared_info = info->shared_info(); | 1053 Handle<SharedFunctionInfo> shared_info = info->shared_info(); |
1052 | 1054 |
1053 // Initialize parser state. | 1055 // Initialize parser state. |
1054 source = String::Flatten(source); | 1056 source = String::Flatten(source); |
(...skipping 6055 matching lines...) Loading... |
7110 node->Print(Isolate::Current()); | 7112 node->Print(Isolate::Current()); |
7111 } | 7113 } |
7112 #endif // DEBUG | 7114 #endif // DEBUG |
7113 | 7115 |
7114 #undef CHECK_OK | 7116 #undef CHECK_OK |
7115 #undef CHECK_OK_VOID | 7117 #undef CHECK_OK_VOID |
7116 #undef CHECK_FAILED | 7118 #undef CHECK_FAILED |
7117 | 7119 |
7118 } // namespace internal | 7120 } // namespace internal |
7119 } // namespace v8 | 7121 } // namespace v8 |
OLD | NEW |