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

Side by Side Diff: src/regexp-macro-assembler-irregexp.cc

Issue 11600: * Rename to Irregexp throughout.... (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/regexp2000/
Patch Set: Created 12 years, 1 month 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
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
11 // with the distribution. 11 // with the distribution.
12 // * Neither the name of Google Inc. nor the names of its 12 // * Neither the name of Google Inc. nor the names of its
13 // contributors may be used to endorse or promote products derived 13 // contributors may be used to endorse or promote products derived
14 // from this software without specific prior written permission. 14 // from this software without specific prior written permission.
15 // 15 //
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
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 #include "v8.h" 28 #include "v8.h"
29 #include "ast.h" 29 #include "ast.h"
30 #include "bytecodes-re2k.h" 30 #include "bytecodes-irregexp.h"
31 #include "assembler-re2k.h" 31 #include "assembler-irregexp.h"
32 #include "assembler-re2k-inl.h" 32 #include "assembler-irregexp-inl.h"
33 #include "regexp-macro-assembler.h" 33 #include "regexp-macro-assembler.h"
34 #include "regexp-macro-assembler-re2k.h" 34 #include "regexp-macro-assembler-irregexp.h"
35 35
36 36
37 namespace v8 { namespace internal { 37 namespace v8 { namespace internal {
38 38
39 39
40 RegExpMacroAssemblerRe2k::~RegExpMacroAssemblerRe2k() { 40 RegExpMacroAssemblerIrregexp::~RegExpMacroAssemblerIrregexp() {
41 } 41 }
42 42
43 43
44 RegExpMacroAssemblerRe2k::Re2kImplementation 44 RegExpMacroAssemblerIrregexp::IrregexpImplementation
45 RegExpMacroAssemblerRe2k::Implementation() { 45 RegExpMacroAssemblerIrregexp::Implementation() {
46 return kBytecodeImplementation; 46 return kBytecodeImplementation;
47 } 47 }
48 48
49 49
50 void RegExpMacroAssemblerRe2k::Bind(Label* l) { 50 void RegExpMacroAssemblerIrregexp::Bind(Label* l) {
51 assembler_->Bind(l); 51 assembler_->Bind(l);
52 } 52 }
53 53
54 54
55 void RegExpMacroAssemblerRe2k::EmitOrLink(Label* l) { 55 void RegExpMacroAssemblerIrregexp::EmitOrLink(Label* l) {
56 assembler_->EmitOrLink(l); 56 assembler_->EmitOrLink(l);
57 } 57 }
58 58
59 59
60 void RegExpMacroAssemblerRe2k::PopRegister(int register_index) { 60 void RegExpMacroAssemblerIrregexp::PopRegister(int register_index) {
61 assembler_->PopRegister(register_index); 61 assembler_->PopRegister(register_index);
62 } 62 }
63 63
64 64
65 void RegExpMacroAssemblerRe2k::PushRegister(int register_index) { 65 void RegExpMacroAssemblerIrregexp::PushRegister(int register_index) {
66 assembler_->PushRegister(register_index); 66 assembler_->PushRegister(register_index);
67 } 67 }
68 68
69 69
70 void RegExpMacroAssemblerRe2k::WriteCurrentPositionToRegister( 70 void RegExpMacroAssemblerIrregexp::WriteCurrentPositionToRegister(
71 int register_index) { 71 int register_index) {
72 assembler_->WriteCurrentPositionToRegister(register_index); 72 assembler_->WriteCurrentPositionToRegister(register_index);
73 } 73 }
74 74
75 75
76 void RegExpMacroAssemblerRe2k::ReadCurrentPositionFromRegister( 76 void RegExpMacroAssemblerIrregexp::ReadCurrentPositionFromRegister(
77 int register_index) { 77 int register_index) {
78 assembler_->ReadCurrentPositionFromRegister(register_index); 78 assembler_->ReadCurrentPositionFromRegister(register_index);
79 } 79 }
80 80
81 81
82 void RegExpMacroAssemblerRe2k::WriteStackPointerToRegister(int register_index) { 82 void RegExpMacroAssemblerIrregexp::WriteStackPointerToRegister(
83 int register_index) {
83 assembler_->WriteStackPointerToRegister(register_index); 84 assembler_->WriteStackPointerToRegister(register_index);
84 } 85 }
85 86
86 87
87 void RegExpMacroAssemblerRe2k::ReadStackPointerFromRegister( 88 void RegExpMacroAssemblerIrregexp::ReadStackPointerFromRegister(
88 int register_index) { 89 int register_index) {
89 assembler_->ReadStackPointerFromRegister(register_index); 90 assembler_->ReadStackPointerFromRegister(register_index);
90 } 91 }
91 92
92 93
93 void RegExpMacroAssemblerRe2k::SetRegister(int register_index, int to) { 94 void RegExpMacroAssemblerIrregexp::SetRegister(int register_index, int to) {
94 assembler_->SetRegister(register_index, to); 95 assembler_->SetRegister(register_index, to);
95 } 96 }
96 97
97 98
98 void RegExpMacroAssemblerRe2k::AdvanceRegister(int register_index, int by) { 99 void RegExpMacroAssemblerIrregexp::AdvanceRegister(int register_index, int by) {
99 assembler_->AdvanceRegister(register_index, by); 100 assembler_->AdvanceRegister(register_index, by);
100 } 101 }
101 102
102 103
103 void RegExpMacroAssemblerRe2k::PopCurrentPosition() { 104 void RegExpMacroAssemblerIrregexp::PopCurrentPosition() {
104 assembler_->PopCurrentPosition(); 105 assembler_->PopCurrentPosition();
105 } 106 }
106 107
107 108
108 void RegExpMacroAssemblerRe2k::PushCurrentPosition() { 109 void RegExpMacroAssemblerIrregexp::PushCurrentPosition() {
109 assembler_->PushCurrentPosition(); 110 assembler_->PushCurrentPosition();
110 } 111 }
111 112
112 113
113 void RegExpMacroAssemblerRe2k::Backtrack() { 114 void RegExpMacroAssemblerIrregexp::Backtrack() {
114 assembler_->PopBacktrack(); 115 assembler_->PopBacktrack();
115 } 116 }
116 117
117 118
118 void RegExpMacroAssemblerRe2k::GoTo(Label* l) { 119 void RegExpMacroAssemblerIrregexp::GoTo(Label* l) {
119 assembler_->GoTo(l); 120 assembler_->GoTo(l);
120 } 121 }
121 122
122 123
123 void RegExpMacroAssemblerRe2k::PushBacktrack(Label* l) { 124 void RegExpMacroAssemblerIrregexp::PushBacktrack(Label* l) {
124 assembler_->PushBacktrack(l); 125 assembler_->PushBacktrack(l);
125 } 126 }
126 127
127 128
128 void RegExpMacroAssemblerRe2k::Succeed() { 129 void RegExpMacroAssemblerIrregexp::Succeed() {
129 assembler_->Succeed(); 130 assembler_->Succeed();
130 } 131 }
131 132
132 133
133 void RegExpMacroAssemblerRe2k::Fail() { 134 void RegExpMacroAssemblerIrregexp::Fail() {
134 assembler_->Fail(); 135 assembler_->Fail();
135 } 136 }
136 137
137 138
138 void RegExpMacroAssemblerRe2k::AdvanceCurrentPosition(int by) { 139 void RegExpMacroAssemblerIrregexp::AdvanceCurrentPosition(int by) {
139 assembler_->AdvanceCP(by); 140 assembler_->AdvanceCP(by);
140 } 141 }
141 142
142 143
143 void RegExpMacroAssemblerRe2k::CheckCurrentPosition( 144 void RegExpMacroAssemblerIrregexp::CheckCurrentPosition(
144 int register_index, 145 int register_index,
145 Label* on_equal) { 146 Label* on_equal) {
146 // TODO(erikcorry): Implement. 147 // TODO(erikcorry): Implement.
147 UNREACHABLE(); 148 UNREACHABLE();
148 } 149 }
149 150
150 151
151 void RegExpMacroAssemblerRe2k::LoadCurrentCharacter(int cp_offset, 152 void RegExpMacroAssemblerIrregexp::LoadCurrentCharacter(int cp_offset,
152 Label* on_failure) { 153 Label* on_failure) {
153 assembler_->LoadCurrentChar(cp_offset, on_failure); 154 assembler_->LoadCurrentChar(cp_offset, on_failure);
154 } 155 }
155 156
156 157
157 void RegExpMacroAssemblerRe2k::CheckCharacterLT(uc16 limit, Label* on_less) { 158 void RegExpMacroAssemblerIrregexp::CheckCharacterLT(uc16 limit,
159 Label* on_less) {
158 assembler_->CheckCharacterLT(limit, on_less); 160 assembler_->CheckCharacterLT(limit, on_less);
159 } 161 }
160 162
161 163
162 void RegExpMacroAssemblerRe2k::CheckCharacterGT(uc16 limit, Label* on_greater) { 164 void RegExpMacroAssemblerIrregexp::CheckCharacterGT(uc16 limit,
165 Label* on_greater) {
163 assembler_->CheckCharacterGT(limit, on_greater); 166 assembler_->CheckCharacterGT(limit, on_greater);
164 } 167 }
165 168
166 169
167 void RegExpMacroAssemblerRe2k::CheckCharacter(uc16 c, Label* on_equal) { 170 void RegExpMacroAssemblerIrregexp::CheckCharacter(uc16 c, Label* on_equal) {
168 assembler_->CheckCharacter(c, on_equal); 171 assembler_->CheckCharacter(c, on_equal);
169 } 172 }
170 173
171 174
172 void RegExpMacroAssemblerRe2k::CheckNotCharacter(uc16 c, Label* on_not_equal) { 175 void RegExpMacroAssemblerIrregexp::CheckNotCharacter(uc16 c,
176 Label* on_not_equal) {
173 assembler_->CheckNotCharacter(c, on_not_equal); 177 assembler_->CheckNotCharacter(c, on_not_equal);
174 } 178 }
175 179
176 180
177 void RegExpMacroAssemblerRe2k::CheckNotCharacterAfterOr(uc16 c, 181 void RegExpMacroAssemblerIrregexp::CheckNotCharacterAfterOr(uc16 c,
178 uc16 mask, 182 uc16 mask,
179 Label* on_not_equal) { 183 Label* on_not_equal) {
180 assembler_->OrThenCheckNotCharacter(c, mask, on_not_equal); 184 assembler_->OrThenCheckNotCharacter(c, mask, on_not_equal);
181 } 185 }
182 186
183 187
184 void RegExpMacroAssemblerRe2k::CheckNotCharacterAfterMinusOr( 188 void RegExpMacroAssemblerIrregexp::CheckNotCharacterAfterMinusOr(
185 uc16 c, 189 uc16 c,
186 uc16 mask, 190 uc16 mask,
187 Label* on_not_equal) { 191 Label* on_not_equal) {
188 assembler_->MinusOrThenCheckNotCharacter(c, mask, on_not_equal); 192 assembler_->MinusOrThenCheckNotCharacter(c, mask, on_not_equal);
189 } 193 }
190 194
191 195
192 void RegExpMacroAssemblerRe2k::CheckNotBackReference(int start_reg, 196 void RegExpMacroAssemblerIrregexp::CheckNotBackReference(int start_reg,
193 Label* on_not_equal) { 197 Label* on_not_equal) {
194 assembler_->CheckNotBackReference(start_reg, on_not_equal); 198 assembler_->CheckNotBackReference(start_reg, on_not_equal);
195 } 199 }
196 200
197 201
198 void RegExpMacroAssemblerRe2k::CheckBitmap(uc16 start, 202 void RegExpMacroAssemblerIrregexp::CheckBitmap(uc16 start,
199 Label* bitmap, 203 Label* bitmap,
200 Label* on_zero) { 204 Label* on_zero) {
201 assembler_->LookupMap1(start, bitmap, on_zero); 205 assembler_->LookupMap1(start, bitmap, on_zero);
202 } 206 }
203 207
204 208
205 void RegExpMacroAssemblerRe2k::DispatchHalfNibbleMap( 209 void RegExpMacroAssemblerIrregexp::DispatchHalfNibbleMap(
206 uc16 start, 210 uc16 start,
207 Label* half_nibble_map, 211 Label* half_nibble_map,
208 const Vector<Label*>& table) { 212 const Vector<Label*>& table) {
209 assembler_->LookupMap2(start, half_nibble_map, table); 213 assembler_->LookupMap2(start, half_nibble_map, table);
210 } 214 }
211 215
212 216
213 void RegExpMacroAssemblerRe2k::DispatchByteMap(uc16 start, 217 void RegExpMacroAssemblerIrregexp::DispatchByteMap(
214 Label* byte_map, 218 uc16 start,
215 const Vector<Label*>& table) { 219 Label* byte_map,
220 const Vector<Label*>& table) {
216 assembler_->LookupMap8(start, byte_map, table); 221 assembler_->LookupMap8(start, byte_map, table);
217 } 222 }
218 223
219 224
220 void RegExpMacroAssemblerRe2k::DispatchHighByteMap( 225 void RegExpMacroAssemblerIrregexp::DispatchHighByteMap(
221 byte start, 226 byte start,
222 Label* byte_map, 227 Label* byte_map,
223 const Vector<Label*>& table) { 228 const Vector<Label*>& table) {
224 assembler_->LookupHighMap8(start, byte_map, table); 229 assembler_->LookupHighMap8(start, byte_map, table);
225 } 230 }
226 231
227 232
228 void RegExpMacroAssemblerRe2k::CheckCharacters( 233 void RegExpMacroAssemblerIrregexp::CheckCharacters(
229 Vector<const uc16> str, 234 Vector<const uc16> str,
230 int cp_offset, 235 int cp_offset,
231 Label* on_failure) { 236 Label* on_failure) {
232 for (int i = str.length() - 1; i >= 0; i--) { 237 for (int i = str.length() - 1; i >= 0; i--) {
233 assembler_->LoadCurrentChar(cp_offset + i, on_failure); 238 assembler_->LoadCurrentChar(cp_offset + i, on_failure);
234 assembler_->CheckNotCharacter(str[i], on_failure); 239 assembler_->CheckNotCharacter(str[i], on_failure);
235 } 240 }
236 } 241 }
237 242
238 243
239 void RegExpMacroAssemblerRe2k::IfRegisterLT(int register_index, 244 void RegExpMacroAssemblerIrregexp::IfRegisterLT(int register_index,
240 int comparand, 245 int comparand,
241 Label* if_less_than) { 246 Label* if_less_than) {
242 ASSERT(comparand >= 0 && comparand <= 65535); 247 ASSERT(comparand >= 0 && comparand <= 65535);
243 assembler_->CheckRegisterLT(register_index, comparand, if_less_than); 248 assembler_->CheckRegisterLT(register_index, comparand, if_less_than);
244 } 249 }
245 250
246 251
247 void RegExpMacroAssemblerRe2k::IfRegisterGE(int register_index, 252 void RegExpMacroAssemblerIrregexp::IfRegisterGE(int register_index,
248 int comparand, 253 int comparand,
249 Label* if_greater_or_equal) { 254 Label* if_greater_or_equal) {
250 ASSERT(comparand >= 0 && comparand <= 65535); 255 ASSERT(comparand >= 0 && comparand <= 65535);
251 assembler_->CheckRegisterGE(register_index, comparand, if_greater_or_equal); 256 assembler_->CheckRegisterGE(register_index, comparand, if_greater_or_equal);
252 } 257 }
253 258
254 259
255 Handle<Object> RegExpMacroAssemblerRe2k::GetCode() { 260 Handle<Object> RegExpMacroAssemblerIrregexp::GetCode() {
256 Handle<ByteArray> array = Factory::NewByteArray(assembler_->length()); 261 Handle<ByteArray> array = Factory::NewByteArray(assembler_->length());
257 assembler_->Copy(array->GetDataStartAddress()); 262 assembler_->Copy(array->GetDataStartAddress());
258 return array; 263 return array;
259 } 264 }
260 265
261 } } // namespace v8::internal 266 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698