LCOV - code coverage report
Current view: top level - src - bit-vector.cc (source / functions) Hit Total Coverage
Test: app.info Lines: 10 15 66.7 %
Date: 2019-02-19 Functions: 3 4 75.0 %

          Line data    Source code
       1             : // Copyright 2010 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/bit-vector.h"
       6             : 
       7             : #include "src/base/bits.h"
       8             : #include "src/utils.h"
       9             : 
      10             : namespace v8 {
      11             : namespace internal {
      12             : 
      13             : #ifdef DEBUG
      14             : void BitVector::Print() {
      15             :   bool first = true;
      16             :   PrintF("{");
      17             :   for (int i = 0; i < length(); i++) {
      18             :     if (Contains(i)) {
      19             :       if (!first) PrintF(",");
      20             :       first = false;
      21             :       PrintF("%d", i);
      22             :     }
      23             :   }
      24             :   PrintF("}\n");
      25             : }
      26             : #endif
      27             : 
      28             : 
      29   539042147 : void BitVector::Iterator::Advance() {
      30   248197046 :   current_++;
      31   248197046 :   uintptr_t val = current_value_;
      32   754812231 :   while (val == 0) {
      33   290845101 :     current_index_++;
      34   539042147 :     if (Done()) return;
      35             :     DCHECK(!target_->is_inline());
      36   258418139 :     val = target_->data_.ptr_[current_index_];
      37   258418139 :     current_ = current_index_ << kDataBitShift;
      38             :   }
      39             :   val = SkipZeroBytes(val);
      40             :   val = SkipZeroBits(val);
      41   215770084 :   current_value_ = val >> 1;
      42             : }
      43             : 
      44             : 
      45           0 : int BitVector::Count() const {
      46           0 :   if (data_length_ == 0) {
      47           0 :     return base::bits::CountPopulation(data_.inline_);
      48             :   } else {
      49             :     int count = 0;
      50           0 :     for (int i = 0; i < data_length_; i++) {
      51           0 :       count += base::bits::CountPopulation(data_.ptr_[i]);
      52             :     }
      53             :     return count;
      54             :   }
      55             : }
      56             : 
      57             : }  // namespace internal
      58      178779 : }  // namespace v8

Generated by: LCOV version 1.10