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

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

Issue 10536170: Add missing string length check in regexp engine. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Comments addressed Created 8 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « src/ia32/regexp-macro-assembler-ia32.cc ('k') | test/mjsunit/regress/regress-2172.js » ('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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 335 matching lines...) Expand 10 before | Expand all | Expand 10 after
346 // If length is negative, this code will fail (it's a symptom of a partial or 346 // If length is negative, this code will fail (it's a symptom of a partial or
347 // illegal capture where start of capture after end of capture). 347 // illegal capture where start of capture after end of capture).
348 // This must not happen (no back-reference can reference a capture that wasn't 348 // This must not happen (no back-reference can reference a capture that wasn't
349 // closed before in the reg-exp, and we must not generate code that can cause 349 // closed before in the reg-exp, and we must not generate code that can cause
350 // this condition). 350 // this condition).
351 351
352 // If length is zero, either the capture is empty or it is nonparticipating. 352 // If length is zero, either the capture is empty or it is nonparticipating.
353 // In either case succeed immediately. 353 // In either case succeed immediately.
354 __ j(equal, &fallthrough); 354 __ j(equal, &fallthrough);
355 355
356 // -----------------------
357 // rdx - Start of capture
358 // rbx - length of capture
359 // Check that there are sufficient characters left in the input.
360 __ movl(rax, rdi);
361 __ addl(rax, rbx);
362 BranchOrBacktrack(greater, on_no_match);
363
356 if (mode_ == ASCII) { 364 if (mode_ == ASCII) {
357 Label loop_increment; 365 Label loop_increment;
358 if (on_no_match == NULL) { 366 if (on_no_match == NULL) {
359 on_no_match = &backtrack_label_; 367 on_no_match = &backtrack_label_;
360 } 368 }
361 369
362 __ lea(r9, Operand(rsi, rdx, times_1, 0)); 370 __ lea(r9, Operand(rsi, rdx, times_1, 0));
363 __ lea(r11, Operand(rsi, rdi, times_1, 0)); 371 __ lea(r11, Operand(rsi, rdi, times_1, 0));
364 __ addq(rbx, r9); // End of capture 372 __ addq(rbx, r9); // End of capture
365 // --------------------- 373 // ---------------------
(...skipping 1161 matching lines...) Expand 10 before | Expand all | Expand 10 after
1527 } 1535 }
1528 } 1536 }
1529 1537
1530 #undef __ 1538 #undef __
1531 1539
1532 #endif // V8_INTERPRETED_REGEXP 1540 #endif // V8_INTERPRETED_REGEXP
1533 1541
1534 }} // namespace v8::internal 1542 }} // namespace v8::internal
1535 1543
1536 #endif // V8_TARGET_ARCH_X64 1544 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/ia32/regexp-macro-assembler-ia32.cc ('k') | test/mjsunit/regress/regress-2172.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698