LCOV - code coverage report
Current view: top level - src/regexp - regexp-macro-assembler-irregexp-inl.h (source / functions) Hit Total Coverage
Test: app.info Lines: 25 25 100.0 %
Date: 2019-02-19 Functions: 4 4 100.0 %

          Line data    Source code
       1             : // Copyright 2008-2009 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             : #ifndef V8_REGEXP_REGEXP_MACRO_ASSEMBLER_IRREGEXP_INL_H_
       6             : #define V8_REGEXP_REGEXP_MACRO_ASSEMBLER_IRREGEXP_INL_H_
       7             : 
       8             : #include "src/regexp/regexp-macro-assembler-irregexp.h"
       9             : 
      10             : #include "src/ast/ast.h"
      11             : #include "src/regexp/bytecodes-irregexp.h"
      12             : 
      13             : namespace v8 {
      14             : namespace internal {
      15             : 
      16      989591 : void RegExpMacroAssemblerIrregexp::Emit(uint32_t byte,
      17             :                                         uint32_t twenty_four_bits) {
      18      989591 :   uint32_t word = ((twenty_four_bits << BYTECODE_SHIFT) | byte);
      19             :   DCHECK(pc_ <= buffer_.length());
      20     2968773 :   if (pc_  + 3 >= buffer_.length()) {
      21         209 :     Expand();
      22             :   }
      23      989591 :   *reinterpret_cast<uint32_t*>(buffer_.start() + pc_) = word;
      24      989591 :   pc_ += 4;
      25      989591 : }
      26             : 
      27             : 
      28       21466 : void RegExpMacroAssemblerIrregexp::Emit16(uint32_t word) {
      29             :   DCHECK(pc_ <= buffer_.length());
      30       64398 :   if (pc_ + 1 >= buffer_.length()) {
      31          10 :     Expand();
      32             :   }
      33       21466 :   *reinterpret_cast<uint16_t*>(buffer_.start() + pc_) = word;
      34       21466 :   pc_ += 2;
      35       21466 : }
      36             : 
      37             : 
      38       25024 : void RegExpMacroAssemblerIrregexp::Emit8(uint32_t word) {
      39             :   DCHECK(pc_ <= buffer_.length());
      40       75072 :   if (pc_ == buffer_.length()) {
      41           5 :     Expand();
      42             :   }
      43       25024 :   *reinterpret_cast<unsigned char*>(buffer_.start() + pc_) = word;
      44       25024 :   pc_ += 1;
      45       25024 : }
      46             : 
      47             : 
      48      636270 : void RegExpMacroAssemblerIrregexp::Emit32(uint32_t word) {
      49             :   DCHECK(pc_ <= buffer_.length());
      50     1908810 :   if (pc_ + 3 >= buffer_.length()) {
      51         182 :     Expand();
      52             :   }
      53      636270 :   *reinterpret_cast<uint32_t*>(buffer_.start() + pc_) = word;
      54      636270 :   pc_ += 4;
      55      636270 : }
      56             : 
      57             : }  // namespace internal
      58             : }  // namespace v8
      59             : 
      60             : #endif  // V8_REGEXP_REGEXP_MACRO_ASSEMBLER_IRREGEXP_INL_H_

Generated by: LCOV version 1.10