Modified: trunk/Source/_javascript_Core/ChangeLog (198646 => 198647)
--- trunk/Source/_javascript_Core/ChangeLog 2016-03-24 22:27:45 UTC (rev 198646)
+++ trunk/Source/_javascript_Core/ChangeLog 2016-03-24 22:35:35 UTC (rev 198647)
@@ -1,5 +1,22 @@
2016-03-24 Michael Saboff <[email protected]>
+ Create private builtin helper advanceStringIndexUnicode() for use by RegExp builtins
+ https://bugs.webkit.org/show_bug.cgi?id=155855
+
+ Reviewed by Mark Lam.
+
+ Moved advanceStringIndexUnicode() as a separate helper. Added it as a private builtin
+ to the GlobalObject like other private builtins.
+
+ * builtins/RegExpPrototype.js:
+ (advanceStringIndexUnicode):
+ (match):
+ (match.advanceStringIndexUnicode): Deleted.
+ * runtime/JSGlobalObject.cpp:
+ (JSC::JSGlobalObject::init):
+
+2016-03-24 Michael Saboff <[email protected]>
+
[ES6] Add Proxy based tests for RegExp.prototype[@@match]
https://bugs.webkit.org/show_bug.cgi?id=155807
Modified: trunk/Source/_javascript_Core/builtins/RegExpPrototype.js (198646 => 198647)
--- trunk/Source/_javascript_Core/builtins/RegExpPrototype.js 2016-03-24 22:27:45 UTC (rev 198646)
+++ trunk/Source/_javascript_Core/builtins/RegExpPrototype.js 2016-03-24 22:35:35 UTC (rev 198647)
@@ -23,26 +23,30 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-function match(str)
+function advanceStringIndexUnicode(string, stringLength, index)
{
+ // This function implements AdvanceStringIndex described in ES6 21.2.5.2.3, steps 6-11.
+ // It assumes that "unicode" is true for its callers.
"use strict";
- function advanceStringIndexUnicode(string, stringLength, index)
- {
- if (index + 1 >= stringLength)
- return index + 1;
+ if (index + 1 >= stringLength)
+ return index + 1;
- let first = string.@charCodeAt(index);
- if (first < 0xD800 || first > 0xDBFF)
- return index + 1;
+ let first = string.@charCodeAt(index);
+ if (first < 0xD800 || first > 0xDBFF)
+ return index + 1;
- let second = string.@charCodeAt(index + 1);
- if (second < 0xDC00 || second > 0xDFFF)
- return index + 1;
+ let second = string.@charCodeAt(index + 1);
+ if (second < 0xDC00 || second > 0xDFFF)
+ return index + 1;
- return index + 2;
- }
+ return index + 2;
+}
+function match(str)
+{
+ "use strict";
+
if (!(this instanceof @Object))
throw new @TypeError("RegExp.prototype.@@match requires that |this| be an Object");
@@ -75,7 +79,7 @@
if (!resultString.length) {
if (unicode)
- regexp.lastIndex = advanceStringIndexUnicode(stringArg, stringLength, regexp.lastIndex);
+ regexp.lastIndex = @advanceStringIndexUnicode(stringArg, stringLength, regexp.lastIndex);
else
regexp.lastIndex++;
}
Modified: trunk/Source/_javascript_Core/runtime/JSGlobalObject.cpp (198646 => 198647)
--- trunk/Source/_javascript_Core/runtime/JSGlobalObject.cpp 2016-03-24 22:27:45 UTC (rev 198646)
+++ trunk/Source/_javascript_Core/runtime/JSGlobalObject.cpp 2016-03-24 22:35:35 UTC (rev 198647)
@@ -590,6 +590,7 @@
GlobalPropertyInfo(vm.propertyNames->builtinNames().promiseReactionJobPrivateName(), JSFunction::createBuiltinFunction(vm, promiseOperationsPromiseReactionJobCodeGenerator(vm), this), DontEnum | DontDelete | ReadOnly),
GlobalPropertyInfo(vm.propertyNames->builtinNames().promiseResolveThenableJobPrivateName(), JSFunction::createBuiltinFunction(vm, promiseOperationsPromiseResolveThenableJobCodeGenerator(vm), this), DontEnum | DontDelete | ReadOnly),
GlobalPropertyInfo(vm.propertyNames->builtinNames().InspectorInstrumentationPrivateName(), InspectorInstrumentationObject::create(vm, this, InspectorInstrumentationObject::createStructure(vm, this, m_objectPrototype.get())), DontEnum | DontDelete | ReadOnly),
+ GlobalPropertyInfo(vm.propertyNames->builtinNames().advanceStringIndexUnicodePrivateName(), JSFunction::createBuiltinFunction(vm, regExpPrototypeAdvanceStringIndexUnicodeCodeGenerator(vm), this), DontEnum | DontDelete | ReadOnly),
GlobalPropertyInfo(vm.propertyNames->MapPrivateName, mapConstructor, DontEnum | DontDelete | ReadOnly),
GlobalPropertyInfo(vm.propertyNames->builtinNames().generatorResumePrivateName(), JSFunction::createBuiltinFunction(vm, generatorPrototypeGeneratorResumeCodeGenerator(vm), this), DontEnum | DontDelete | ReadOnly),
GlobalPropertyInfo(vm.propertyNames->builtinNames().thisTimeValuePrivateName(), privateFuncThisTimeValue, DontEnum | DontDelete | ReadOnly),