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