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 "src/api.h" | 7 #include "src/api.h" |
8 #include "src/ast/ast.h" | 8 #include "src/ast/ast.h" |
9 #include "src/ast/ast-expression-rewriter.h" | 9 #include "src/ast/ast-expression-rewriter.h" |
10 #include "src/ast/ast-expression-visitor.h" | 10 #include "src/ast/ast-expression-visitor.h" |
(...skipping 798 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
809 | 809 |
810 FunctionLiteral* Parser::ParseProgram(Isolate* isolate, ParseInfo* info) { | 810 FunctionLiteral* Parser::ParseProgram(Isolate* isolate, ParseInfo* info) { |
811 // TODO(bmeurer): We temporarily need to pass allow_nesting = true here, | 811 // TODO(bmeurer): We temporarily need to pass allow_nesting = true here, |
812 // see comment for HistogramTimerScope class. | 812 // see comment for HistogramTimerScope class. |
813 | 813 |
814 // It's OK to use the Isolate & counters here, since this function is only | 814 // It's OK to use the Isolate & counters here, since this function is only |
815 // called in the main thread. | 815 // called in the main thread. |
816 DCHECK(parsing_on_main_thread_); | 816 DCHECK(parsing_on_main_thread_); |
817 | 817 |
818 HistogramTimerScope timer_scope(isolate->counters()->parse(), true); | 818 HistogramTimerScope timer_scope(isolate->counters()->parse(), true); |
| 819 RuntimeCallStats* stats = isolate->counters()->runtime_call_stats(); |
| 820 RuntimeCallTimerScope runtimeTimer(isolate, &stats->Parse); |
819 TRACE_EVENT0("v8", "V8.Parse"); | 821 TRACE_EVENT0("v8", "V8.Parse"); |
820 Handle<String> source(String::cast(info->script()->source())); | 822 Handle<String> source(String::cast(info->script()->source())); |
821 isolate->counters()->total_parse_size()->Increment(source->length()); | 823 isolate->counters()->total_parse_size()->Increment(source->length()); |
822 base::ElapsedTimer timer; | 824 base::ElapsedTimer timer; |
823 if (FLAG_trace_parse) { | 825 if (FLAG_trace_parse) { |
824 timer.Start(); | 826 timer.Start(); |
825 } | 827 } |
826 fni_ = new (zone()) FuncNameInferrer(ast_value_factory(), zone()); | 828 fni_ = new (zone()) FuncNameInferrer(ast_value_factory(), zone()); |
827 | 829 |
828 // Initialize parser state. | 830 // Initialize parser state. |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
973 DCHECK(target_stack_ == NULL); | 975 DCHECK(target_stack_ == NULL); |
974 | 976 |
975 return result; | 977 return result; |
976 } | 978 } |
977 | 979 |
978 | 980 |
979 FunctionLiteral* Parser::ParseLazy(Isolate* isolate, ParseInfo* info) { | 981 FunctionLiteral* Parser::ParseLazy(Isolate* isolate, ParseInfo* info) { |
980 // It's OK to use the Isolate & counters here, since this function is only | 982 // It's OK to use the Isolate & counters here, since this function is only |
981 // called in the main thread. | 983 // called in the main thread. |
982 DCHECK(parsing_on_main_thread_); | 984 DCHECK(parsing_on_main_thread_); |
| 985 RuntimeCallStats* stats = isolate->counters()->runtime_call_stats(); |
| 986 RuntimeCallTimerScope runtimeTimer(isolate, &stats->ParseLazy); |
983 HistogramTimerScope timer_scope(isolate->counters()->parse_lazy()); | 987 HistogramTimerScope timer_scope(isolate->counters()->parse_lazy()); |
984 TRACE_EVENT0("v8", "V8.ParseLazy"); | 988 TRACE_EVENT0("v8", "V8.ParseLazy"); |
985 Handle<String> source(String::cast(info->script()->source())); | 989 Handle<String> source(String::cast(info->script()->source())); |
986 isolate->counters()->total_parse_size()->Increment(source->length()); | 990 isolate->counters()->total_parse_size()->Increment(source->length()); |
987 base::ElapsedTimer timer; | 991 base::ElapsedTimer timer; |
988 if (FLAG_trace_parse) { | 992 if (FLAG_trace_parse) { |
989 timer.Start(); | 993 timer.Start(); |
990 } | 994 } |
991 Handle<SharedFunctionInfo> shared_info = info->shared_info(); | 995 Handle<SharedFunctionInfo> shared_info = info->shared_info(); |
992 | 996 |
(...skipping 5821 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6814 try_block, target); | 6818 try_block, target); |
6815 final_loop = target; | 6819 final_loop = target; |
6816 } | 6820 } |
6817 | 6821 |
6818 return final_loop; | 6822 return final_loop; |
6819 } | 6823 } |
6820 | 6824 |
6821 | 6825 |
6822 } // namespace internal | 6826 } // namespace internal |
6823 } // namespace v8 | 6827 } // namespace v8 |
OLD | NEW |