5 #ifndef V8_REGEXP_PPC_REGEXP_MACRO_ASSEMBLER_PPC_H_ 6 #define V8_REGEXP_PPC_REGEXP_MACRO_ASSEMBLER_PPC_H_ 8 #include "src/macro-assembler.h" 9 #include "src/ppc/assembler-ppc.h" 10 #include "src/regexp/regexp-macro-assembler.h" 16 #ifndef V8_INTERPRETED_REGEXP 20 int registers_to_save);
22 virtual int stack_limit_slack();
23 virtual void AdvanceCurrentPosition(
int by);
24 virtual void AdvanceRegister(
int reg,
int by);
25 virtual void Backtrack();
26 virtual void Bind(
Label* label);
27 virtual void CheckAtStart(
Label* on_at_start);
28 virtual void CheckCharacter(
unsigned c,
Label* on_equal);
29 virtual void CheckCharacterAfterAnd(
unsigned c,
unsigned mask,
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(
unsigned c,
Label* on_not_equal);
43 virtual void CheckNotCharacterAfterAnd(
unsigned c,
unsigned mask,
45 virtual void CheckNotCharacterAfterMinusAnd(uc16 c, uc16 minus, uc16 mask,
47 virtual void CheckCharacterInRange(uc16 from, uc16 to,
Label* on_in_range);
48 virtual void CheckCharacterNotInRange(uc16 from, uc16 to,
49 Label* on_not_in_range);
54 virtual void CheckPosition(
int cp_offset,
Label* on_outside_input);
55 virtual bool CheckSpecialCharacterClass(uc16
type,
Label* on_no_match);
58 virtual void GoTo(
Label* label);
59 virtual void IfRegisterGE(
int reg,
int comparand,
Label* if_ge);
60 virtual void IfRegisterLT(
int reg,
int comparand,
Label* if_lt);
61 virtual void IfRegisterEqPos(
int reg,
Label* if_eq);
62 virtual IrregexpImplementation Implementation();
63 virtual void LoadCurrentCharacter(
int cp_offset,
Label* on_end_of_input,
64 bool check_bounds =
true,
66 virtual void PopCurrentPosition();
67 virtual void PopRegister(
int register_index);
68 virtual void PushBacktrack(
Label* label);
69 virtual void PushCurrentPosition();
70 virtual void PushRegister(
int register_index,
71 StackCheckFlag check_stack_limit);
72 virtual void ReadCurrentPositionFromRegister(
int reg);
73 virtual void ReadStackPointerFromRegister(
int reg);
74 virtual void SetCurrentPositionFromEnd(
int by);
75 virtual void SetRegister(
int register_index,
int to);
76 virtual bool Succeed();
77 virtual void WriteCurrentPositionToRegister(
int reg,
int cp_offset);
78 virtual void ClearRegisters(
int reg_from,
int reg_to);
79 virtual void WriteStackPointerToRegister(
int reg);
85 static int CheckStackGuardState(
Address* return_address,
Address raw_code,
90 static const int kFramePointer = 0;
94 static const int kStoredRegisters = kFramePointer;
96 static const int kReturnAddress = kStoredRegisters + 7 * kPointerSize;
97 static const int kCallerFrame = kReturnAddress + kPointerSize;
99 static const int kIsolate =
100 kCallerFrame + kStackFrameExtraParamSlot * kPointerSize;
104 static const int kDirectCall = kFramePointer - kPointerSize;
105 static const int kStackHighEnd = kDirectCall - kPointerSize;
106 static const int kNumOutputRegisters = kStackHighEnd - kPointerSize;
107 static const int kRegisterOutput = kNumOutputRegisters - kPointerSize;
108 static const int kInputEnd = kRegisterOutput - kPointerSize;
109 static const int kInputStart = kInputEnd - kPointerSize;
110 static const int kStartIndex = kInputStart - kPointerSize;
111 static const int kInputString = kStartIndex - kPointerSize;
114 static const int kSuccessfulCaptures = kInputString - kPointerSize;
115 static const int kStringStartMinusOne = kSuccessfulCaptures - kPointerSize;
117 static const int kRegisterZero = kStringStartMinusOne - kPointerSize;
120 static const size_t kRegExpCodeSize = 1024;
124 void LoadCurrentCharacterUnchecked(
int cp_offset,
int character_count);
127 void CheckPreemption();
130 void CheckStackLimit();
134 void CallCheckStackGuardState(
Register scratch);
137 MemOperand register_location(
int register_index);
141 inline Register current_input_offset() {
return r27; }
144 inline Register current_character() {
return r28; }
147 inline Register end_of_input_address() {
return r30; }
151 inline Register frame_pointer() {
return fp; }
155 inline Register backtrack_stackpointer() {
return r29; }
158 inline Register code_pointer() {
return r26; }
161 inline int char_size() {
return static_cast<int>(mode_); }
165 void BranchOrBacktrack(Condition condition,
Label* to,
CRegister cr = cr7);
169 inline void SafeCall(
Label* to, Condition cond = al,
CRegister cr = cr7);
170 inline void SafeReturn();
171 inline void SafeCallTarget(
Label* name);
181 Isolate* isolate()
const {
return masm_->isolate(); }
193 int num_saved_registers_;
198 Label success_label_;
199 Label backtrack_label_;
201 Label check_preempt_label_;
202 Label stack_overflow_label_;
203 Label internal_failure_label_;
207 const RegList kRegExpCalleeSaved =
208 1 << 25 | 1 << 26 | 1 << 27 | 1 << 28 | 1 << 29 | 1 << 30 | 1 << 31;
210 #endif // V8_INTERPRETED_REGEXP 214 #endif // V8_REGEXP_PPC_REGEXP_MACRO_ASSEMBLER_PPC_H_