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

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

Issue 1599303002: [regexp] implement case-insensitive unicode regexps. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@unicodeclass
Patch Set: fixes Created 4 years, 11 months 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
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #if V8_TARGET_ARCH_X64 5 #if V8_TARGET_ARCH_X64
6 6
7 #include "src/regexp/x64/regexp-macro-assembler-x64.h" 7 #include "src/regexp/x64/regexp-macro-assembler-x64.h"
8 8
9 #include "src/log.h" 9 #include "src/log.h"
10 #include "src/macro-assembler.h" 10 #include "src/macro-assembler.h"
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 Label fallthrough; 196 Label fallthrough;
197 __ cmpl(rdi, Operand(backtrack_stackpointer(), 0)); 197 __ cmpl(rdi, Operand(backtrack_stackpointer(), 0));
198 __ j(not_equal, &fallthrough); 198 __ j(not_equal, &fallthrough);
199 Drop(); 199 Drop();
200 BranchOrBacktrack(no_condition, on_equal); 200 BranchOrBacktrack(no_condition, on_equal);
201 __ bind(&fallthrough); 201 __ bind(&fallthrough);
202 } 202 }
203 203
204 204
205 void RegExpMacroAssemblerX64::CheckNotBackReferenceIgnoreCase( 205 void RegExpMacroAssemblerX64::CheckNotBackReferenceIgnoreCase(
206 int start_reg, bool read_backward, Label* on_no_match) { 206 int start_reg, bool read_backward, bool unicode, Label* on_no_match) {
207 Label fallthrough; 207 Label fallthrough;
208 ReadPositionFromRegister(rdx, start_reg); // Offset of start of capture 208 ReadPositionFromRegister(rdx, start_reg); // Offset of start of capture
209 ReadPositionFromRegister(rbx, start_reg + 1); // Offset of end of capture 209 ReadPositionFromRegister(rbx, start_reg + 1); // Offset of end of capture
210 __ subp(rbx, rdx); // Length of capture. 210 __ subp(rbx, rdx); // Length of capture.
211 211
212 // ----------------------- 212 // -----------------------
213 // rdx = Start offset of capture. 213 // rdx = Start offset of capture.
214 // rbx = Length of capture 214 // rbx = Length of capture
215 215
216 // At this point, the capture registers are either both set or both cleared. 216 // At this point, the capture registers are either both set or both cleared.
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
301 #endif 301 #endif
302 __ pushq(backtrack_stackpointer()); 302 __ pushq(backtrack_stackpointer());
303 303
304 static const int num_arguments = 4; 304 static const int num_arguments = 4;
305 __ PrepareCallCFunction(num_arguments); 305 __ PrepareCallCFunction(num_arguments);
306 306
307 // Put arguments into parameter registers. Parameters are 307 // Put arguments into parameter registers. Parameters are
308 // Address byte_offset1 - Address captured substring's start. 308 // Address byte_offset1 - Address captured substring's start.
309 // Address byte_offset2 - Address of current character position. 309 // Address byte_offset2 - Address of current character position.
310 // size_t byte_length - length of capture in bytes(!) 310 // size_t byte_length - length of capture in bytes(!)
311 // Isolate* isolate 311 // Isolate* isolate or 0 if unicode flag.
312 #ifdef _WIN64 312 #ifdef _WIN64
313 DCHECK(rcx.is(arg_reg_1));
314 DCHECK(rdx.is(arg_reg_2));
313 // Compute and set byte_offset1 (start of capture). 315 // Compute and set byte_offset1 (start of capture).
314 __ leap(rcx, Operand(rsi, rdx, times_1, 0)); 316 __ leap(rcx, Operand(rsi, rdx, times_1, 0));
315 // Set byte_offset2. 317 // Set byte_offset2.
316 __ leap(rdx, Operand(rsi, rdi, times_1, 0)); 318 __ leap(rdx, Operand(rsi, rdi, times_1, 0));
317 if (read_backward) { 319 if (read_backward) {
318 __ subq(rdx, rbx); 320 __ subq(rdx, rbx);
319 } 321 }
320 // Set byte_length.
321 __ movp(r8, rbx);
322 // Isolate.
323 __ LoadAddress(r9, ExternalReference::isolate_address(isolate()));
324 #else // AMD64 calling convention 322 #else // AMD64 calling convention
323 DCHECK(rdi.is(arg_reg_1));
324 DCHECK(rsi.is(arg_reg_2));
325 // Compute byte_offset2 (current position = rsi+rdi). 325 // Compute byte_offset2 (current position = rsi+rdi).
326 __ leap(rax, Operand(rsi, rdi, times_1, 0)); 326 __ leap(rax, Operand(rsi, rdi, times_1, 0));
327 // Compute and set byte_offset1 (start of capture). 327 // Compute and set byte_offset1 (start of capture).
328 __ leap(rdi, Operand(rsi, rdx, times_1, 0)); 328 __ leap(rdi, Operand(rsi, rdx, times_1, 0));
329 // Set byte_offset2. 329 // Set byte_offset2.
330 __ movp(rsi, rax); 330 __ movp(rsi, rax);
331 if (read_backward) { 331 if (read_backward) {
332 __ subq(rsi, rbx); 332 __ subq(rsi, rbx);
333 } 333 }
334 #endif // _WIN64
335
334 // Set byte_length. 336 // Set byte_length.
335 __ movp(rdx, rbx); 337 __ movp(arg_reg_3, rbx);
336 // Isolate. 338 // Isolate.
337 __ LoadAddress(rcx, ExternalReference::isolate_address(isolate())); 339 #ifdef V8_I18N_SUPPORT
338 #endif 340 if (unicode) {
341 __ movp(arg_reg_4, Immediate(0));
342 } else // NOLINT
343 #endif // V8_I18N_SUPPORT
344 {
345 __ LoadAddress(arg_reg_4, ExternalReference::isolate_address(isolate()));
346 }
339 347
340 { // NOLINT: Can't find a way to open this scope without confusing the 348 { // NOLINT: Can't find a way to open this scope without confusing the
341 // linter. 349 // linter.
342 AllowExternalCallThatCantCauseGC scope(&masm_); 350 AllowExternalCallThatCantCauseGC scope(&masm_);
343 ExternalReference compare = 351 ExternalReference compare =
344 ExternalReference::re_case_insensitive_compare_uc16(isolate()); 352 ExternalReference::re_case_insensitive_compare_uc16(isolate());
345 __ CallCFunction(compare, num_arguments); 353 __ CallCFunction(compare, num_arguments);
346 } 354 }
347 355
348 // Restore original values before reacting on result value. 356 // Restore original values before reacting on result value.
(...skipping 1034 matching lines...) Expand 10 before | Expand all | Expand 10 after
1383 } 1391 }
1384 1392
1385 #undef __ 1393 #undef __
1386 1394
1387 #endif // V8_INTERPRETED_REGEXP 1395 #endif // V8_INTERPRETED_REGEXP
1388 1396
1389 } // namespace internal 1397 } // namespace internal
1390 } // namespace v8 1398 } // namespace v8
1391 1399
1392 #endif // V8_TARGET_ARCH_X64 1400 #endif // V8_TARGET_ARCH_X64
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698