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

Unified Diff: src/regexp.js

Issue 1318043002: Native context: do not put public symbols and flags on the js builtins object. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: fix and rebase Created 5 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/promise.js ('k') | src/runtime.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/regexp.js
diff --git a/src/regexp.js b/src/regexp.js
index a6a543fe07fe1e42e637e1d53f89dd6cd229ede0..3e5c0b63b478f6df7f6de56fb3662de2445bc540 100644
--- a/src/regexp.js
+++ b/src/regexp.js
@@ -3,8 +3,6 @@
// found in the LICENSE file.
var $regexpLastMatchInfoOverride;
-var harmony_regexps = false;
-var harmony_unicode_regexps = false;
(function(global, utils) {
@@ -13,6 +11,8 @@ var harmony_unicode_regexps = false;
// -------------------------------------------------------------------
// Imports
+var FLAG_harmony_regexps;
+var FLAG_harmony_unicode_regexps;
var GlobalRegExp = global.RegExp;
var InternalPackedArray = utils.InternalPackedArray;
var ToNumber;
@@ -21,6 +21,11 @@ utils.Import(function(from) {
ToNumber = from.ToNumber;
});
+utils.ImportFromExperimental(function(from) {
+ FLAG_harmony_regexps = from.FLAG_harmony_regexps;
+ FLAG_harmony_unicode_regexps = from.FLAG_harmony_unicode_regexps;
+});
+
// -------------------------------------------------------------------
// Property of the builtins object for recording the result of the last
@@ -54,9 +59,9 @@ function DoConstructRegExp(object, pattern, flags) {
flags = (pattern.global ? 'g' : '')
+ (pattern.ignoreCase ? 'i' : '')
+ (pattern.multiline ? 'm' : '');
- if (harmony_unicode_regexps)
+ if (FLAG_harmony_unicode_regexps)
flags += (pattern.unicode ? 'u' : '');
- if (harmony_regexps)
+ if (FLAG_harmony_regexps)
flags += (pattern.sticky ? 'y' : '');
pattern = pattern.source;
}
@@ -163,7 +168,7 @@ function RegExpExecJS(string) {
// algorithm, step 5) even if the value is discarded for non-global RegExps.
var i = TO_INTEGER(lastIndex);
- var updateLastIndex = this.global || (harmony_regexps && this.sticky);
+ var updateLastIndex = this.global || (FLAG_harmony_regexps && this.sticky);
if (updateLastIndex) {
if (i < 0 || i > string.length) {
this.lastIndex = 0;
@@ -211,7 +216,7 @@ function RegExpTest(string) {
// algorithm, step 5) even if the value is discarded for non-global RegExps.
var i = TO_INTEGER(lastIndex);
- if (this.global || (harmony_regexps && this.sticky)) {
+ if (this.global || (FLAG_harmony_regexps && this.sticky)) {
if (i < 0 || i > string.length) {
this.lastIndex = 0;
return false;
@@ -269,8 +274,8 @@ function RegExpToString() {
if (this.global) result += 'g';
if (this.ignoreCase) result += 'i';
if (this.multiline) result += 'm';
- if (harmony_unicode_regexps && this.unicode) result += 'u';
- if (harmony_regexps && this.sticky) result += 'y';
+ if (FLAG_harmony_unicode_regexps && this.unicode) result += 'u';
+ if (FLAG_harmony_regexps && this.sticky) result += 'y';
return result;
}
« no previous file with comments | « src/promise.js ('k') | src/runtime.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698