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

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

Issue 1558113002: Add UseCounters for various standards-related code paths (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix accidental redefinition 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
« no previous file with comments | « src/i18n.cc ('k') | src/js/harmony-unicode-regexps.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 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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 'use strict'; 7 'use strict';
8 8
9 %CheckIsBootstrapping(); 9 %CheckIsBootstrapping();
10 10
(...skipping 20 matching lines...) Expand all
31 } 31 }
32 var result = ''; 32 var result = '';
33 if (this.global) result += 'g'; 33 if (this.global) result += 'g';
34 if (this.ignoreCase) result += 'i'; 34 if (this.ignoreCase) result += 'i';
35 if (this.multiline) result += 'm'; 35 if (this.multiline) result += 'm';
36 if (this.unicode) result += 'u'; 36 if (this.unicode) result += 'u';
37 if (this.sticky) result += 'y'; 37 if (this.sticky) result += 'y';
38 return result; 38 return result;
39 } 39 }
40 40
41 const kRegExpPrototypeStickyGetter = 11;
42
43 // ES6 21.2.5.12. 41 // ES6 21.2.5.12.
44 function RegExpGetSticky() { 42 function RegExpGetSticky() {
45 if (!IS_REGEXP(this)) { 43 if (!IS_REGEXP(this)) {
46 // Compat fix: RegExp.prototype.sticky == undefined; UseCounter tracks it 44 // Compat fix: RegExp.prototype.sticky == undefined; UseCounter tracks it
47 // TODO(littledan): Remove this workaround or standardize it 45 // TODO(littledan): Remove this workaround or standardize it
48 if (this === GlobalRegExpPrototype) { 46 if (this === GlobalRegExpPrototype) {
49 %IncrementUseCounter(kRegExpPrototypeStickyGetter); 47 %IncrementUseCounter(kRegExpPrototypeStickyGetter);
50 return UNDEFINED; 48 return UNDEFINED;
51 } 49 }
52 throw MakeTypeError(kRegExpNonRegExp, "RegExp.prototype.sticky"); 50 throw MakeTypeError(kRegExpNonRegExp, "RegExp.prototype.sticky");
53 } 51 }
54 return !!REGEXP_STICKY(this); 52 return !!REGEXP_STICKY(this);
55 } 53 }
56 %FunctionSetName(RegExpGetSticky, "RegExp.prototype.sticky"); 54 %FunctionSetName(RegExpGetSticky, "RegExp.prototype.sticky");
57 %SetNativeFlag(RegExpGetSticky); 55 %SetNativeFlag(RegExpGetSticky);
58 56
59 utils.InstallGetter(GlobalRegExp.prototype, 'flags', RegExpGetFlags); 57 utils.InstallGetter(GlobalRegExp.prototype, 'flags', RegExpGetFlags);
60 utils.InstallGetter(GlobalRegExp.prototype, 'sticky', RegExpGetSticky); 58 utils.InstallGetter(GlobalRegExp.prototype, 'sticky', RegExpGetSticky);
61 59
62 }) 60 })
OLDNEW
« no previous file with comments | « src/i18n.cc ('k') | src/js/harmony-unicode-regexps.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698