Line data Source code
1 : // Copyright 2008 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_TRACER_H_
6 : #define V8_REGEXP_REGEXP_MACRO_ASSEMBLER_TRACER_H_
7 :
8 : #include "src/regexp/regexp-macro-assembler.h"
9 :
10 : namespace v8 {
11 : namespace internal {
12 :
13 : // Decorator on a RegExpMacroAssembler that write all calls.
14 : class RegExpMacroAssemblerTracer: public RegExpMacroAssembler {
15 : public:
16 : RegExpMacroAssemblerTracer(Isolate* isolate, RegExpMacroAssembler* assembler);
17 : virtual ~RegExpMacroAssemblerTracer();
18 : virtual void AbortedCodeGeneration();
19 0 : virtual int stack_limit_slack() { return assembler_->stack_limit_slack(); }
20 0 : virtual bool CanReadUnaligned() { return assembler_->CanReadUnaligned(); }
21 : virtual void AdvanceCurrentPosition(int by); // Signed cp change.
22 : virtual void AdvanceRegister(int reg, int by); // r[reg] += by.
23 : virtual void Backtrack();
24 : virtual void Bind(Label* label);
25 : virtual void CheckAtStart(Label* on_at_start);
26 : virtual void CheckCharacter(unsigned c, Label* on_equal);
27 : virtual void CheckCharacterAfterAnd(unsigned c,
28 : unsigned and_with,
29 : Label* on_equal);
30 : virtual void CheckCharacterGT(uc16 limit, Label* on_greater);
31 : virtual void CheckCharacterLT(uc16 limit, Label* on_less);
32 : virtual void CheckGreedyLoop(Label* on_tos_equals_current_position);
33 : virtual void CheckNotAtStart(int cp_offset, Label* on_not_at_start);
34 : virtual void CheckNotBackReference(int start_reg, bool read_backward,
35 : Label* on_no_match);
36 : virtual void CheckNotBackReferenceIgnoreCase(int start_reg,
37 : bool read_backward, bool unicode,
38 : Label* on_no_match);
39 : virtual void CheckNotCharacter(unsigned c, Label* on_not_equal);
40 : virtual void CheckNotCharacterAfterAnd(unsigned c,
41 : unsigned and_with,
42 : Label* on_not_equal);
43 : virtual void CheckNotCharacterAfterMinusAnd(uc16 c,
44 : uc16 minus,
45 : uc16 and_with,
46 : Label* on_not_equal);
47 : virtual void CheckCharacterInRange(uc16 from,
48 : uc16 to,
49 : Label* on_in_range);
50 : virtual void CheckCharacterNotInRange(uc16 from,
51 : uc16 to,
52 : Label* on_not_in_range);
53 : virtual void CheckBitInTable(Handle<ByteArray> table, Label* on_bit_set);
54 : virtual void CheckPosition(int cp_offset, Label* on_outside_input);
55 : virtual bool CheckSpecialCharacterClass(uc16 type,
56 : Label* on_no_match);
57 : virtual void Fail();
58 : virtual Handle<HeapObject> GetCode(Handle<String> source);
59 : virtual void GoTo(Label* label);
60 : virtual void IfRegisterGE(int reg, int comparand, Label* if_ge);
61 : virtual void IfRegisterLT(int reg, int comparand, Label* if_lt);
62 : virtual void IfRegisterEqPos(int reg, Label* if_eq);
63 : virtual IrregexpImplementation Implementation();
64 : virtual void LoadCurrentCharacter(int cp_offset,
65 : Label* on_end_of_input,
66 : bool check_bounds = true,
67 : int characters = 1);
68 : virtual void PopCurrentPosition();
69 : virtual void PopRegister(int register_index);
70 : virtual void PushBacktrack(Label* label);
71 : virtual void PushCurrentPosition();
72 : virtual void PushRegister(int register_index,
73 : StackCheckFlag check_stack_limit);
74 : virtual void ReadCurrentPositionFromRegister(int reg);
75 : virtual void ReadStackPointerFromRegister(int reg);
76 : virtual void SetCurrentPositionFromEnd(int by);
77 : virtual void SetRegister(int register_index, int to);
78 : virtual bool Succeed();
79 : virtual void WriteCurrentPositionToRegister(int reg, int cp_offset);
80 : virtual void ClearRegisters(int reg_from, int reg_to);
81 : virtual void WriteStackPointerToRegister(int reg);
82 :
83 : private:
84 : RegExpMacroAssembler* assembler_;
85 : };
86 :
87 : } // namespace internal
88 : } // namespace v8
89 :
90 : #endif // V8_REGEXP_REGEXP_MACRO_ASSEMBLER_TRACER_H_
|