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

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

Issue 12427: Merge regexp2000 back into bleeding_edge (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: 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 | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright 2008 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are
4 // met:
5 //
6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided
11 // with the distribution.
12 // * Neither the name of Google Inc. nor the names of its
13 // contributors may be used to endorse or promote products derived
14 // from this software without specific prior written permission.
15 //
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
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.
27
28 #ifndef REGEXP_MACRO_ASSEMBLER_IA32_H_
29 #define REGEXP_MACRO_ASSEMBLER_IA32_H_
30
31 #if !(defined __arm__ || defined __thumb__ || defined ARM)
iposva 2008/11/26 06:56:22 Checking for ARM does not belong into this file. I
32
33 #include "regexp-macro-assembler.h"
34 #include "macro-assembler-ia32.h"
35
36 namespace v8 { namespace internal {
37
38 class RegExpMacroAssemblerIA32: public RegExpMacroAssembler {
iposva 2008/11/26 06:56:22 Kevin and I found that naming a class with MyClass
Erik Corry 2008/11/26 12:18:36 I'm not a great fan of having two completely diffe
39 public:
40 enum Mode {ASCII = 1, UC16 = 2};
41 RegExpMacroAssemblerIA32(Mode mode, int registers_to_save, bool ignore_case);
42 virtual ~RegExpMacroAssemblerIA32();
43 virtual void AdvanceCurrentPosition(int by);
44 virtual void AdvanceRegister(int reg, int by);
45 virtual void Backtrack();
46 virtual void Bind(Label* label);
47 virtual void CheckBitmap(uc16 start, Label* bitmap, Label* on_zero);
48 virtual void CheckCharacter(uc16 c, Label* on_equal);
49 virtual void CheckCharacterGT(uc16 limit, Label* on_greater);
50 virtual void CheckCharacterLT(uc16 limit, Label* on_less);
51 virtual void CheckCharacters(Vector<const uc16> str,
52 int cp_offset,
53 Label* on_failure);
54 virtual void CheckCurrentPosition(int register_index, Label* on_equal);
55 virtual void CheckNotBackReference(int start_reg, Label* on_no_match);
56 virtual void CheckNotCharacter(uc16 c, Label* on_not_equal);
57 virtual void CheckNotCharacterAfterOr(uc16 c, uc16 mask, Label* on_not_equal);
58 virtual void CheckNotCharacterAfterMinusOr(uc16 c,
59 uc16 mask,
60 Label* on_not_equal);
61 virtual void DispatchByteMap(uc16 start,
62 Label* byte_map,
63 const Vector<Label*>& destinations);
64 virtual void DispatchHalfNibbleMap(uc16 start,
65 Label* half_nibble_map,
66 const Vector<Label*>& destinations);
67 virtual void DispatchHighByteMap(byte start,
68 Label* byte_map,
69 const Vector<Label*>& destinations);
70 virtual void EmitOrLink(Label* label);
71 virtual void Fail();
72 virtual Handle<Object> GetCode();
73 virtual void GoTo(Label* label);
74 virtual void IfRegisterGE(int reg, int comparand, Label* if_ge);
75 virtual void IfRegisterLT(int reg, int comparand, Label* if_lt);
76 virtual IrregexpImplementation Implementation();
77 virtual void LoadCurrentCharacter(int cp_offset, Label* on_end_of_input);
78 virtual void PopCurrentPosition();
79 virtual void PopRegister(int register_index);
80 virtual void PushBacktrack(Label* label);
81 virtual void PushCurrentPosition();
82 virtual void PushRegister(int register_index);
83 virtual void ReadCurrentPositionFromRegister(int reg);
84 virtual void ReadStackPointerFromRegister(int reg);
85 virtual void SetRegister(int register_index, int to);
86 virtual void Succeed();
87 virtual void WriteCurrentPositionToRegister(int reg);
88 virtual void WriteStackPointerToRegister(int reg);
89 private:
90 // Offsets from ebp of arguments to function.
91 static const int kBackup_edi = 1 * sizeof(uint32_t);
92 static const int kBackup_esi= 2 * sizeof(uint32_t);
93 static const int kInputBuffer = 4 * sizeof(uint32_t);
94 static const int kInputStartOffset = 5 * sizeof(uint32_t);
95 static const int kInputEndOffset = 6 * sizeof(uint32_t);
96 static const int kRegisterOutput = 7 * sizeof(uint32_t);
97
98 // The ebp-relative location of a regexp register.
99 Operand register_location(int register_index);
100
101 // Whether to implement case-insensitive matching.
102 bool ignore_case();
103
104 // Byte size of chars in the string to match (decided by the Mode argument)
105 size_t char_size();
106
107 // Records that a register is used. At the end, we need the number of
108 // registers used.
109 void RecordRegister(int register_index);
110
111 // Equivalent to a conditional branch to the label, unless the label
112 // is NULL, in which case it is a conditional Backtrack.
113 void BranchOrBacktrack(Condition condition, Label* to);
114
115 // Generate code to perform case-canonicalization on the register.
116 void Canonicalize(Register register);
117
118 // Read a character from input at the given offset from the current
119 // position.
120 void ReadChar(Register destination, int offset);
121
122 // Load the address of a "constant buffer" (a slice of a byte array)
123 // into a register. The address is computed from the ByteArray* address
124 // and an offset. Uses no extra registers.
125 void LoadConstantBufferAddress(Register reg, ArraySlice* buffer);
126
127 // Read the current character into the destination register.
128 void ReadCurrentChar(Register destination);
129
130 // Initial size of code buffer.
131 static const size_t kRegExpCodeSize = 1024;
132 // Initial size of constant buffers allocated during compilation.
133 static const int kRegExpConstantsSize = 256;
134 // Only unroll loops up to this length.
135 static const int kMaxInlineStringTests = 8;
136 // Special "character" marking end of input.
137 static const uint32_t kEndOfInput = ~0;
138
139 MacroAssembler* masm_;
140 ByteArrayProvider constants_;
141 // Which mode to generate code for (ASCII or UTF16).
142 Mode mode_;
143 // One greater than maximal register index actually used.
144 int num_registers_;
145 // Number of registers to output at the end (the saved registers
146 // are always 0..num_saved_registers_-1)
147 int num_saved_registers_;
148 // Whether to generate code that is case-insensitive. Only relevant for
149 // back-references.
150 bool ignore_case_;
151 Label entry_label_;
152 Label start_label_;
153 Label success_label_;
154 Label exit_label_;
155 // Handle used to represent the generated code object itself.
156 Handle<Object> self_;
157 };
158 }}
159
160 #endif // !ARM
161
162 #endif /* REGEXP_MACRO_ASSEMBLER_IA32_H_ */
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698