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

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

Issue 1416093006: Unify setting accessor properties in native code. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: rebase Created 5 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 | « no previous file | src/js/messages.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 18 matching lines...) Expand all
29 kRegExpNonObject, "RegExp.prototype.flags", TO_STRING(this)); 29 kRegExpNonObject, "RegExp.prototype.flags", TO_STRING(this));
30 } 30 }
31 var result = ''; 31 var result = '';
32 if (this.global) result += 'g'; 32 if (this.global) result += 'g';
33 if (this.ignoreCase) result += 'i'; 33 if (this.ignoreCase) result += 'i';
34 if (this.multiline) result += 'm'; 34 if (this.multiline) result += 'm';
35 if (this.unicode) result += 'u'; 35 if (this.unicode) result += 'u';
36 if (this.sticky) result += 'y'; 36 if (this.sticky) result += 'y';
37 return result; 37 return result;
38 } 38 }
39 %FunctionSetName(RegExpGetFlags, "RegExp.prototype.flags");
40 %SetNativeFlag(RegExpGetFlags);
41 39
42 40
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 throw MakeTypeError(kRegExpNonRegExp, "RegExp.prototype.sticky"); 44 throw MakeTypeError(kRegExpNonRegExp, "RegExp.prototype.sticky");
47 } 45 }
48 return !!REGEXP_STICKY(this); 46 return !!REGEXP_STICKY(this);
49 } 47 }
50 %FunctionSetName(RegExpGetSticky, "RegExp.prototype.sticky"); 48 %FunctionSetName(RegExpGetSticky, "RegExp.prototype.sticky");
51 %SetNativeFlag(RegExpGetSticky); 49 %SetNativeFlag(RegExpGetSticky);
52 50
53 51
54 // ES6 21.2.5.15. 52 // ES6 21.2.5.15.
55 function RegExpGetUnicode() { 53 function RegExpGetUnicode() {
56 if (!IS_REGEXP(this)) { 54 if (!IS_REGEXP(this)) {
57 throw MakeTypeError(kRegExpNonRegExp, "RegExp.prototype.unicode"); 55 throw MakeTypeError(kRegExpNonRegExp, "RegExp.prototype.unicode");
58 } 56 }
59 return !!REGEXP_UNICODE(this); 57 return !!REGEXP_UNICODE(this);
60 } 58 }
61 %FunctionSetName(RegExpGetUnicode, "RegExp.prototype.unicode"); 59 %FunctionSetName(RegExpGetUnicode, "RegExp.prototype.unicode");
62 %SetNativeFlag(RegExpGetUnicode); 60 %SetNativeFlag(RegExpGetUnicode);
63 61
64 %DefineGetterPropertyUnchecked(GlobalRegExp.prototype, 'flags', 62 utils.InstallGetter(GlobalRegExp.prototype, 'flags', RegExpGetFlags);
65 RegExpGetFlags, DONT_ENUM); 63 utils.InstallGetter(GlobalRegExp.prototype, 'sticky', RegExpGetSticky);
64 utils.InstallGetter(GlobalRegExp.prototype, 'unicode', RegExpGetUnicode);
66 65
67 %DefineGetterPropertyUnchecked(GlobalRegExp.prototype, "sticky",
68 RegExpGetSticky, DONT_ENUM);
69
70 %DefineGetterPropertyUnchecked(GlobalRegExp.prototype, "unicode",
71 RegExpGetUnicode, DONT_ENUM);
72 }) 66 })
OLDNEW
« no previous file with comments | « no previous file | src/js/messages.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698