<!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>[209031] trunk/Source/JavaScriptCore</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/209031">209031</a></dd>
<dt>Author</dt> <dd>mark.lam@apple.com</dd>
<dt>Date</dt> <dd>2016-11-28 15:30:59 -0800 (Mon, 28 Nov 2016)</dd>
</dl>
<h3>Log Message</h3>
<pre>Fix exception scope verification failures in runtime/JSGenericTypedArrayView* files.
https://bugs.webkit.org/show_bug.cgi?id=165022
Reviewed by Saam Barati.
* runtime/JSGenericTypedArrayViewConstructorInlines.h:
(JSC::constructGenericTypedArrayViewFromIterator):
(JSC::constructGenericTypedArrayViewWithArguments):
(JSC::constructGenericTypedArrayView):
* runtime/JSGenericTypedArrayViewInlines.h:
(JSC::JSGenericTypedArrayView<Adaptor>::set):
(JSC::JSGenericTypedArrayView<Adaptor>::defineOwnProperty):
* runtime/JSGenericTypedArrayViewPrototypeFunctions.h:
(JSC::speciesConstruct):
(JSC::genericTypedArrayViewProtoFuncSet):
(JSC::genericTypedArrayViewProtoFuncJoin):
(JSC::genericTypedArrayViewProtoFuncSlice):
(JSC::genericTypedArrayViewPrivateFuncSubarrayCreate):</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceJavaScriptCoreChangeLog">trunk/Source/JavaScriptCore/ChangeLog</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeJSGenericTypedArrayViewConstructorInlinesh">trunk/Source/JavaScriptCore/runtime/JSGenericTypedArrayViewConstructorInlines.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeJSGenericTypedArrayViewInlinesh">trunk/Source/JavaScriptCore/runtime/JSGenericTypedArrayViewInlines.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeJSGenericTypedArrayViewPrototypeFunctionsh">trunk/Source/JavaScriptCore/runtime/JSGenericTypedArrayViewPrototypeFunctions.h</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceJavaScriptCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ChangeLog (209030 => 209031)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ChangeLog        2016-11-28 23:23:40 UTC (rev 209030)
+++ trunk/Source/JavaScriptCore/ChangeLog        2016-11-28 23:30:59 UTC (rev 209031)
</span><span class="lines">@@ -1,5 +1,26 @@
</span><span class="cx"> 2016-11-28 Mark Lam <mark.lam@apple.com>
</span><span class="cx">
</span><ins>+ Fix exception scope verification failures in runtime/JSGenericTypedArrayView* files.
+ https://bugs.webkit.org/show_bug.cgi?id=165022
+
+ Reviewed by Saam Barati.
+
+ * runtime/JSGenericTypedArrayViewConstructorInlines.h:
+ (JSC::constructGenericTypedArrayViewFromIterator):
+ (JSC::constructGenericTypedArrayViewWithArguments):
+ (JSC::constructGenericTypedArrayView):
+ * runtime/JSGenericTypedArrayViewInlines.h:
+ (JSC::JSGenericTypedArrayView<Adaptor>::set):
+ (JSC::JSGenericTypedArrayView<Adaptor>::defineOwnProperty):
+ * runtime/JSGenericTypedArrayViewPrototypeFunctions.h:
+ (JSC::speciesConstruct):
+ (JSC::genericTypedArrayViewProtoFuncSet):
+ (JSC::genericTypedArrayViewProtoFuncJoin):
+ (JSC::genericTypedArrayViewProtoFuncSlice):
+ (JSC::genericTypedArrayViewPrivateFuncSubarrayCreate):
+
+2016-11-28 Mark Lam <mark.lam@apple.com>
+
</ins><span class="cx"> Fix exception scope verification failures in runtime/Operations.cpp/h.
</span><span class="cx"> https://bugs.webkit.org/show_bug.cgi?id=165046
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeJSGenericTypedArrayViewConstructorInlinesh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/JSGenericTypedArrayViewConstructorInlines.h (209030 => 209031)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/JSGenericTypedArrayViewConstructorInlines.h        2016-11-28 23:23:40 UTC (rev 209030)
+++ trunk/Source/JavaScriptCore/runtime/JSGenericTypedArrayViewConstructorInlines.h        2016-11-28 23:30:59 UTC (rev 209031)
</span><span class="lines">@@ -100,14 +100,15 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> ViewClass* result = ViewClass::createUninitialized(exec, structure, storage.size());
</span><del>- if (!result)
- RETURN_IF_EXCEPTION(scope, nullptr);
</del><ins>+ ASSERT(!!scope.exception() == !result);
+ if (UNLIKELY(!result))
+ return nullptr;
</ins><span class="cx">
</span><span class="cx"> for (unsigned i = 0; i < storage.size(); ++i) {
</span><del>- if (!result->setIndex(exec, i, storage.at(i))) {
- ASSERT(scope.exception());
</del><ins>+ bool success = result->setIndex(exec, i, storage.at(i));
+ ASSERT(scope.exception() || success);
+ if (!success)
</ins><span class="cx"> return nullptr;
</span><del>- }
</del><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> return result;
</span><span class="lines">@@ -133,6 +134,7 @@
</span><span class="cx"> length = (buffer->byteLength() - offset) / ViewClass::elementSize;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ scope.release();
</ins><span class="cx"> return ViewClass::create(exec, structure, buffer, offset, length);
</span><span class="cx"> }
</span><span class="cx"> ASSERT(!offset && !lengthOpt);
</span><span class="lines">@@ -154,6 +156,7 @@
</span><span class="cx"> // So we use VMInquiry. And purge the opaque object cases (proxy and namespace object) by isTaintedByOpaqueObject() guard.
</span><span class="cx"> PropertySlot lengthSlot(object, PropertySlot::InternalMethodType::VMInquiry);
</span><span class="cx"> object->getPropertySlot(exec, vm.propertyNames->length, lengthSlot);
</span><ins>+ RETURN_IF_EXCEPTION(scope, nullptr);
</ins><span class="cx">
</span><span class="cx"> JSValue iteratorFunc = object->get(exec, vm.propertyNames->iteratorSymbol);
</span><span class="cx"> RETURN_IF_EXCEPTION(scope, nullptr);
</span><span class="lines">@@ -178,6 +181,7 @@
</span><span class="cx"> JSValue iterator = call(exec, iteratorFunc, callType, callData, object, arguments);
</span><span class="cx"> RETURN_IF_EXCEPTION(scope, nullptr);
</span><span class="cx">
</span><ins>+ scope.release();
</ins><span class="cx"> return constructGenericTypedArrayViewFromIterator<ViewClass>(exec, structure, iterator);
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -187,11 +191,11 @@
</span><span class="cx">
</span><span class="cx">
</span><span class="cx"> ViewClass* result = ViewClass::createUninitialized(exec, structure, length);
</span><del>- if (!result) {
- ASSERT(scope.exception());
</del><ins>+ ASSERT(!!scope.exception() == !result);
+ if (UNLIKELY(!result))
</ins><span class="cx"> return nullptr;
</span><del>- }
</del><span class="cx">
</span><ins>+ scope.release();
</ins><span class="cx"> if (!result->set(exec, 0, object, 0, length))
</span><span class="cx"> return nullptr;
</span><span class="cx">
</span><span class="lines">@@ -203,6 +207,7 @@
</span><span class="cx">
</span><span class="cx"> unsigned length = firstValue.toIndex(exec, "length");
</span><span class="cx"> RETURN_IF_EXCEPTION(scope, nullptr);
</span><ins>+ scope.release();
</ins><span class="cx"> return ViewClass::create(exec, structure, length);
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -226,6 +231,7 @@
</span><span class="cx"> if (ViewClass::TypedArrayStorageType == TypeDataView)
</span><span class="cx"> return throwVMTypeError(exec, scope, ASCIILiteral("DataView constructor requires at least one argument."));
</span><span class="cx">
</span><ins>+ scope.release();
</ins><span class="cx"> return JSValue::encode(ViewClass::create(exec, structure, 0));
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -251,6 +257,7 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ scope.release();
</ins><span class="cx"> return JSValue::encode(constructGenericTypedArrayViewWithArguments<ViewClass>(exec, structure, JSValue::encode(firstValue), offset, length));
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeJSGenericTypedArrayViewInlinesh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/JSGenericTypedArrayViewInlines.h (209030 => 209031)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/JSGenericTypedArrayViewInlines.h        2016-11-28 23:23:40 UTC (rev 209030)
+++ trunk/Source/JavaScriptCore/runtime/JSGenericTypedArrayViewInlines.h        2016-11-28 23:30:59 UTC (rev 209031)
</span><span class="lines">@@ -263,30 +263,39 @@
</span><span class="cx">
</span><span class="cx"> switch (ci->typedArrayStorageType) {
</span><span class="cx"> case TypeInt8:
</span><ins>+ scope.release();
</ins><span class="cx"> return setWithSpecificType<Int8Adaptor>(
</span><span class="cx"> exec, offset, jsCast<JSInt8Array*>(object), objectOffset, length, type);
</span><span class="cx"> case TypeInt16:
</span><ins>+ scope.release();
</ins><span class="cx"> return setWithSpecificType<Int16Adaptor>(
</span><span class="cx"> exec, offset, jsCast<JSInt16Array*>(object), objectOffset, length, type);
</span><span class="cx"> case TypeInt32:
</span><ins>+ scope.release();
</ins><span class="cx"> return setWithSpecificType<Int32Adaptor>(
</span><span class="cx"> exec, offset, jsCast<JSInt32Array*>(object), objectOffset, length, type);
</span><span class="cx"> case TypeUint8:
</span><ins>+ scope.release();
</ins><span class="cx"> return setWithSpecificType<Uint8Adaptor>(
</span><span class="cx"> exec, offset, jsCast<JSUint8Array*>(object), objectOffset, length, type);
</span><span class="cx"> case TypeUint8Clamped:
</span><ins>+ scope.release();
</ins><span class="cx"> return setWithSpecificType<Uint8ClampedAdaptor>(
</span><span class="cx"> exec, offset, jsCast<JSUint8ClampedArray*>(object), objectOffset, length, type);
</span><span class="cx"> case TypeUint16:
</span><ins>+ scope.release();
</ins><span class="cx"> return setWithSpecificType<Uint16Adaptor>(
</span><span class="cx"> exec, offset, jsCast<JSUint16Array*>(object), objectOffset, length, type);
</span><span class="cx"> case TypeUint32:
</span><ins>+ scope.release();
</ins><span class="cx"> return setWithSpecificType<Uint32Adaptor>(
</span><span class="cx"> exec, offset, jsCast<JSUint32Array*>(object), objectOffset, length, type);
</span><span class="cx"> case TypeFloat32:
</span><ins>+ scope.release();
</ins><span class="cx"> return setWithSpecificType<Float32Adaptor>(
</span><span class="cx"> exec, offset, jsCast<JSFloat32Array*>(object), objectOffset, length, type);
</span><span class="cx"> case TypeFloat64:
</span><ins>+ scope.release();
</ins><span class="cx"> return setWithSpecificType<Float64Adaptor>(
</span><span class="cx"> exec, offset, jsCast<JSFloat64Array*>(object), objectOffset, length, type);
</span><span class="cx"> case NotTypedArray:
</span><span class="lines">@@ -398,11 +407,13 @@
</span><span class="cx">
</span><span class="cx"> if (descriptor.value()) {
</span><span class="cx"> PutPropertySlot unused(JSValue(thisObject), shouldThrow);
</span><ins>+ scope.release();
</ins><span class="cx"> return thisObject->put(thisObject, exec, propertyName, descriptor.value(), unused);
</span><span class="cx"> }
</span><span class="cx"> return true;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ scope.release();
</ins><span class="cx"> return Base::defineOwnProperty(thisObject, exec, propertyName, descriptor, shouldThrow);
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeJSGenericTypedArrayViewPrototypeFunctionsh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/JSGenericTypedArrayViewPrototypeFunctions.h (209030 => 209031)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/JSGenericTypedArrayViewPrototypeFunctions.h        2016-11-28 23:23:40 UTC (rev 209030)
+++ trunk/Source/JavaScriptCore/runtime/JSGenericTypedArrayViewPrototypeFunctions.h        2016-11-28 23:30:59 UTC (rev 209031)
</span><span class="lines">@@ -53,8 +53,10 @@
</span><span class="cx"> JSValue constructor = exemplar->get(exec, vm.propertyNames->constructor);
</span><span class="cx"> RETURN_IF_EXCEPTION(scope, nullptr);
</span><span class="cx">
</span><del>- if (constructor.isUndefined())
</del><ins>+ if (constructor.isUndefined()) {
+ scope.release();
</ins><span class="cx"> return defaultConstructor();
</span><ins>+ }
</ins><span class="cx"> if (!constructor.isObject()) {
</span><span class="cx"> throwTypeError(exec, scope, ASCIILiteral("constructor Property should not be null"));
</span><span class="cx"> return nullptr;
</span><span class="lines">@@ -63,8 +65,10 @@
</span><span class="cx"> JSValue species = constructor.get(exec, vm.propertyNames->speciesSymbol);
</span><span class="cx"> RETURN_IF_EXCEPTION(scope, nullptr);
</span><span class="cx">
</span><del>- if (species.isUndefinedOrNull())
</del><ins>+ if (species.isUndefinedOrNull()) {
+ scope.release();
</ins><span class="cx"> return defaultConstructor();
</span><ins>+ }
</ins><span class="cx">
</span><span class="cx"> JSValue result = construct(exec, species, args, "species is not a constructor");
</span><span class="cx"> RETURN_IF_EXCEPTION(scope, nullptr);
</span><span class="lines">@@ -135,6 +139,7 @@
</span><span class="cx">
</span><span class="cx"> RETURN_IF_EXCEPTION(scope, encodedJSValue());
</span><span class="cx">
</span><ins>+ scope.release();
</ins><span class="cx"> thisObject->set(exec, offset, sourceArray, 0, length, CopyType::Unobservable);
</span><span class="cx"> return JSValue::encode(jsUndefined());
</span><span class="cx"> }
</span><span class="lines">@@ -273,6 +278,7 @@
</span><span class="cx"> joiner.append(*exec, thisObject->getIndexQuickly(i));
</span><span class="cx"> RETURN_IF_EXCEPTION(scope, encodedJSValue());
</span><span class="cx"> }
</span><ins>+ scope.release();
</ins><span class="cx"> return JSValue::encode(joiner.join(*exec));
</span><span class="cx"> };
</span><span class="cx">
</span><span class="lines">@@ -461,37 +467,44 @@
</span><span class="cx"> length = std::min(length, result->length());
</span><span class="cx"> switch (result->classInfo()->typedArrayStorageType) {
</span><span class="cx"> case TypeInt8:
</span><ins>+ scope.release();
</ins><span class="cx"> jsCast<JSInt8Array*>(result)->set(exec, 0, thisObject, begin, length, CopyType::LeftToRight);
</span><del>- break;
</del><ins>+ return JSValue::encode(result);
</ins><span class="cx"> case TypeInt16:
</span><ins>+ scope.release();
</ins><span class="cx"> jsCast<JSInt16Array*>(result)->set(exec, 0, thisObject, begin, length, CopyType::LeftToRight);
</span><del>- break;
</del><ins>+ return JSValue::encode(result);
</ins><span class="cx"> case TypeInt32:
</span><ins>+ scope.release();
</ins><span class="cx"> jsCast<JSInt32Array*>(result)->set(exec, 0, thisObject, begin, length, CopyType::LeftToRight);
</span><del>- break;
</del><ins>+ return JSValue::encode(result);
</ins><span class="cx"> case TypeUint8:
</span><ins>+ scope.release();
</ins><span class="cx"> jsCast<JSUint8Array*>(result)->set(exec, 0, thisObject, begin, length, CopyType::LeftToRight);
</span><del>- break;
</del><ins>+ return JSValue::encode(result);
</ins><span class="cx"> case TypeUint8Clamped:
</span><ins>+ scope.release();
</ins><span class="cx"> jsCast<JSUint8ClampedArray*>(result)->set(exec, 0, thisObject, begin, length, CopyType::LeftToRight);
</span><del>- break;
</del><ins>+ return JSValue::encode(result);
</ins><span class="cx"> case TypeUint16:
</span><ins>+ scope.release();
</ins><span class="cx"> jsCast<JSUint16Array*>(result)->set(exec, 0, thisObject, begin, length, CopyType::LeftToRight);
</span><del>- break;
</del><ins>+ return JSValue::encode(result);
</ins><span class="cx"> case TypeUint32:
</span><ins>+ scope.release();
</ins><span class="cx"> jsCast<JSUint32Array*>(result)->set(exec, 0, thisObject, begin, length, CopyType::LeftToRight);
</span><del>- break;
</del><ins>+ return JSValue::encode(result);
</ins><span class="cx"> case TypeFloat32:
</span><ins>+ scope.release();
</ins><span class="cx"> jsCast<JSFloat32Array*>(result)->set(exec, 0, thisObject, begin, length, CopyType::LeftToRight);
</span><del>- break;
</del><ins>+ return JSValue::encode(result);
</ins><span class="cx"> case TypeFloat64:
</span><ins>+ scope.release();
</ins><span class="cx"> jsCast<JSFloat64Array*>(result)->set(exec, 0, thisObject, begin, length, CopyType::LeftToRight);
</span><del>- break;
</del><ins>+ return JSValue::encode(result);
</ins><span class="cx"> default:
</span><span class="cx"> RELEASE_ASSERT_NOT_REACHED();
</span><span class="cx"> }
</span><del>-
- return JSValue::encode(result);
</del><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> template<typename ViewClass>
</span><span class="lines">@@ -538,6 +551,7 @@
</span><span class="cx"> if (species == defaultConstructor) {
</span><span class="cx"> Structure* structure = callee->globalObject()->typedArrayStructure(ViewClass::TypedArrayStorageType);
</span><span class="cx">
</span><ins>+ scope.release();
</ins><span class="cx"> return JSValue::encode(ViewClass::create(
</span><span class="cx"> exec, structure, arrayBuffer,
</span><span class="cx"> thisObject->byteOffset() + offset * ViewClass::elementSize,
</span></span></pre>
</div>
</div>
</body>
</html>