| 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-expression-rewriter.h" | 10 #include "src/ast/ast-expression-rewriter.h" |
| (...skipping 573 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 584 FunctionLiteral* Parser::ParseProgram(Isolate* isolate, ParseInfo* info) { | 584 FunctionLiteral* Parser::ParseProgram(Isolate* isolate, ParseInfo* info) { |
| 585 // TODO(bmeurer): We temporarily need to pass allow_nesting = true here, | 585 // TODO(bmeurer): We temporarily need to pass allow_nesting = true here, |
| 586 // see comment for HistogramTimerScope class. | 586 // see comment for HistogramTimerScope class. |
| 587 | 587 |
| 588 // It's OK to use the Isolate & counters here, since this function is only | 588 // It's OK to use the Isolate & counters here, since this function is only |
| 589 // called in the main thread. | 589 // called in the main thread. |
| 590 DCHECK(parsing_on_main_thread_); | 590 DCHECK(parsing_on_main_thread_); |
| 591 | 591 |
| 592 HistogramTimerScope timer_scope(isolate->counters()->parse(), true); | 592 HistogramTimerScope timer_scope(isolate->counters()->parse(), true); |
| 593 RuntimeCallTimerScope runtime_timer(isolate, &RuntimeCallStats::Parse); | 593 RuntimeCallTimerScope runtime_timer(isolate, &RuntimeCallStats::Parse); |
| 594 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.compile"), "V8.Parse"); |
| 594 TRACE_EVENT_RUNTIME_CALL_STATS_TRACING_SCOPED( | 595 TRACE_EVENT_RUNTIME_CALL_STATS_TRACING_SCOPED( |
| 595 isolate, &tracing::TraceEventStatsTable::Parse); | 596 isolate, &tracing::TraceEventStatsTable::Parse); |
| 596 Handle<String> source(String::cast(info->script()->source())); | 597 Handle<String> source(String::cast(info->script()->source())); |
| 597 isolate->counters()->total_parse_size()->Increment(source->length()); | 598 isolate->counters()->total_parse_size()->Increment(source->length()); |
| 598 base::ElapsedTimer timer; | 599 base::ElapsedTimer timer; |
| 599 if (FLAG_trace_parse) { | 600 if (FLAG_trace_parse) { |
| 600 timer.Start(); | 601 timer.Start(); |
| 601 } | 602 } |
| 602 fni_ = new (zone()) FuncNameInferrer(ast_value_factory(), zone()); | 603 fni_ = new (zone()) FuncNameInferrer(ast_value_factory(), zone()); |
| 603 | 604 |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 756 return result; | 757 return result; |
| 757 } | 758 } |
| 758 | 759 |
| 759 | 760 |
| 760 FunctionLiteral* Parser::ParseLazy(Isolate* isolate, ParseInfo* info) { | 761 FunctionLiteral* Parser::ParseLazy(Isolate* isolate, ParseInfo* info) { |
| 761 // It's OK to use the Isolate & counters here, since this function is only | 762 // It's OK to use the Isolate & counters here, since this function is only |
| 762 // called in the main thread. | 763 // called in the main thread. |
| 763 DCHECK(parsing_on_main_thread_); | 764 DCHECK(parsing_on_main_thread_); |
| 764 RuntimeCallTimerScope runtime_timer(isolate, &RuntimeCallStats::ParseLazy); | 765 RuntimeCallTimerScope runtime_timer(isolate, &RuntimeCallStats::ParseLazy); |
| 765 HistogramTimerScope timer_scope(isolate->counters()->parse_lazy()); | 766 HistogramTimerScope timer_scope(isolate->counters()->parse_lazy()); |
| 767 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.compile"), "V8.ParseLazy"); |
| 766 TRACE_EVENT_RUNTIME_CALL_STATS_TRACING_SCOPED( | 768 TRACE_EVENT_RUNTIME_CALL_STATS_TRACING_SCOPED( |
| 767 isolate, &tracing::TraceEventStatsTable::ParseLazy); | 769 isolate, &tracing::TraceEventStatsTable::ParseLazy); |
| 768 Handle<String> source(String::cast(info->script()->source())); | 770 Handle<String> source(String::cast(info->script()->source())); |
| 769 isolate->counters()->total_parse_size()->Increment(source->length()); | 771 isolate->counters()->total_parse_size()->Increment(source->length()); |
| 770 base::ElapsedTimer timer; | 772 base::ElapsedTimer timer; |
| 771 if (FLAG_trace_parse) { | 773 if (FLAG_trace_parse) { |
| 772 timer.Start(); | 774 timer.Start(); |
| 773 } | 775 } |
| 774 Handle<SharedFunctionInfo> shared_info = info->shared_info(); | 776 Handle<SharedFunctionInfo> shared_info = info->shared_info(); |
| 775 DeserializeScopeChain(info, info->context(), | 777 DeserializeScopeChain(info, info->context(), |
| (...skipping 5882 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6658 node->Print(Isolate::Current()); | 6660 node->Print(Isolate::Current()); |
| 6659 } | 6661 } |
| 6660 #endif // DEBUG | 6662 #endif // DEBUG |
| 6661 | 6663 |
| 6662 #undef CHECK_OK | 6664 #undef CHECK_OK |
| 6663 #undef CHECK_OK_VOID | 6665 #undef CHECK_OK_VOID |
| 6664 #undef CHECK_FAILED | 6666 #undef CHECK_FAILED |
| 6665 | 6667 |
| 6666 } // namespace internal | 6668 } // namespace internal |
| 6667 } // namespace v8 | 6669 } // namespace v8 |
| OLD | NEW |