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