Index: src/js/regexp.js |
diff --git a/src/js/regexp.js b/src/js/regexp.js |
index dbe4837c6456b87ae1484687c1065396b2d63cee..ecf3289b61ca3392cdfe59946fb4d78bab869ac9 100644 |
--- a/src/js/regexp.js |
+++ b/src/js/regexp.js |
@@ -13,7 +13,6 @@ var ExpandReplacement; |
var GlobalArray = global.Array; |
var GlobalObject = global.Object; |
var GlobalRegExp = global.RegExp; |
-var GlobalRegExpPrototype; |
var InternalArray = utils.InternalArray; |
var InternalPackedArray = utils.InternalPackedArray; |
var MaxSimple; |
@@ -80,37 +79,6 @@ function PatternFlags(pattern) { |
} |
-// ES#sec-regexp-pattern-flags |
-// RegExp ( pattern, flags ) |
-function RegExpConstructor(pattern, flags) { |
- var newtarget = new.target; |
- var pattern_is_regexp = IsRegExp(pattern); |
- |
- if (IS_UNDEFINED(newtarget)) { |
- newtarget = GlobalRegExp; |
- |
- // ES6 section 21.2.3.1 step 3.b |
- if (pattern_is_regexp && IS_UNDEFINED(flags) && |
- pattern.constructor === newtarget) { |
- return pattern; |
- } |
- } |
- |
- if (IS_REGEXP(pattern)) { |
- if (IS_UNDEFINED(flags)) flags = PatternFlags(pattern); |
- pattern = REGEXP_SOURCE(pattern); |
- |
- } else if (pattern_is_regexp) { |
- var input_pattern = pattern; |
- pattern = pattern.source; |
- if (IS_UNDEFINED(flags)) flags = input_pattern.flags; |
- } |
- |
- var object = %_NewObject(GlobalRegExp, newtarget); |
- return RegExpInitialize(object, pattern, flags); |
-} |
- |
- |
// ES#sec-regexp.prototype.compile RegExp.prototype.compile (pattern, flags) |
function RegExpCompileJS(pattern, flags) { |
if (!IS_REGEXP(this)) { |
@@ -371,7 +339,7 @@ function RegExpToString() { |
throw %make_type_error( |
kIncompatibleMethodReceiver, 'RegExp.prototype.toString', this); |
} |
- if (this === GlobalRegExpPrototype) { |
+ if (this === GlobalRegExp.prototype) { |
%IncrementUseCounter(kRegExpPrototypeToString); |
} |
return '/' + TO_STRING(this.source) + '/' + TO_STRING(this.flags); |
@@ -1036,7 +1004,7 @@ function RegExpGetFlags() { |
function RegExpGetGlobal() { |
if (!IS_REGEXP(this)) { |
// TODO(littledan): Remove this RegExp compat workaround |
- if (this === GlobalRegExpPrototype) { |
+ if (this === GlobalRegExp.prototype) { |
%IncrementUseCounter(kRegExpPrototypeOldFlagGetter); |
return UNDEFINED; |
} |
@@ -1051,7 +1019,7 @@ function RegExpGetGlobal() { |
function RegExpGetIgnoreCase() { |
if (!IS_REGEXP(this)) { |
// TODO(littledan): Remove this RegExp compat workaround |
- if (this === GlobalRegExpPrototype) { |
+ if (this === GlobalRegExp.prototype) { |
%IncrementUseCounter(kRegExpPrototypeOldFlagGetter); |
return UNDEFINED; |
} |
@@ -1065,7 +1033,7 @@ function RegExpGetIgnoreCase() { |
function RegExpGetMultiline() { |
if (!IS_REGEXP(this)) { |
// TODO(littledan): Remove this RegExp compat workaround |
- if (this === GlobalRegExpPrototype) { |
+ if (this === GlobalRegExp.prototype) { |
%IncrementUseCounter(kRegExpPrototypeOldFlagGetter); |
return UNDEFINED; |
} |
@@ -1079,7 +1047,7 @@ function RegExpGetMultiline() { |
function RegExpGetSource() { |
if (!IS_REGEXP(this)) { |
// TODO(littledan): Remove this RegExp compat workaround |
- if (this === GlobalRegExpPrototype) { |
+ if (this === GlobalRegExp.prototype) { |
%IncrementUseCounter(kRegExpPrototypeSourceGetter); |
return "(?:)"; |
} |
@@ -1094,7 +1062,7 @@ function RegExpGetSticky() { |
if (!IS_REGEXP(this)) { |
// Compat fix: RegExp.prototype.sticky == undefined; UseCounter tracks it |
// TODO(littledan): Remove this workaround or standardize it |
- if (this === GlobalRegExpPrototype) { |
+ if (this === GlobalRegExp.prototype) { |
%IncrementUseCounter(kRegExpPrototypeStickyGetter); |
return UNDEFINED; |
} |
@@ -1109,7 +1077,7 @@ function RegExpGetSticky() { |
function RegExpGetUnicode() { |
if (!IS_REGEXP(this)) { |
// TODO(littledan): Remove this RegExp compat workaround |
- if (this === GlobalRegExpPrototype) { |
+ if (this === GlobalRegExp.prototype) { |
%IncrementUseCounter(kRegExpPrototypeUnicodeGetter); |
return UNDEFINED; |
} |
@@ -1127,13 +1095,6 @@ function RegExpSpecies() { |
// ------------------------------------------------------------------- |
-%FunctionSetInstanceClassName(GlobalRegExp, 'RegExp'); |
-GlobalRegExpPrototype = new GlobalObject(); |
-%FunctionSetPrototype(GlobalRegExp, GlobalRegExpPrototype); |
-%AddNamedProperty( |
- GlobalRegExp.prototype, 'constructor', GlobalRegExp, DONT_ENUM); |
-%SetCode(GlobalRegExp, RegExpConstructor); |
- |
utils.InstallGetter(GlobalRegExp, speciesSymbol, RegExpSpecies); |
utils.InstallFunctions(GlobalRegExp.prototype, DONT_ENUM, [ |