Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5)

Side by Side Diff: src/regexp-macro-assembler-ia32.h

Issue 12469: * Better factoring of ARM/IA32 code in irregexp. (Closed)
Patch Set: Dropped the unifying ...-native.h file. Created 12 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/regexp-macro-assembler-arm.cc ('k') | src/regexp-macro-assembler-ia32.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 10 matching lines...) Expand all
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 27
28 #ifndef REGEXP_MACRO_ASSEMBLER_IA32_H_ 28 #ifndef REGEXP_MACRO_ASSEMBLER_IA32_H_
29 #define REGEXP_MACRO_ASSEMBLER_IA32_H_ 29 #define REGEXP_MACRO_ASSEMBLER_IA32_H_
30 30
31 #if !(defined(ARM) || defined(__arm__) || defined(__thumb__))
32
33 #include "regexp-macro-assembler.h"
34 #include "macro-assembler-ia32.h"
35
36 namespace v8 { namespace internal { 31 namespace v8 { namespace internal {
37 32
38 class RegExpMacroAssemblerIA32: public RegExpMacroAssembler { 33 class RegExpMacroAssemblerIA32: public RegExpMacroAssembler {
39 public: 34 public:
35 // Type of input string to generate code for.
40 enum Mode {ASCII = 1, UC16 = 2}; 36 enum Mode {ASCII = 1, UC16 = 2};
37
41 RegExpMacroAssemblerIA32(Mode mode, int registers_to_save); 38 RegExpMacroAssemblerIA32(Mode mode, int registers_to_save);
42 virtual ~RegExpMacroAssemblerIA32(); 39 virtual ~RegExpMacroAssemblerIA32();
43 virtual void AdvanceCurrentPosition(int by); 40 virtual void AdvanceCurrentPosition(int by);
44 virtual void AdvanceRegister(int reg, int by); 41 virtual void AdvanceRegister(int reg, int by);
45 virtual void Backtrack(); 42 virtual void Backtrack();
46 virtual void Bind(Label* label); 43 virtual void Bind(Label* label);
47 virtual void CheckBitmap(uc16 start, Label* bitmap, Label* on_zero); 44 virtual void CheckBitmap(uc16 start, Label* bitmap, Label* on_zero);
48 virtual void CheckCharacter(uc16 c, Label* on_equal); 45 virtual void CheckCharacter(uc16 c, Label* on_equal);
49 virtual void CheckCharacterGT(uc16 limit, Label* on_greater); 46 virtual void CheckCharacterGT(uc16 limit, Label* on_greater);
50 virtual void CheckCharacterLT(uc16 limit, Label* on_less); 47 virtual void CheckCharacterLT(uc16 limit, Label* on_less);
(...skipping 30 matching lines...) Expand all
81 virtual void PopRegister(int register_index); 78 virtual void PopRegister(int register_index);
82 virtual void PushBacktrack(Label* label); 79 virtual void PushBacktrack(Label* label);
83 virtual void PushCurrentPosition(); 80 virtual void PushCurrentPosition();
84 virtual void PushRegister(int register_index); 81 virtual void PushRegister(int register_index);
85 virtual void ReadCurrentPositionFromRegister(int reg); 82 virtual void ReadCurrentPositionFromRegister(int reg);
86 virtual void ReadStackPointerFromRegister(int reg); 83 virtual void ReadStackPointerFromRegister(int reg);
87 virtual void SetRegister(int register_index, int to); 84 virtual void SetRegister(int register_index, int to);
88 virtual void Succeed(); 85 virtual void Succeed();
89 virtual void WriteCurrentPositionToRegister(int reg); 86 virtual void WriteCurrentPositionToRegister(int reg);
90 virtual void WriteStackPointerToRegister(int reg); 87 virtual void WriteStackPointerToRegister(int reg);
88
91 private: 89 private:
92 // Offsets from ebp of arguments to function. 90 // Offsets from ebp of arguments to function.
93 static const int kBackup_edi = 1 * sizeof(uint32_t); 91 static const int kBackup_edi = 1 * sizeof(uint32_t);
94 static const int kBackup_esi= 2 * sizeof(uint32_t); 92 static const int kBackup_esi= 2 * sizeof(uint32_t);
95 static const int kInputBuffer = 4 * sizeof(uint32_t); 93 static const int kInputBuffer = 4 * sizeof(uint32_t);
96 static const int kInputStartOffset = 5 * sizeof(uint32_t); 94 static const int kInputStartOffset = 5 * sizeof(uint32_t);
97 static const int kInputEndOffset = 6 * sizeof(uint32_t); 95 static const int kInputEndOffset = 6 * sizeof(uint32_t);
98 static const int kRegisterOutput = 7 * sizeof(uint32_t); 96 static const int kRegisterOutput = 7 * sizeof(uint32_t);
99 97
98 // Initial size of code buffer.
99 static const size_t kRegExpCodeSize = 1024;
100 // Initial size of constant buffers allocated during compilation.
101 static const int kRegExpConstantsSize = 256;
102 // Only unroll loops up to this length.
103 static const int kMaxInlineStringTests = 8;
104 // Special "character" marking end of input.
105 static const uint32_t kEndOfInput = ~0;
106
100 // The ebp-relative location of a regexp register. 107 // The ebp-relative location of a regexp register.
101 Operand register_location(int register_index); 108 Operand register_location(int register_index);
102 109
103 // Byte size of chars in the string to match (decided by the Mode argument) 110 // Byte size of chars in the string to match (decided by the Mode argument)
104 size_t char_size(); 111 size_t char_size();
105 112
106 // Records that a register is used. At the end, we need the number of 113 // Records that a register is used. At the end, we need the number of
107 // registers used. 114 // registers used.
108 void RecordRegister(int register_index); 115 void RecordRegister(int register_index);
109 116
(...skipping 13 matching lines...) Expand all
123 // and an offset. Uses no extra registers. 130 // and an offset. Uses no extra registers.
124 void LoadConstantBufferAddress(Register reg, ArraySlice* buffer); 131 void LoadConstantBufferAddress(Register reg, ArraySlice* buffer);
125 132
126 // Read the current character into the destination register. 133 // Read the current character into the destination register.
127 void ReadCurrentChar(Register destination); 134 void ReadCurrentChar(Register destination);
128 135
129 // Adds code that checks whether preemption has been requested 136 // Adds code that checks whether preemption has been requested
130 // (and checks if we have hit the stack limit too). 137 // (and checks if we have hit the stack limit too).
131 void CheckStackLimit(); 138 void CheckStackLimit();
132 139
133 // Initial size of code buffer.
134 static const size_t kRegExpCodeSize = 1024;
135 // Initial size of constant buffers allocated during compilation.
136 static const int kRegExpConstantsSize = 256;
137 // Only unroll loops up to this length.
138 static const int kMaxInlineStringTests = 8;
139 // Special "character" marking end of input.
140 static const uint32_t kEndOfInput = ~0;
141
142 MacroAssembler* masm_; 140 MacroAssembler* masm_;
141 // Constant buffer provider. Allocates external storage for storing
142 // constants.
143 ByteArrayProvider constants_; 143 ByteArrayProvider constants_;
144 // Which mode to generate code for (ASCII or UTF16). 144 // Which mode to generate code for (ASCII or UTF16).
145 Mode mode_; 145 Mode mode_;
146 // One greater than maximal register index actually used. 146 // One greater than maximal register index actually used.
147 int num_registers_; 147 int num_registers_;
148 // Number of registers to output at the end (the saved registers 148 // Number of registers to output at the end (the saved registers
149 // are always 0..num_saved_registers_-1) 149 // are always 0..num_saved_registers_-1)
150 int num_saved_registers_; 150 int num_saved_registers_;
151 // Whether to generate code that is case-insensitive. Only relevant for 151 // Labels used internally.
152 // back-references.
153 Label entry_label_; 152 Label entry_label_;
154 Label start_label_; 153 Label start_label_;
155 Label success_label_; 154 Label success_label_;
156 Label exit_label_; 155 Label exit_label_;
157 // Handle used to represent the generated code object itself. 156 // Handle used to represent the generated code object itself.
158 Handle<Object> self_; 157 Handle<Object> self_;
159 }; 158 };
160 }}
161 159
162 #endif // !ARM 160 }} // namespace v8::internal
163 161
164 #endif /* REGEXP_MACRO_ASSEMBLER_IA32_H_ */ 162 #endif /* REGEXP_MACRO_ASSEMBLER_IA32_H_ */
OLDNEW
« no previous file with comments | « src/regexp-macro-assembler-arm.cc ('k') | src/regexp-macro-assembler-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698