<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[185432] trunk</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/185432">185432</a></dd>
<dt>Author</dt> <dd>commit-queue@webkit.org</dd>
<dt>Date</dt> <dd>2015-06-10 15:32:36 -0700 (Wed, 10 Jun 2015)</dd>
</dl>

<h3>Log Message</h3>
<pre>Implement RegExp.prototype.flags
https://bugs.webkit.org/show_bug.cgi?id=145599

Patch by Jordan Harband &lt;ljharb@gmail.com&gt; on 2015-06-10
Reviewed by Geoffrey Garen.
Source/JavaScriptCore:

Per https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-regexp.prototype.flags

* runtime/CommonIdentifiers.h:
* runtime/RegExpPrototype.cpp:
(JSC::flagsString):
(JSC::regExpProtoFuncToString):
(JSC::regExpProtoGetterFlags):
* tests/stress/static-getter-in-names.js:

LayoutTests:

* js/Object-getOwnPropertyNames-expected.txt:
* js/regexp-flags-expected.txt: Added.
* js/regexp-flags.html: Added.
* js/script-tests/Object-getOwnPropertyNames.js:
* js/script-tests/regexp-flags.js: Added.
(.get shouldBe):</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsjsObjectgetOwnPropertyNamesexpectedtxt">trunk/LayoutTests/js/Object-getOwnPropertyNames-expected.txt</a></li>
<li><a href="#trunkLayoutTestsjsscripttestsObjectgetOwnPropertyNamesjs">trunk/LayoutTests/js/script-tests/Object-getOwnPropertyNames.js</a></li>
<li><a href="#trunkSourceJavaScriptCoreChangeLog">trunk/Source/JavaScriptCore/ChangeLog</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeCommonIdentifiersh">trunk/Source/JavaScriptCore/runtime/CommonIdentifiers.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeRegExpPrototypecpp">trunk/Source/JavaScriptCore/runtime/RegExpPrototype.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoretestsstressstaticgetterinnamesjs">trunk/Source/JavaScriptCore/tests/stress/static-getter-in-names.js</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsjsregexpflagsexpectedtxt">trunk/LayoutTests/js/regexp-flags-expected.txt</a></li>
<li><a href="#trunkLayoutTestsjsregexpflagshtml">trunk/LayoutTests/js/regexp-flags.html</a></li>
<li><a href="#trunkLayoutTestsjsscripttestsregexpflagsjs">trunk/LayoutTests/js/script-tests/regexp-flags.js</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (185431 => 185432)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2015-06-10 21:53:42 UTC (rev 185431)
+++ trunk/LayoutTests/ChangeLog        2015-06-10 22:32:36 UTC (rev 185432)
</span><span class="lines">@@ -1,3 +1,17 @@
</span><ins>+2015-06-10  Jordan Harband  &lt;ljharb@gmail.com&gt;
+
+        Implement RegExp.prototype.flags
+        https://bugs.webkit.org/show_bug.cgi?id=145599
+
+        Reviewed by Geoffrey Garen.
+
+        * js/Object-getOwnPropertyNames-expected.txt:
+        * js/regexp-flags-expected.txt: Added.
+        * js/regexp-flags.html: Added.
+        * js/script-tests/Object-getOwnPropertyNames.js:
+        * js/script-tests/regexp-flags.js: Added.
+        (.get shouldBe):
+
</ins><span class="cx"> 2015-06-10  Alex Christensen  &lt;achristensen@webkit.org&gt;
</span><span class="cx"> 
</span><span class="cx">         Move all content extension tests to same directory to fix flakiness.
</span></span></pre></div>
<a id="trunkLayoutTestsjsObjectgetOwnPropertyNamesexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/js/Object-getOwnPropertyNames-expected.txt (185431 => 185432)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/Object-getOwnPropertyNames-expected.txt        2015-06-10 21:53:42 UTC (rev 185431)
+++ trunk/LayoutTests/js/Object-getOwnPropertyNames-expected.txt        2015-06-10 22:32:36 UTC (rev 185432)
</span><span class="lines">@@ -56,7 +56,7 @@
</span><span class="cx"> PASS getSortedOwnPropertyNames(Date) is ['UTC', 'length', 'name', 'now', 'parse', 'prototype']
</span><span class="cx"> PASS getSortedOwnPropertyNames(Date.prototype) is ['constructor', 'getDate', 'getDay', 'getFullYear', 'getHours', 'getMilliseconds', 'getMinutes', 'getMonth', 'getSeconds', 'getTime', 'getTimezoneOffset', 'getUTCDate', 'getUTCDay', 'getUTCFullYear', 'getUTCHours', 'getUTCMilliseconds', 'getUTCMinutes', 'getUTCMonth', 'getUTCSeconds', 'getYear', 'setDate', 'setFullYear', 'setHours', 'setMilliseconds', 'setMinutes', 'setMonth', 'setSeconds', 'setTime', 'setUTCDate', 'setUTCFullYear', 'setUTCHours', 'setUTCMilliseconds', 'setUTCMinutes', 'setUTCMonth', 'setUTCSeconds', 'setYear', 'toDateString', 'toGMTString', 'toISOString', 'toJSON', 'toLocaleDateString', 'toLocaleString', 'toLocaleTimeString', 'toString', 'toTimeString', 'toUTCString', 'valueOf']
</span><span class="cx"> PASS getSortedOwnPropertyNames(RegExp) is ['$&amp;', &quot;$'&quot;, '$*', '$+', '$1', '$2', '$3', '$4', '$5', '$6', '$7', '$8', '$9', '$_', '$`', 'input', 'lastMatch', 'lastParen', 'leftContext', 'length', 'multiline', 'name', 'prototype', 'rightContext']
</span><del>-PASS getSortedOwnPropertyNames(RegExp.prototype) is ['compile', 'constructor', 'exec', 'global', 'ignoreCase', 'lastIndex', 'multiline', 'source', 'test', 'toString']
</del><ins>+PASS getSortedOwnPropertyNames(RegExp.prototype) is ['compile', 'constructor', 'exec', 'flags', 'global', 'ignoreCase', 'lastIndex', 'multiline', 'source', 'test', 'toString']
</ins><span class="cx"> PASS getSortedOwnPropertyNames(Error) is ['length', 'name', 'prototype']
</span><span class="cx"> PASS getSortedOwnPropertyNames(Error.prototype) is ['constructor', 'message', 'name', 'toString']
</span><span class="cx"> PASS getSortedOwnPropertyNames(Math) is ['E','LN10','LN2','LOG10E','LOG2E','PI','SQRT1_2','SQRT2','abs','acos','acosh','asin','asinh','atan','atan2','atanh','cbrt','ceil','clz32','cos','cosh','exp','expm1','floor','fround','hypot','imul','log','log10','log1p','log2','max','min','pow','random','round','sign','sin','sinh','sqrt','tan','tanh','trunc']
</span></span></pre></div>
<a id="trunkLayoutTestsjsregexpflagsexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/js/regexp-flags-expected.txt (0 => 185432)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/regexp-flags-expected.txt                                (rev 0)
+++ trunk/LayoutTests/js/regexp-flags-expected.txt        2015-06-10 22:32:36 UTC (rev 185432)
</span><span class="lines">@@ -0,0 +1,29 @@
</span><ins>+Test RegExp#flags accessor
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+property descriptor
+PASS descriptor.configurable is true
+PASS descriptor.enumerable is false
+PASS typeof descriptor.get is 'function'
+PASS descriptor.set is undefined
+PASS /a/g.flags is 'g'
+PASS /a/.flags is ''
+PASS /a/gmi.flags is 'gim'
+PASS new RegExp('a', 'gmi').flags is 'gim'
+PASS flags.call(/a/ig) is 'gi'
+non-object receivers
+PASS flags.call(undefined) threw exception TypeError: Type error.
+PASS flags.call(null) threw exception TypeError: Type error.
+PASS flags.call(false) threw exception TypeError: Type error.
+PASS flags.call(true) threw exception TypeError: Type error.
+non-regex objects
+PASS flags.call({}) is ''
+PASS flags.call({global: true, multiline: true, ignoreCase: true}) is 'gim'
+PASS flags.call({global: 1, multiline: 0, ignoreCase: 2}) is 'gi'
+PASS flags.call({ __proto__: { multiline: true } }) is 'm'
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsjsregexpflagshtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/js/regexp-flags.html (0 => 185432)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/regexp-flags.html                                (rev 0)
+++ trunk/LayoutTests/js/regexp-flags.html        2015-06-10 22:32:36 UTC (rev 185432)
</span><span class="lines">@@ -0,0 +1,10 @@
</span><ins>+&lt;!DOCTYPE HTML PUBLIC &quot;-//IETF//DTD HTML//EN&quot;&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;script src=&quot;../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
+&lt;/head&gt;
+&lt;body&gt;
+&lt;script src=&quot;script-tests/regexp-flags.js&quot;&gt;&lt;/script&gt;
+&lt;script src=&quot;../resources/js-test-post.js&quot;&gt;&lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsjsscripttestsObjectgetOwnPropertyNamesjs"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/js/script-tests/Object-getOwnPropertyNames.js (185431 => 185432)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/script-tests/Object-getOwnPropertyNames.js        2015-06-10 21:53:42 UTC (rev 185431)
+++ trunk/LayoutTests/js/script-tests/Object-getOwnPropertyNames.js        2015-06-10 22:32:36 UTC (rev 185432)
</span><span class="lines">@@ -65,7 +65,7 @@
</span><span class="cx">     &quot;Date&quot;: &quot;['UTC', 'length', 'name', 'now', 'parse', 'prototype']&quot;,
</span><span class="cx">     &quot;Date.prototype&quot;: &quot;['constructor', 'getDate', 'getDay', 'getFullYear', 'getHours', 'getMilliseconds', 'getMinutes', 'getMonth', 'getSeconds', 'getTime', 'getTimezoneOffset', 'getUTCDate', 'getUTCDay', 'getUTCFullYear', 'getUTCHours', 'getUTCMilliseconds', 'getUTCMinutes', 'getUTCMonth', 'getUTCSeconds', 'getYear', 'setDate', 'setFullYear', 'setHours', 'setMilliseconds', 'setMinutes', 'setMonth', 'setSeconds', 'setTime', 'setUTCDate', 'setUTCFullYear', 'setUTCHours', 'setUTCMilliseconds', 'setUTCMinutes', 'setUTCMonth', 'setUTCSeconds', 'setYear', 'toDateString', 'toGMTString', 'toISOString', 'toJSON', 'toLocaleDateString', 'toLocaleString', 'toLocaleTimeString', 'toString', 'toTimeString', 'toUTCString', 'valueOf']&quot;,
</span><span class="cx">     &quot;RegExp&quot;: &quot;['$&amp;', \&quot;$'\&quot;, '$*', '$+', '$1', '$2', '$3', '$4', '$5', '$6', '$7', '$8', '$9', '$_', '$`', 'input', 'lastMatch', 'lastParen', 'leftContext', 'length', 'multiline', 'name', 'prototype', 'rightContext']&quot;,
</span><del>-    &quot;RegExp.prototype&quot;: &quot;['compile', 'constructor', 'exec', 'global', 'ignoreCase', 'lastIndex', 'multiline', 'source', 'test', 'toString']&quot;,
</del><ins>+    &quot;RegExp.prototype&quot;: &quot;['compile', 'constructor', 'exec', 'flags', 'global', 'ignoreCase', 'lastIndex', 'multiline', 'source', 'test', 'toString']&quot;,
</ins><span class="cx">     &quot;Error&quot;: &quot;['length', 'name', 'prototype']&quot;,
</span><span class="cx">     &quot;Error.prototype&quot;: &quot;['constructor', 'message', 'name', 'toString']&quot;,
</span><span class="cx">     &quot;Math&quot;: &quot;['E','LN10','LN2','LOG10E','LOG2E','PI','SQRT1_2','SQRT2','abs','acos','acosh','asin','asinh','atan','atan2','atanh','cbrt','ceil','clz32','cos','cosh','exp','expm1','floor','fround','hypot','imul','log','log10','log1p','log2','max','min','pow','random','round','sign','sin','sinh','sqrt','tan','tanh','trunc']&quot;,
</span></span></pre></div>
<a id="trunkLayoutTestsjsscripttestsregexpflagsjs"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/js/script-tests/regexp-flags.js (0 => 185432)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/script-tests/regexp-flags.js                                (rev 0)
+++ trunk/LayoutTests/js/script-tests/regexp-flags.js        2015-06-10 22:32:36 UTC (rev 185432)
</span><span class="lines">@@ -0,0 +1,46 @@
</span><ins>+description('Test RegExp#flags accessor');
+
+debug(&quot;property descriptor&quot;);
+var descriptor = Object.getOwnPropertyDescriptor(RegExp.prototype, 'flags');
+shouldBe(&quot;descriptor.configurable&quot;, &quot;true&quot;);
+shouldBe(&quot;descriptor.enumerable&quot;, &quot;false&quot;);
+shouldBe(&quot;typeof descriptor.get&quot;, &quot;'function'&quot;);
+shouldBe(&quot;descriptor.set&quot;, &quot;undefined&quot;);
+
+var flags = descriptor.get;
+
+shouldBe(&quot;/a/g.flags&quot;, &quot;'g'&quot;);
+shouldBe(&quot;/a/.flags&quot;, &quot;''&quot;);
+shouldBe(&quot;/a/gmi.flags&quot;, &quot;'gim'&quot;); // order is specified, happens to be alphabetic
+shouldBe(&quot;new RegExp('a', 'gmi').flags&quot;, &quot;'gim'&quot;);
+shouldBe(&quot;flags.call(/a/ig)&quot;, &quot;'gi'&quot;);
+
+debug(&quot;non-object receivers&quot;);
+shouldThrow(&quot;flags.call(undefined)&quot;, &quot;'TypeError: Type error'&quot;);
+shouldThrow(&quot;flags.call(null)&quot;, &quot;'TypeError: Type error'&quot;);
+shouldThrow(&quot;flags.call(false)&quot;, &quot;'TypeError: Type error'&quot;);
+shouldThrow(&quot;flags.call(true)&quot;, &quot;'TypeError: Type error'&quot;);
+
+debug(&quot;non-regex objects&quot;);
+shouldBe(&quot;flags.call({})&quot;, &quot;''&quot;);
+shouldBe(&quot;flags.call({global: true, multiline: true, ignoreCase: true})&quot;, &quot;'gim'&quot;);
+shouldBe(&quot;flags.call({global: 1, multiline: 0, ignoreCase: 2})&quot;, &quot;'gi'&quot;);
+// inherited properties count
+shouldBe(&quot;flags.call({ __proto__: { multiline: true } })&quot;, &quot;'m'&quot;);
+
+if (RegExp.prototype.hasOwnProperty('sticky')) {
+  debug(&quot;sticky flag&quot;);
+  // when the engine supports &quot;sticky&quot;, these tests will fail by design.
+  // Hopefully, only the expected output will need updating.
+  shouldBe(&quot;/a/yimg.flags&quot;, &quot;'gimy'&quot;);
+  shouldBe(&quot;new RegExp('a', 'yimg').flags&quot;, &quot;'gimy'&quot;);
+  shouldBe(&quot;flags.call({global: true, multiline: true, ignoreCase: true, sticky: true})&quot;, &quot;'gimy'&quot;);
+}
+if (RegExp.prototype.hasOwnProperty('unicode')) {
+  debug(&quot;unicode flag&quot;);
+  // when the engine supports &quot;unicode&quot;, these tests will fail by design.
+  // Hopefully, only the expected output will need updating.
+  shouldBe(&quot;/a/uimg.flags&quot;, &quot;'gimu'&quot;);
+  shouldBe(&quot;new RegExp('a', 'uimg').flags&quot;, &quot;'gimu'&quot;);
+  shouldBe(&quot;flags.call({global: true, multiline: true, ignoreCase: true, unicode: true})&quot;, &quot;'gimu'&quot;);
+}
</ins></span></pre></div>
<a id="trunkSourceJavaScriptCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ChangeLog (185431 => 185432)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ChangeLog        2015-06-10 21:53:42 UTC (rev 185431)
+++ trunk/Source/JavaScriptCore/ChangeLog        2015-06-10 22:32:36 UTC (rev 185432)
</span><span class="lines">@@ -1,3 +1,18 @@
</span><ins>+2015-06-10  Jordan Harband  &lt;ljharb@gmail.com&gt;
+
+        Implement RegExp.prototype.flags
+        https://bugs.webkit.org/show_bug.cgi?id=145599
+
+        Reviewed by Geoffrey Garen.
+        Per https://people.mozilla.org/~jorendorff/es6-draft.html#sec-get-regexp.prototype.flags
+
+        * runtime/CommonIdentifiers.h:
+        * runtime/RegExpPrototype.cpp:
+        (JSC::flagsString):
+        (JSC::regExpProtoFuncToString):
+        (JSC::regExpProtoGetterFlags):
+        * tests/stress/static-getter-in-names.js:
+
</ins><span class="cx"> 2015-06-10  Filip Pizlo  &lt;fpizlo@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         DFG ASSERTION FAILED: !iterate() on stress/singleton-scope-then-overwrite.js.ftl-eager
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeCommonIdentifiersh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/CommonIdentifiers.h (185431 => 185432)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/CommonIdentifiers.h        2015-06-10 21:53:42 UTC (rev 185431)
+++ trunk/Source/JavaScriptCore/runtime/CommonIdentifiers.h        2015-06-10 22:32:36 UTC (rev 185432)
</span><span class="lines">@@ -103,6 +103,7 @@
</span><span class="cx">     macro(exec) \
</span><span class="cx">     macro(executionCount) \
</span><span class="cx">     macro(exitKind) \
</span><ins>+    macro(flags) \
</ins><span class="cx">     macro(focus) \
</span><span class="cx">     macro(forEach) \
</span><span class="cx">     macro(forward) \
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeRegExpPrototypecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/RegExpPrototype.cpp (185431 => 185432)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/RegExpPrototype.cpp        2015-06-10 21:53:42 UTC (rev 185431)
+++ trunk/Source/JavaScriptCore/runtime/RegExpPrototype.cpp        2015-06-10 22:32:36 UTC (rev 185432)
</span><span class="lines">@@ -47,6 +47,7 @@
</span><span class="cx"> static EncodedJSValue JSC_HOST_CALL regExpProtoGetterIgnoreCase(ExecState*);
</span><span class="cx"> static EncodedJSValue JSC_HOST_CALL regExpProtoGetterMultiline(ExecState*);
</span><span class="cx"> static EncodedJSValue JSC_HOST_CALL regExpProtoGetterSource(ExecState*);
</span><ins>+static EncodedJSValue JSC_HOST_CALL regExpProtoGetterFlags(ExecState*);
</ins><span class="cx"> 
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -66,6 +67,7 @@
</span><span class="cx">   ignoreCase    regExpProtoGetterIgnoreCase DontEnum|Accessor
</span><span class="cx">   multiline     regExpProtoGetterMultiline  DontEnum|Accessor
</span><span class="cx">   source        regExpProtoGetterSource     DontEnum|Accessor
</span><ins>+  flags         regExpProtoGetterFlags      DontEnum|Accessor
</ins><span class="cx"> @end
</span><span class="cx"> */
</span><span class="cx"> 
</span><span class="lines">@@ -135,6 +137,30 @@
</span><span class="cx">     return JSValue::encode(jsUndefined());
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+static inline String flagsString(ExecState *exec, JSObject* regexp)
+{
+    char flags[4] = { 0, 0, 0, 0 };
+    int index = 0;
+
+    JSValue globalValue = regexp-&gt;get(exec, exec-&gt;propertyNames().global);
+    if (exec-&gt;hadException())
+        return String();
+    JSValue ignoreCaseValue = regexp-&gt;get(exec, exec-&gt;propertyNames().ignoreCase);
+    if (exec-&gt;hadException())
+        return String();
+    JSValue multilineValue = regexp-&gt;get(exec, exec-&gt;propertyNames().multiline);
+    if (exec-&gt;hadException())
+        return String();
+
+    if (globalValue.toBoolean(exec))
+        flags[index++] = 'g';
+    if (ignoreCaseValue.toBoolean(exec))
+        flags[index++] = 'i';
+    if (multilineValue.toBoolean(exec))
+        flags[index] = 'm';
+    return String(flags);
+}
+
</ins><span class="cx"> EncodedJSValue JSC_HOST_CALL regExpProtoFuncToString(ExecState* exec)
</span><span class="cx"> {
</span><span class="cx">     JSValue thisValue = exec-&gt;thisValue();
</span><span class="lines">@@ -147,17 +173,19 @@
</span><span class="cx">     if (JSValue earlyReturnValue = checker.earlyReturnValue())
</span><span class="cx">         return JSValue::encode(earlyReturnValue);
</span><span class="cx"> 
</span><del>-    char postfix[5] = { '/', 0, 0, 0, 0 };
-    int index = 1;
-    if (thisObject-&gt;get(exec, exec-&gt;propertyNames().global).toBoolean(exec))
-        postfix[index++] = 'g';
-    if (thisObject-&gt;get(exec, exec-&gt;propertyNames().ignoreCase).toBoolean(exec))
-        postfix[index++] = 'i';
-    if (thisObject-&gt;get(exec, exec-&gt;propertyNames().multiline).toBoolean(exec))
-        postfix[index] = 'm';
-    String source = thisObject-&gt;get(exec, exec-&gt;propertyNames().source).toString(exec)-&gt;value(exec);
</del><ins>+    JSValue sourceValue = thisObject-&gt;get(exec, exec-&gt;propertyNames().source);
+    if (exec-&gt;hadException())
+        return JSValue::encode(jsUndefined());
+    String source = sourceValue.toString(exec)-&gt;value(exec);
+    if (exec-&gt;hadException())
+        return JSValue::encode(jsUndefined());
+
+    String flags = flagsString(exec, thisObject);
+    if (exec-&gt;hadException())
+        return JSValue::encode(jsUndefined());
+
</ins><span class="cx">     // If source is empty, use &quot;/(?:)/&quot; to avoid colliding with comment syntax
</span><del>-    return JSValue::encode(jsMakeNontrivialString(exec, &quot;/&quot;, source, postfix));
</del><ins>+    return JSValue::encode(jsMakeNontrivialString(exec, &quot;/&quot;, source, &quot;/&quot;, flags));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> EncodedJSValue JSC_HOST_CALL regExpProtoGetterGlobal(ExecState* exec)
</span><span class="lines">@@ -187,6 +215,21 @@
</span><span class="cx">     return JSValue::encode(jsBoolean(asRegExpObject(thisValue)-&gt;regExp()-&gt;multiline()));
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+EncodedJSValue JSC_HOST_CALL regExpProtoGetterFlags(ExecState* exec)
+{
+    JSValue thisValue = exec-&gt;thisValue();
+    if (!thisValue.isObject())
+        return JSValue::encode(throwTypeError(exec));
+
+    String flagsStr = flagsString(exec, asObject(thisValue));
+    if (exec-&gt;hadException())
+        return JSValue::encode(jsUndefined());
+
+    JSValue flags = jsMakeNontrivialString(exec, flagsStr);
+    return JSValue::encode(flags);
+}
+
+
</ins><span class="cx"> template &lt;typename CharacterType&gt;
</span><span class="cx"> static inline void appendLineTerminatorEscape(StringBuilder&amp;, CharacterType);
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoretestsstressstaticgetterinnamesjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/tests/stress/static-getter-in-names.js (185431 => 185432)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/tests/stress/static-getter-in-names.js        2015-06-10 21:53:42 UTC (rev 185431)
+++ trunk/Source/JavaScriptCore/tests/stress/static-getter-in-names.js        2015-06-10 22:32:36 UTC (rev 185432)
</span><span class="lines">@@ -3,5 +3,5 @@
</span><span class="cx">         throw new Error('bad value: ' + actual);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-shouldBe(JSON.stringify(Object.getOwnPropertyNames(RegExp.prototype).sort()), '[&quot;compile&quot;,&quot;constructor&quot;,&quot;exec&quot;,&quot;global&quot;,&quot;ignoreCase&quot;,&quot;lastIndex&quot;,&quot;multiline&quot;,&quot;source&quot;,&quot;test&quot;,&quot;toString&quot;]');
</del><ins>+shouldBe(JSON.stringify(Object.getOwnPropertyNames(RegExp.prototype).sort()), '[&quot;compile&quot;,&quot;constructor&quot;,&quot;exec&quot;,&quot;flags&quot;,&quot;global&quot;,&quot;ignoreCase&quot;,&quot;lastIndex&quot;,&quot;multiline&quot;,&quot;source&quot;,&quot;test&quot;,&quot;toString&quot;]');
</ins><span class="cx"> shouldBe(JSON.stringify(Object.getOwnPropertyNames(/Cocoa/).sort()), '[&quot;lastIndex&quot;]');
</span></span></pre>
</div>
</div>

</body>
</html>