5 #ifndef V8_REGEXP_IA32_REGEXP_MACRO_ASSEMBLER_IA32_H_ 6 #define V8_REGEXP_IA32_REGEXP_MACRO_ASSEMBLER_IA32_H_ 8 #include "src/ia32/assembler-ia32.h" 9 #include "src/macro-assembler.h" 10 #include "src/regexp/regexp-macro-assembler.h" 15 #ifndef V8_INTERPRETED_REGEXP 19 int registers_to_save);
21 virtual int stack_limit_slack();
22 virtual void AdvanceCurrentPosition(
int by);
23 virtual void AdvanceRegister(
int reg,
int by);
24 virtual void Backtrack();
25 virtual void Bind(
Label* label);
26 virtual void CheckAtStart(
Label* on_at_start);
28 virtual void CheckCharacterAfterAnd(
uint32_t c,
31 virtual void CheckCharacterGT(uc16 limit,
Label* on_greater);
32 virtual void CheckCharacterLT(uc16 limit,
Label* on_less);
35 virtual void CheckGreedyLoop(
Label* on_tos_equals_current_position);
36 virtual void CheckNotAtStart(
int cp_offset,
Label* on_not_at_start);
37 virtual void CheckNotBackReference(
int start_reg,
bool read_backward,
39 virtual void CheckNotBackReferenceIgnoreCase(
int start_reg,
40 bool read_backward,
bool unicode,
42 virtual void CheckNotCharacter(
uint32_t c,
Label* on_not_equal);
43 virtual void CheckNotCharacterAfterAnd(
uint32_t c,
46 virtual void CheckNotCharacterAfterMinusAnd(uc16 c,
50 virtual void CheckCharacterInRange(uc16 from,
53 virtual void CheckCharacterNotInRange(uc16 from,
55 Label* on_not_in_range);
60 virtual void CheckPosition(
int cp_offset,
Label* on_outside_input);
61 virtual bool CheckSpecialCharacterClass(uc16
type,
Label* on_no_match);
64 virtual void GoTo(
Label* label);
65 virtual void IfRegisterGE(
int reg,
int comparand,
Label* if_ge);
66 virtual void IfRegisterLT(
int reg,
int comparand,
Label* if_lt);
67 virtual void IfRegisterEqPos(
int reg,
Label* if_eq);
68 virtual IrregexpImplementation Implementation();
69 virtual void LoadCurrentCharacter(
int cp_offset,
70 Label* on_end_of_input,
71 bool check_bounds =
true,
73 virtual void PopCurrentPosition();
74 virtual void PopRegister(
int register_index);
75 virtual void PushBacktrack(
Label* label);
76 virtual void PushCurrentPosition();
77 virtual void PushRegister(
int register_index,
78 StackCheckFlag check_stack_limit);
79 virtual void ReadCurrentPositionFromRegister(
int reg);
80 virtual void ReadStackPointerFromRegister(
int reg);
81 virtual void SetCurrentPositionFromEnd(
int by);
82 virtual void SetRegister(
int register_index,
int to);
83 virtual bool Succeed();
84 virtual void WriteCurrentPositionToRegister(
int reg,
int cp_offset);
85 virtual void ClearRegisters(
int reg_from,
int reg_to);
86 virtual void WriteStackPointerToRegister(
int reg);
92 static int CheckStackGuardState(
Address* return_address,
Address raw_code,
98 static const int kFramePointer = 0;
100 static const int kReturn_eip = kFramePointer + kPointerSize;
101 static const int kFrameAlign = kReturn_eip + kPointerSize;
103 static const int kInputString = kFrameAlign;
104 static const int kStartIndex = kInputString + kPointerSize;
105 static const int kInputStart = kStartIndex + kPointerSize;
106 static const int kInputEnd = kInputStart + kPointerSize;
107 static const int kRegisterOutput = kInputEnd + kPointerSize;
111 static const int kNumOutputRegisters = kRegisterOutput + kPointerSize;
112 static const int kStackHighEnd = kNumOutputRegisters + kPointerSize;
113 static const int kDirectCall = kStackHighEnd + kPointerSize;
114 static const int kIsolate = kDirectCall + kPointerSize;
118 static const int kBackup_esi = kFramePointer - kPointerSize;
119 static const int kBackup_edi = kBackup_esi - kPointerSize;
120 static const int kBackup_ebx = kBackup_edi - kPointerSize;
121 static const int kSuccessfulCaptures = kBackup_ebx - kPointerSize;
122 static const int kStringStartMinusOne = kSuccessfulCaptures - kPointerSize;
124 static const int kRegisterZero = kStringStartMinusOne - kPointerSize;
127 static const size_t kRegExpCodeSize = 1024;
131 void LoadCurrentCharacterUnchecked(
int cp_offset,
int character_count);
134 void CheckPreemption();
137 void CheckStackLimit();
140 void CallCheckStackGuardState(
Register scratch);
143 Operand register_location(
int register_index);
146 inline Register current_character() {
return edx; }
150 inline Register backtrack_stackpointer() {
return ecx; }
153 inline int char_size() {
return static_cast<int>(mode_); }
157 void BranchOrBacktrack(Condition condition,
Label* to);
161 inline void SafeCall(
Label* to);
162 inline void SafeReturn();
163 inline void SafeCallTarget(
Label* name);
177 Isolate* isolate()
const {
return masm_->isolate(); }
189 int num_saved_registers_;
194 Label success_label_;
195 Label backtrack_label_;
197 Label check_preempt_label_;
198 Label stack_overflow_label_;
200 #endif // V8_INTERPRETED_REGEXP 205 #endif // V8_REGEXP_IA32_REGEXP_MACRO_ASSEMBLER_IA32_H_