| 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 572 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 583 // TODO(bmeurer): We temporarily need to pass allow_nesting = true here, | 583 // TODO(bmeurer): We temporarily need to pass allow_nesting = true here, |
| 584 // see comment for HistogramTimerScope class. | 584 // see comment for HistogramTimerScope class. |
| 585 | 585 |
| 586 // It's OK to use the Isolate & counters here, since this function is only | 586 // It's OK to use the Isolate & counters here, since this function is only |
| 587 // called in the main thread. | 587 // called in the main thread. |
| 588 DCHECK(parsing_on_main_thread_); | 588 DCHECK(parsing_on_main_thread_); |
| 589 | 589 |
| 590 HistogramTimerScope timer_scope(isolate->counters()->parse(), true); | 590 HistogramTimerScope timer_scope(isolate->counters()->parse(), true); |
| 591 RuntimeCallTimerScope runtime_timer(isolate, &RuntimeCallStats::Parse); | 591 RuntimeCallTimerScope runtime_timer(isolate, &RuntimeCallStats::Parse); |
| 592 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.compile"), "V8.Parse"); | 592 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.compile"), "V8.Parse"); |
| 593 TRACE_EVENT_RUNTIME_CALL_STATS_TRACING_SCOPED( |
| 594 isolate, &tracing::TraceEventStatsTable::Parse); |
| 593 Handle<String> source(String::cast(info->script()->source())); | 595 Handle<String> source(String::cast(info->script()->source())); |
| 594 isolate->counters()->total_parse_size()->Increment(source->length()); | 596 isolate->counters()->total_parse_size()->Increment(source->length()); |
| 595 base::ElapsedTimer timer; | 597 base::ElapsedTimer timer; |
| 596 if (FLAG_trace_parse) { | 598 if (FLAG_trace_parse) { |
| 597 timer.Start(); | 599 timer.Start(); |
| 598 } | 600 } |
| 599 fni_ = new (zone()) FuncNameInferrer(ast_value_factory(), zone()); | 601 fni_ = new (zone()) FuncNameInferrer(ast_value_factory(), zone()); |
| 600 | 602 |
| 601 // Initialize parser state. | 603 // Initialize parser state. |
| 602 CompleteParserRecorder recorder; | 604 CompleteParserRecorder recorder; |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 748 } | 750 } |
| 749 | 751 |
| 750 | 752 |
| 751 FunctionLiteral* Parser::ParseLazy(Isolate* isolate, ParseInfo* info) { | 753 FunctionLiteral* Parser::ParseLazy(Isolate* isolate, ParseInfo* info) { |
| 752 // It's OK to use the Isolate & counters here, since this function is only | 754 // It's OK to use the Isolate & counters here, since this function is only |
| 753 // called in the main thread. | 755 // called in the main thread. |
| 754 DCHECK(parsing_on_main_thread_); | 756 DCHECK(parsing_on_main_thread_); |
| 755 RuntimeCallTimerScope runtime_timer(isolate, &RuntimeCallStats::ParseLazy); | 757 RuntimeCallTimerScope runtime_timer(isolate, &RuntimeCallStats::ParseLazy); |
| 756 HistogramTimerScope timer_scope(isolate->counters()->parse_lazy()); | 758 HistogramTimerScope timer_scope(isolate->counters()->parse_lazy()); |
| 757 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.compile"), "V8.ParseLazy"); | 759 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.compile"), "V8.ParseLazy"); |
| 760 TRACE_EVENT_RUNTIME_CALL_STATS_TRACING_SCOPED( |
| 761 isolate, &tracing::TraceEventStatsTable::ParseLazy); |
| 758 Handle<String> source(String::cast(info->script()->source())); | 762 Handle<String> source(String::cast(info->script()->source())); |
| 759 isolate->counters()->total_parse_size()->Increment(source->length()); | 763 isolate->counters()->total_parse_size()->Increment(source->length()); |
| 760 base::ElapsedTimer timer; | 764 base::ElapsedTimer timer; |
| 761 if (FLAG_trace_parse) { | 765 if (FLAG_trace_parse) { |
| 762 timer.Start(); | 766 timer.Start(); |
| 763 } | 767 } |
| 764 Handle<SharedFunctionInfo> shared_info = info->shared_info(); | 768 Handle<SharedFunctionInfo> shared_info = info->shared_info(); |
| 765 DeserializeScopeChain(info, info->context(), | 769 DeserializeScopeChain(info, info->context(), |
| 766 Scope::DeserializationMode::kKeepScopeInfo); | 770 Scope::DeserializationMode::kKeepScopeInfo); |
| 767 | 771 |
| (...skipping 5681 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6449 node->Print(Isolate::Current()); | 6453 node->Print(Isolate::Current()); |
| 6450 } | 6454 } |
| 6451 #endif // DEBUG | 6455 #endif // DEBUG |
| 6452 | 6456 |
| 6453 #undef CHECK_OK | 6457 #undef CHECK_OK |
| 6454 #undef CHECK_OK_VOID | 6458 #undef CHECK_OK_VOID |
| 6455 #undef CHECK_FAILED | 6459 #undef CHECK_FAILED |
| 6456 | 6460 |
| 6457 } // namespace internal | 6461 } // namespace internal |
| 6458 } // namespace v8 | 6462 } // namespace v8 |
| OLD | NEW |