Line data Source code
1 : // Copyright 2016 the V8 project authors. All rights reserved.
2 : // Use of this source code is governed by a BSD-style license that can be
3 : // found in the LICENSE file.
4 :
5 : #include "src/crankshaft/compilation-phase.h"
6 :
7 : #include "src/crankshaft/hydrogen.h"
8 : #include "src/isolate.h"
9 : #include "src/objects-inl.h"
10 :
11 : namespace v8 {
12 : namespace internal {
13 :
14 19274036 : CompilationPhase::CompilationPhase(const char* name, CompilationInfo* info)
15 19274036 : : name_(name), info_(info), zone_(info->isolate()->allocator(), ZONE_NAME) {
16 9637050 : if (FLAG_hydrogen_stats) {
17 0 : info_zone_start_allocation_size_ = info->zone()->allocation_size();
18 : timer_.Start();
19 : }
20 9637050 : }
21 :
22 19274614 : CompilationPhase::~CompilationPhase() {
23 9637307 : if (FLAG_hydrogen_stats) {
24 0 : size_t size = zone()->allocation_size();
25 0 : size += info_->zone()->allocation_size() - info_zone_start_allocation_size_;
26 0 : isolate()->GetHStatistics()->SaveTiming(name_, timer_.Elapsed(), size);
27 : }
28 9637110 : }
29 :
30 9066212 : bool CompilationPhase::ShouldProduceTraceOutput() const {
31 : // Trace if the appropriate trace flag is set and the phase name's first
32 : // character is in the FLAG_trace_phase command line parameter.
33 : AllowHandleDereference allow_deref;
34 : bool tracing_on =
35 9066212 : info()->IsStub()
36 : ? FLAG_trace_hydrogen_stubs
37 8313260 : : (FLAG_trace_hydrogen &&
38 18132424 : info()->shared_info()->PassesFilter(FLAG_trace_hydrogen_filter));
39 9066212 : return (tracing_on &&
40 0 : base::OS::StrChr(const_cast<char*>(FLAG_trace_phase), name_[0]) !=
41 9066212 : NULL);
42 : }
43 :
44 : } // namespace internal
45 : } // namespace v8
|