LCOV - code coverage report
Current view: top level - src/interpreter - bytecode-array-random-iterator.cc (source / functions) Hit Total Coverage
Test: app.info Lines: 14 14 100.0 %
Date: 2019-02-19 Functions: 5 5 100.0 %

          Line data    Source code
       1             : // Copyright 2015 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/interpreter/bytecode-array-random-iterator.h"
       6             : #include "src/objects-inl.h"
       7             : #include "src/objects/code-inl.h"
       8             : 
       9             : namespace v8 {
      10             : namespace internal {
      11             : namespace interpreter {
      12             : 
      13      522851 : BytecodeArrayRandomIterator::BytecodeArrayRandomIterator(
      14             :     Handle<BytecodeArray> bytecode_array, Zone* zone)
      15    48773306 :     : BytecodeArrayAccessor(bytecode_array, 0), offsets_(zone) {
      16             :   // Run forwards through the bytecode array to determine the offset of each
      17             :   // bytecode.
      18    16432055 :   while (current_offset() < bytecode_array->length()) {
      19    31818400 :     offsets_.push_back(current_offset());
      20    15909197 :     SetOffset(current_offset() + current_bytecode_size());
      21             :   }
      22             :   GoToStart();
      23      522851 : }
      24             : 
      25    16432248 : bool BytecodeArrayRandomIterator::IsValid() const {
      26    69720909 :   return current_index_ >= 0 &&
      27    50769552 :          static_cast<size_t>(current_index_) < offsets_.size();
      28             : }
      29             : 
      30    18951357 : void BytecodeArrayRandomIterator::UpdateOffsetFromIndex() {
      31    18951357 :   if (IsValid()) {
      32    36856416 :     SetOffset(offsets_[current_index_]);
      33             :   }
      34    18951355 : }
      35             : 
      36             : }  // namespace interpreter
      37             : }  // namespace internal
      38      178779 : }  // namespace v8

Generated by: LCOV version 1.10