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

          Line data    Source code
       1             : // Copyright 2012 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_H_
       6             : #define V8_REGEXP_REGEXP_MACRO_ASSEMBLER_IRREGEXP_H_
       7             : 
       8             : #include "src/regexp/regexp-macro-assembler.h"
       9             : 
      10             : namespace v8 {
      11             : namespace internal {
      12             : 
      13             : // A light-weight assembler for the Irregexp byte code.
      14             : class V8_EXPORT_PRIVATE RegExpMacroAssemblerIrregexp
      15             :     : public RegExpMacroAssembler {
      16             :  public:
      17             :   // Create an assembler. Instructions and relocation information are emitted
      18             :   // into a buffer, with the instructions starting from the beginning and the
      19             :   // relocation information starting from the end of the buffer. See CodeDesc
      20             :   // for a detailed comment on the layout (globals.h).
      21             :   //
      22             :   // The assembler allocates and grows its own buffer, and buffer_size
      23             :   // determines the initial buffer size. The buffer is owned by the assembler
      24             :   // and deallocated upon destruction of the assembler.
      25             :   RegExpMacroAssemblerIrregexp(Isolate* isolate, Zone* zone);
      26             :   virtual ~RegExpMacroAssemblerIrregexp();
      27             :   // The byte-code interpreter checks on each push anyway.
      28       68696 :   virtual int stack_limit_slack() { return 1; }
      29       28338 :   virtual bool CanReadUnaligned() { return false; }
      30             :   virtual void Bind(Label* label);
      31             :   virtual void AdvanceCurrentPosition(int by);  // Signed cp change.
      32             :   virtual void PopCurrentPosition();
      33             :   virtual void PushCurrentPosition();
      34             :   virtual void Backtrack();
      35             :   virtual void GoTo(Label* label);
      36             :   virtual void PushBacktrack(Label* label);
      37             :   virtual bool Succeed();
      38             :   virtual void Fail();
      39             :   virtual void PopRegister(int register_index);
      40             :   virtual void PushRegister(int register_index,
      41             :                             StackCheckFlag check_stack_limit);
      42             :   virtual void AdvanceRegister(int reg, int by);  // r[reg] += by.
      43             :   virtual void SetCurrentPositionFromEnd(int by);
      44             :   virtual void SetRegister(int register_index, int to);
      45             :   virtual void WriteCurrentPositionToRegister(int reg, int cp_offset);
      46             :   virtual void ClearRegisters(int reg_from, int reg_to);
      47             :   virtual void ReadCurrentPositionFromRegister(int reg);
      48             :   virtual void WriteStackPointerToRegister(int reg);
      49             :   virtual void ReadStackPointerFromRegister(int reg);
      50             :   virtual void LoadCurrentCharacter(int cp_offset,
      51             :                                     Label* on_end_of_input,
      52             :                                     bool check_bounds = true,
      53             :                                     int characters = 1);
      54             :   virtual void CheckCharacter(unsigned c, Label* on_equal);
      55             :   virtual void CheckCharacterAfterAnd(unsigned c,
      56             :                                       unsigned mask,
      57             :                                       Label* on_equal);
      58             :   virtual void CheckCharacterGT(uc16 limit, Label* on_greater);
      59             :   virtual void CheckCharacterLT(uc16 limit, Label* on_less);
      60             :   virtual void CheckGreedyLoop(Label* on_tos_equals_current_position);
      61             :   virtual void CheckAtStart(Label* on_at_start);
      62             :   virtual void CheckNotAtStart(int cp_offset, Label* on_not_at_start);
      63             :   virtual void CheckNotCharacter(unsigned c, Label* on_not_equal);
      64             :   virtual void CheckNotCharacterAfterAnd(unsigned c,
      65             :                                          unsigned mask,
      66             :                                          Label* on_not_equal);
      67             :   virtual void CheckNotCharacterAfterMinusAnd(uc16 c,
      68             :                                               uc16 minus,
      69             :                                               uc16 mask,
      70             :                                               Label* on_not_equal);
      71             :   virtual void CheckCharacterInRange(uc16 from,
      72             :                                      uc16 to,
      73             :                                      Label* on_in_range);
      74             :   virtual void CheckCharacterNotInRange(uc16 from,
      75             :                                         uc16 to,
      76             :                                         Label* on_not_in_range);
      77             :   virtual void CheckBitInTable(Handle<ByteArray> table, Label* on_bit_set);
      78             :   virtual void CheckNotBackReference(int start_reg, bool read_backward,
      79             :                                      Label* on_no_match);
      80             :   virtual void CheckNotBackReferenceIgnoreCase(int start_reg,
      81             :                                                bool read_backward, bool unicode,
      82             :                                                Label* on_no_match);
      83             :   virtual void IfRegisterLT(int register_index, int comparand, Label* if_lt);
      84             :   virtual void IfRegisterGE(int register_index, int comparand, Label* if_ge);
      85             :   virtual void IfRegisterEqPos(int register_index, Label* if_eq);
      86             : 
      87             :   virtual IrregexpImplementation Implementation();
      88             :   virtual Handle<HeapObject> GetCode(Handle<String> source);
      89             : 
      90             :  private:
      91             :   void Expand();
      92             :   // Code and bitmap emission.
      93             :   inline void EmitOrLink(Label* label);
      94             :   inline void Emit32(uint32_t x);
      95             :   inline void Emit16(uint32_t x);
      96             :   inline void Emit8(uint32_t x);
      97             :   inline void Emit(uint32_t bc, uint32_t arg);
      98             :   // Bytecode buffer.
      99             :   int length();
     100             :   void Copy(byte* a);
     101             : 
     102             :   // The buffer into which code and relocation info are generated.
     103             :   Vector<byte> buffer_;
     104             :   // The program counter.
     105             :   int pc_;
     106             :   // True if the assembler owns the buffer, false if buffer is external.
     107             :   bool own_buffer_;
     108             :   Label backtrack_;
     109             : 
     110             :   int advance_current_start_;
     111             :   int advance_current_offset_;
     112             :   int advance_current_end_;
     113             : 
     114             :   Isolate* isolate_;
     115             : 
     116             :   static const int kInvalidPC = -1;
     117             : 
     118             :   DISALLOW_IMPLICIT_CONSTRUCTORS(RegExpMacroAssemblerIrregexp);
     119             : };
     120             : 
     121             : }  // namespace internal
     122             : }  // namespace v8
     123             : 
     124             : #endif  // V8_REGEXP_REGEXP_MACRO_ASSEMBLER_IRREGEXP_H_

Generated by: LCOV version 1.10