| 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 RuntimeCallTimerScope runtime_timer(isolate, &RuntimeCallStats::Parse); |
| 823 TRACE_EVENT0("v8", "V8.Parse"); | 824 TRACE_EVENT0("v8", "V8.Parse"); |
| 824 Handle<String> source(String::cast(info->script()->source())); | 825 Handle<String> source(String::cast(info->script()->source())); |
| 825 isolate->counters()->total_parse_size()->Increment(source->length()); | 826 isolate->counters()->total_parse_size()->Increment(source->length()); |
| 826 base::ElapsedTimer timer; | 827 base::ElapsedTimer timer; |
| 827 if (FLAG_trace_parse) { | 828 if (FLAG_trace_parse) { |
| 828 timer.Start(); | 829 timer.Start(); |
| 829 } | 830 } |
| 830 fni_ = new (zone()) FuncNameInferrer(ast_value_factory(), zone()); | 831 fni_ = new (zone()) FuncNameInferrer(ast_value_factory(), zone()); |
| 831 | 832 |
| 832 // Initialize parser state. | 833 // Initialize parser state. |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 977 DCHECK(target_stack_ == NULL); | 978 DCHECK(target_stack_ == NULL); |
| 978 | 979 |
| 979 return result; | 980 return result; |
| 980 } | 981 } |
| 981 | 982 |
| 982 | 983 |
| 983 FunctionLiteral* Parser::ParseLazy(Isolate* isolate, ParseInfo* info) { | 984 FunctionLiteral* Parser::ParseLazy(Isolate* isolate, ParseInfo* info) { |
| 984 // It's OK to use the Isolate & counters here, since this function is only | 985 // It's OK to use the Isolate & counters here, since this function is only |
| 985 // called in the main thread. | 986 // called in the main thread. |
| 986 DCHECK(parsing_on_main_thread_); | 987 DCHECK(parsing_on_main_thread_); |
| 988 RuntimeCallTimerScope runtime_timer(isolate, &RuntimeCallStats::ParseLazy); |
| 987 HistogramTimerScope timer_scope(isolate->counters()->parse_lazy()); | 989 HistogramTimerScope timer_scope(isolate->counters()->parse_lazy()); |
| 988 TRACE_EVENT0("v8", "V8.ParseLazy"); | 990 TRACE_EVENT0("v8", "V8.ParseLazy"); |
| 989 Handle<String> source(String::cast(info->script()->source())); | 991 Handle<String> source(String::cast(info->script()->source())); |
| 990 isolate->counters()->total_parse_size()->Increment(source->length()); | 992 isolate->counters()->total_parse_size()->Increment(source->length()); |
| 991 base::ElapsedTimer timer; | 993 base::ElapsedTimer timer; |
| 992 if (FLAG_trace_parse) { | 994 if (FLAG_trace_parse) { |
| 993 timer.Start(); | 995 timer.Start(); |
| 994 } | 996 } |
| 995 Handle<SharedFunctionInfo> shared_info = info->shared_info(); | 997 Handle<SharedFunctionInfo> shared_info = info->shared_info(); |
| 996 | 998 |
| (...skipping 5819 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6816 try_block, target); | 6818 try_block, target); |
| 6817 final_loop = target; | 6819 final_loop = target; |
| 6818 } | 6820 } |
| 6819 | 6821 |
| 6820 return final_loop; | 6822 return final_loop; |
| 6821 } | 6823 } |
| 6822 | 6824 |
| 6823 | 6825 |
| 6824 } // namespace internal | 6826 } // namespace internal |
| 6825 } // namespace v8 | 6827 } // namespace v8 |
| OLD | NEW |