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