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

Side by Side Diff: src/js/regexp.js

Issue 1762423002: Add UseCounters for various RegExp compatibility issues (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 9 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
« no previous file with comments | « src/js/macros.py ('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 // 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 (function(global, utils) { 5 (function(global, utils) {
6 6
7 %CheckIsBootstrapping(); 7 %CheckIsBootstrapping();
8 8
9 // ------------------------------------------------------------------- 9 // -------------------------------------------------------------------
10 // Imports 10 // Imports
(...skipping 626 matching lines...) Expand 10 before | Expand all | Expand 10 after
637 return %_SubString(LAST_SUBJECT(RegExpLastMatchInfo), matchStart, matchEnd); 637 return %_SubString(LAST_SUBJECT(RegExpLastMatchInfo), matchStart, matchEnd);
638 }; 638 };
639 } 639 }
640 640
641 641
642 // ES6 21.2.5.4. 642 // ES6 21.2.5.4.
643 function RegExpGetGlobal() { 643 function RegExpGetGlobal() {
644 if (!IS_REGEXP(this)) { 644 if (!IS_REGEXP(this)) {
645 // TODO(littledan): Remove this RegExp compat workaround 645 // TODO(littledan): Remove this RegExp compat workaround
646 if (this === GlobalRegExpPrototype) { 646 if (this === GlobalRegExpPrototype) {
647 %IncrementUseCounter(kRegExpPrototypeOldFlagGetter);
647 return UNDEFINED; 648 return UNDEFINED;
648 } 649 }
649 throw MakeTypeError(kRegExpNonRegExp, "RegExp.prototype.global"); 650 throw MakeTypeError(kRegExpNonRegExp, "RegExp.prototype.global");
650 } 651 }
651 return !!REGEXP_GLOBAL(this); 652 return !!REGEXP_GLOBAL(this);
652 } 653 }
653 %FunctionSetName(RegExpGetGlobal, "RegExp.prototype.global"); 654 %FunctionSetName(RegExpGetGlobal, "RegExp.prototype.global");
654 %SetNativeFlag(RegExpGetGlobal); 655 %SetNativeFlag(RegExpGetGlobal);
655 656
656 657
657 // ES6 21.2.5.5. 658 // ES6 21.2.5.5.
658 function RegExpGetIgnoreCase() { 659 function RegExpGetIgnoreCase() {
659 if (!IS_REGEXP(this)) { 660 if (!IS_REGEXP(this)) {
660 // TODO(littledan): Remove this RegExp compat workaround 661 // TODO(littledan): Remove this RegExp compat workaround
661 if (this === GlobalRegExpPrototype) { 662 if (this === GlobalRegExpPrototype) {
663 %IncrementUseCounter(kRegExpPrototypeOldFlagGetter);
662 return UNDEFINED; 664 return UNDEFINED;
663 } 665 }
664 throw MakeTypeError(kRegExpNonRegExp, "RegExp.prototype.ignoreCase"); 666 throw MakeTypeError(kRegExpNonRegExp, "RegExp.prototype.ignoreCase");
665 } 667 }
666 return !!REGEXP_IGNORE_CASE(this); 668 return !!REGEXP_IGNORE_CASE(this);
667 } 669 }
668 %FunctionSetName(RegExpGetIgnoreCase, "RegExp.prototype.ignoreCase"); 670 %FunctionSetName(RegExpGetIgnoreCase, "RegExp.prototype.ignoreCase");
669 %SetNativeFlag(RegExpGetIgnoreCase); 671 %SetNativeFlag(RegExpGetIgnoreCase);
670 672
671 673
672 // ES6 21.2.5.7. 674 // ES6 21.2.5.7.
673 function RegExpGetMultiline() { 675 function RegExpGetMultiline() {
674 if (!IS_REGEXP(this)) { 676 if (!IS_REGEXP(this)) {
675 // TODO(littledan): Remove this RegExp compat workaround 677 // TODO(littledan): Remove this RegExp compat workaround
676 if (this === GlobalRegExpPrototype) { 678 if (this === GlobalRegExpPrototype) {
679 %IncrementUseCounter(kRegExpPrototypeOldFlagGetter);
677 return UNDEFINED; 680 return UNDEFINED;
678 } 681 }
679 throw MakeTypeError(kRegExpNonRegExp, "RegExp.prototype.multiline"); 682 throw MakeTypeError(kRegExpNonRegExp, "RegExp.prototype.multiline");
680 } 683 }
681 return !!REGEXP_MULTILINE(this); 684 return !!REGEXP_MULTILINE(this);
682 } 685 }
683 %FunctionSetName(RegExpGetMultiline, "RegExp.prototype.multiline"); 686 %FunctionSetName(RegExpGetMultiline, "RegExp.prototype.multiline");
684 %SetNativeFlag(RegExpGetMultiline); 687 %SetNativeFlag(RegExpGetMultiline);
685 688
686 689
687 // ES6 21.2.5.10. 690 // ES6 21.2.5.10.
688 function RegExpGetSource() { 691 function RegExpGetSource() {
689 if (!IS_REGEXP(this)) { 692 if (!IS_REGEXP(this)) {
690 // TODO(littledan): Remove this RegExp compat workaround 693 // TODO(littledan): Remove this RegExp compat workaround
691 if (this === GlobalRegExpPrototype) { 694 if (this === GlobalRegExpPrototype) {
695 %IncrementUseCounter(kRegExpPrototypeSourceGetter);
692 return UNDEFINED; 696 return UNDEFINED;
693 } 697 }
694 throw MakeTypeError(kRegExpNonRegExp, "RegExp.prototype.source"); 698 throw MakeTypeError(kRegExpNonRegExp, "RegExp.prototype.source");
695 } 699 }
696 return REGEXP_SOURCE(this); 700 return REGEXP_SOURCE(this);
697 } 701 }
698 %FunctionSetName(RegExpGetSource, "RegExp.prototype.source"); 702 %FunctionSetName(RegExpGetSource, "RegExp.prototype.source");
699 %SetNativeFlag(RegExpGetSource); 703 %SetNativeFlag(RegExpGetSource);
700 704
701 // ------------------------------------------------------------------- 705 // -------------------------------------------------------------------
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
772 // Exports 776 // Exports
773 777
774 utils.Export(function(to) { 778 utils.Export(function(to) {
775 to.RegExpExec = DoRegExpExec; 779 to.RegExpExec = DoRegExpExec;
776 to.RegExpExecNoTests = RegExpExecNoTests; 780 to.RegExpExecNoTests = RegExpExecNoTests;
777 to.RegExpLastMatchInfo = RegExpLastMatchInfo; 781 to.RegExpLastMatchInfo = RegExpLastMatchInfo;
778 to.RegExpTest = RegExpTest; 782 to.RegExpTest = RegExpTest;
779 }); 783 });
780 784
781 }) 785 })
OLDNEW
« no previous file with comments | « src/js/macros.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698