| OLD | NEW |
| 1 // Copyright 2008 the V8 project authors. All rights reserved. | 1 // Copyright 2008 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 enum Mode { ASCII = 1, UC16 = 2 }; | 36 enum Mode { ASCII = 1, UC16 = 2 }; |
| 37 enum Result { EXCEPTION = -1, FAILURE = 0, SUCCESS = 1 }; | 37 enum Result { EXCEPTION = -1, FAILURE = 0, SUCCESS = 1 }; |
| 38 | 38 |
| 39 RegExpMacroAssemblerIA32(Mode mode, int registers_to_save); | 39 RegExpMacroAssemblerIA32(Mode mode, int registers_to_save); |
| 40 virtual ~RegExpMacroAssemblerIA32(); | 40 virtual ~RegExpMacroAssemblerIA32(); |
| 41 virtual int stack_limit_slack(); | 41 virtual int stack_limit_slack(); |
| 42 virtual void AdvanceCurrentPosition(int by); | 42 virtual void AdvanceCurrentPosition(int by); |
| 43 virtual void AdvanceRegister(int reg, int by); | 43 virtual void AdvanceRegister(int reg, int by); |
| 44 virtual void Backtrack(); | 44 virtual void Backtrack(); |
| 45 virtual void Bind(Label* label); | 45 virtual void Bind(Label* label); |
| 46 virtual void CheckAtStart(Label* on_at_start); |
| 46 virtual void CheckBitmap(uc16 start, Label* bitmap, Label* on_zero); | 47 virtual void CheckBitmap(uc16 start, Label* bitmap, Label* on_zero); |
| 47 virtual void CheckCharacter(uint32_t c, Label* on_equal); | 48 virtual void CheckCharacter(uint32_t c, Label* on_equal); |
| 48 virtual void CheckCharacterAfterAnd(uint32_t c, | 49 virtual void CheckCharacterAfterAnd(uint32_t c, |
| 49 uint32_t mask, | 50 uint32_t mask, |
| 50 Label* on_equal); | 51 Label* on_equal); |
| 51 virtual void CheckCharacterGT(uc16 limit, Label* on_greater); | 52 virtual void CheckCharacterGT(uc16 limit, Label* on_greater); |
| 52 virtual void CheckCharacterLT(uc16 limit, Label* on_less); | 53 virtual void CheckCharacterLT(uc16 limit, Label* on_less); |
| 53 virtual void CheckCharacters(Vector<const uc16> str, | 54 virtual void CheckCharacters(Vector<const uc16> str, |
| 54 int cp_offset, | 55 int cp_offset, |
| 55 Label* on_failure, | 56 Label* on_failure, |
| 56 bool check_end_of_string); | 57 bool check_end_of_string); |
| 57 // A "greedy loop" is a loop that is both greedy and with a simple | 58 // A "greedy loop" is a loop that is both greedy and with a simple |
| 58 // body. It has a particularly simple implementation. | 59 // body. It has a particularly simple implementation. |
| 59 virtual void CheckGreedyLoop(Label* on_tos_equals_current_position); | 60 virtual void CheckGreedyLoop(Label* on_tos_equals_current_position); |
| 60 virtual void CheckNotAtStart(Label* on_not_at_start); | 61 virtual void CheckNotAtStart(Label* on_not_at_start); |
| 61 virtual void CheckNotBackReference(int start_reg, Label* on_no_match); | 62 virtual void CheckNotBackReference(int start_reg, Label* on_no_match); |
| 62 virtual void CheckNotBackReferenceIgnoreCase(int start_reg, | 63 virtual void CheckNotBackReferenceIgnoreCase(int start_reg, |
| 63 Label* on_no_match); | 64 Label* on_no_match); |
| 64 virtual void CheckNotRegistersEqual(int reg1, int reg2, Label* on_not_equal); | 65 virtual void CheckNotRegistersEqual(int reg1, int reg2, Label* on_not_equal); |
| 65 virtual void CheckNotCharacter(uint32_t c, Label* on_not_equal); | 66 virtual void CheckNotCharacter(uint32_t c, Label* on_not_equal); |
| 66 virtual void CheckNotCharacterAfterAnd(uint32_t c, | 67 virtual void CheckNotCharacterAfterAnd(uint32_t c, |
| 67 uint32_t mask, | 68 uint32_t mask, |
| 68 Label* on_not_equal); | 69 Label* on_not_equal); |
| 69 virtual void CheckNotCharacterAfterMinusAnd(uc16 c, | 70 virtual void CheckNotCharacterAfterMinusAnd(uc16 c, |
| 70 uc16 minus, | 71 uc16 minus, |
| 71 uc16 mask, | 72 uc16 mask, |
| 72 Label* on_not_equal); | 73 Label* on_not_equal); |
| 74 // Checks whether the given offset from the current position is before |
| 75 // the end of the string. |
| 76 virtual void CheckPosition(int cp_offset, Label* on_outside_input); |
| 73 virtual bool CheckSpecialCharacterClass(uc16 type, | 77 virtual bool CheckSpecialCharacterClass(uc16 type, |
| 74 int cp_offset, | 78 int cp_offset, |
| 75 bool check_offset, | 79 bool check_offset, |
| 76 Label* on_no_match); | 80 Label* on_no_match); |
| 77 virtual void DispatchByteMap(uc16 start, | 81 virtual void DispatchByteMap(uc16 start, |
| 78 Label* byte_map, | 82 Label* byte_map, |
| 79 const Vector<Label*>& destinations); | 83 const Vector<Label*>& destinations); |
| 80 virtual void DispatchHalfNibbleMap(uc16 start, | 84 virtual void DispatchHalfNibbleMap(uc16 start, |
| 81 Label* half_nibble_map, | 85 Label* half_nibble_map, |
| 82 const Vector<Label*>& destinations); | 86 const Vector<Label*>& destinations); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 99 virtual void PopRegister(int register_index); | 103 virtual void PopRegister(int register_index); |
| 100 virtual void PushBacktrack(Label* label); | 104 virtual void PushBacktrack(Label* label); |
| 101 virtual void PushCurrentPosition(); | 105 virtual void PushCurrentPosition(); |
| 102 virtual void PushRegister(int register_index, | 106 virtual void PushRegister(int register_index, |
| 103 StackCheckFlag check_stack_limit); | 107 StackCheckFlag check_stack_limit); |
| 104 virtual void ReadCurrentPositionFromRegister(int reg); | 108 virtual void ReadCurrentPositionFromRegister(int reg); |
| 105 virtual void ReadStackPointerFromRegister(int reg); | 109 virtual void ReadStackPointerFromRegister(int reg); |
| 106 virtual void SetRegister(int register_index, int to); | 110 virtual void SetRegister(int register_index, int to); |
| 107 virtual void Succeed(); | 111 virtual void Succeed(); |
| 108 virtual void WriteCurrentPositionToRegister(int reg, int cp_offset); | 112 virtual void WriteCurrentPositionToRegister(int reg, int cp_offset); |
| 109 virtual void ClearRegister(int reg); | 113 virtual void ClearRegisters(int reg_from, int reg_to); |
| 110 virtual void WriteStackPointerToRegister(int reg); | 114 virtual void WriteStackPointerToRegister(int reg); |
| 111 | 115 |
| 112 static Result Execute(Code* code, | 116 static Result Execute(Code* code, |
| 113 Address* input, | 117 Address* input, |
| 114 int start_offset, | 118 int start_offset, |
| 115 int end_offset, | 119 int end_offset, |
| 116 int* output, | 120 int* output, |
| 117 bool at_start); | 121 bool at_start); |
| 118 | 122 |
| 119 private: | 123 private: |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 // If the code object is relocated, the return address is fixed before | 167 // If the code object is relocated, the return address is fixed before |
| 164 // returning. | 168 // returning. |
| 165 static int CheckStackGuardState(Address return_address, Code* re_code); | 169 static int CheckStackGuardState(Address return_address, Code* re_code); |
| 166 | 170 |
| 167 // Called from RegExp if the backtrack stack limit is hit. | 171 // Called from RegExp if the backtrack stack limit is hit. |
| 168 // Tries to expand the stack. Returns the new stack-top pointer if | 172 // Tries to expand the stack. Returns the new stack-top pointer if |
| 169 // successful, or 0 if unable to grow the stack. | 173 // successful, or 0 if unable to grow the stack. |
| 170 // This function must not trigger a garbage collection. | 174 // This function must not trigger a garbage collection. |
| 171 static Address GrowStack(Address stack_top); | 175 static Address GrowStack(Address stack_top); |
| 172 | 176 |
| 173 // Checks whether the given offset from the current position is before | |
| 174 // the end of the string. | |
| 175 void CheckPosition(int cp_offset, Label* on_outside_input); | |
| 176 | |
| 177 // The ebp-relative location of a regexp register. | 177 // The ebp-relative location of a regexp register. |
| 178 Operand register_location(int register_index); | 178 Operand register_location(int register_index); |
| 179 | 179 |
| 180 // The register containing the current character after LoadCurrentCharacter. | 180 // The register containing the current character after LoadCurrentCharacter. |
| 181 inline Register current_character() { return edx; } | 181 inline Register current_character() { return edx; } |
| 182 | 182 |
| 183 // The register containing the backtrack stack top. Provides a meaningful | 183 // The register containing the backtrack stack top. Provides a meaningful |
| 184 // name to the register. | 184 // name to the register. |
| 185 inline Register backtrack_stackpointer() { return ecx; } | 185 inline Register backtrack_stackpointer() { return ecx; } |
| 186 | 186 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 211 | 211 |
| 212 // Pops a value from the backtrack stack. Reads the word at the stack pointer | 212 // Pops a value from the backtrack stack. Reads the word at the stack pointer |
| 213 // (ecx) and increments it by a word size. | 213 // (ecx) and increments it by a word size. |
| 214 inline void Pop(Register target); | 214 inline void Pop(Register target); |
| 215 | 215 |
| 216 // Before calling a C-function from generated code, align arguments on stack. | 216 // Before calling a C-function from generated code, align arguments on stack. |
| 217 // After aligning the frame, arguments must be stored in esp[0], esp[4], | 217 // After aligning the frame, arguments must be stored in esp[0], esp[4], |
| 218 // etc., not pushed. The argument count assumes all arguments are word sized. | 218 // etc., not pushed. The argument count assumes all arguments are word sized. |
| 219 // Some compilers/platforms require the stack to be aligned when calling | 219 // Some compilers/platforms require the stack to be aligned when calling |
| 220 // C++ code. | 220 // C++ code. |
| 221 inline void FrameAlign(int num_arguments); | 221 // Needs a scratch register to do some arithmetic. This register will be |
| 222 // trashed. |
| 223 inline void FrameAlign(int num_arguments, Register scratch); |
| 222 | 224 |
| 223 // Calls a C function and cleans up the space for arguments allocated | 225 // Calls a C function and cleans up the space for arguments allocated |
| 224 // by FrameAlign. The called function is not allowed to trigger a garbage | 226 // by FrameAlign. The called function is not allowed to trigger a garbage |
| 225 // collection, since that might move the code and invalidate the return | 227 // collection, since that might move the code and invalidate the return |
| 226 // address (unless this is somehow accounted for). | 228 // address (unless this is somehow accounted for). |
| 227 inline void CallCFunction(Address function_address, int num_arguments); | 229 inline void CallCFunction(Address function_address, int num_arguments); |
| 228 | 230 |
| 229 MacroAssembler* masm_; | 231 MacroAssembler* masm_; |
| 230 | 232 |
| 231 // Constant buffer provider. Allocates external storage for storing | 233 // Constant buffer provider. Allocates external storage for storing |
| (...skipping 19 matching lines...) Expand all Loading... |
| 251 Label check_preempt_label_; | 253 Label check_preempt_label_; |
| 252 Label stack_overflow_label_; | 254 Label stack_overflow_label_; |
| 253 | 255 |
| 254 // Handle used to represent the generated code object itself. | 256 // Handle used to represent the generated code object itself. |
| 255 Handle<Object> self_; | 257 Handle<Object> self_; |
| 256 }; | 258 }; |
| 257 | 259 |
| 258 }} // namespace v8::internal | 260 }} // namespace v8::internal |
| 259 | 261 |
| 260 #endif /* REGEXP_MACRO_ASSEMBLER_IA32_H_ */ | 262 #endif /* REGEXP_MACRO_ASSEMBLER_IA32_H_ */ |
| OLD | NEW |