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

Side by Side Diff: test/mjsunit/regexp.js

Issue 2438683005: [regexp] Move RegExp.prototype[@@search] to TF (Closed)
Patch Set: Rebase Created 4 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
« no previous file with comments | « src/code-stub-assembler.cc ('k') | no next file » | 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 730 matching lines...) Expand 10 before | Expand all | Expand 10 after
741 RegExp.prototype.exec = RegExpPrototypeExec; 741 RegExp.prototype.exec = RegExpPrototypeExec;
742 742
743 // Test the code path in RE.proto[@@search] when previousLastIndex is a receiver 743 // Test the code path in RE.proto[@@search] when previousLastIndex is a receiver
744 // but can't be converted to a primitive. This exposed a crash in an older 744 // but can't be converted to a primitive. This exposed a crash in an older
745 // C++ implementation of @@search which a) still relied on Object::Equals, 745 // C++ implementation of @@search which a) still relied on Object::Equals,
746 // and b) incorrectly returned isolate->pending_exception() on error. 746 // and b) incorrectly returned isolate->pending_exception() on error.
747 747
748 var re = /./; 748 var re = /./;
749 re.lastIndex = { [Symbol.toPrimitive]: 42 }; 749 re.lastIndex = { [Symbol.toPrimitive]: 42 };
750 try { "abc".search(re); } catch (_) {} // Ensure we don't crash. 750 try { "abc".search(re); } catch (_) {} // Ensure we don't crash.
751
752 // Test lastIndex values of -0.0 and NaN (since @@search uses SameValue).
753
754 var re = /./;
755 re.exec = function(str) { assertEquals(0, re.lastIndex); return []; }
756 re.lastIndex = -0.0;
757 assertEquals(-0, re.lastIndex);
758 "abc".search(re);
759 assertEquals(-0, re.lastIndex);
760
761 var re = /./;
762 re.exec = function(str) { assertEquals(0, re.lastIndex); return []; }
763 re.lastIndex = NaN;
764 assertEquals(NaN, re.lastIndex);
765 "abc".search(re);
766 assertEquals(NaN, re.lastIndex);
OLDNEW
« no previous file with comments | « src/code-stub-assembler.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698