LCOV - code coverage report
Current view: top level - src/crankshaft - compilation-phase.cc (source / functions) Hit Total Coverage
Test: app.info Lines: 13 18 72.2 %
Date: 2017-04-26 Functions: 3 3 100.0 %

          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    19238908 : CompilationPhase::CompilationPhase(const char* name, CompilationInfo* info)
      15    19238908 :     : name_(name), info_(info), zone_(info->isolate()->allocator(), ZONE_NAME) {
      16     9619404 :   if (FLAG_hydrogen_stats) {
      17           0 :     info_zone_start_allocation_size_ = info->zone()->allocation_size();
      18             :     timer_.Start();
      19             :   }
      20     9619404 : }
      21             : 
      22    19239316 : CompilationPhase::~CompilationPhase() {
      23     9619658 :   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     9619380 : }
      29             : 
      30     9049631 : 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     9049631 :       info()->IsStub()
      36             :           ? FLAG_trace_hydrogen_stubs
      37     8298279 :           : (FLAG_trace_hydrogen &&
      38    18099262 :              info()->shared_info()->PassesFilter(FLAG_trace_hydrogen_filter));
      39     9049631 :   return (tracing_on &&
      40           0 :           base::OS::StrChr(const_cast<char*>(FLAG_trace_phase), name_[0]) !=
      41     9049631 :               NULL);
      42             : }
      43             : 
      44             : }  // namespace internal
      45             : }  // namespace v8

Generated by: LCOV version 1.10