Changeset 209031 in webkit
- Timestamp:
- Nov 28, 2016 3:30:59 PM (7 years ago)
- Location:
- trunk/Source/JavaScriptCore
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r209030 r209031 1 2016-11-28 Mark Lam <mark.lam@apple.com> 2 3 Fix exception scope verification failures in runtime/JSGenericTypedArrayView* files. 4 https://bugs.webkit.org/show_bug.cgi?id=165022 5 6 Reviewed by Saam Barati. 7 8 * runtime/JSGenericTypedArrayViewConstructorInlines.h: 9 (JSC::constructGenericTypedArrayViewFromIterator): 10 (JSC::constructGenericTypedArrayViewWithArguments): 11 (JSC::constructGenericTypedArrayView): 12 * runtime/JSGenericTypedArrayViewInlines.h: 13 (JSC::JSGenericTypedArrayView<Adaptor>::set): 14 (JSC::JSGenericTypedArrayView<Adaptor>::defineOwnProperty): 15 * runtime/JSGenericTypedArrayViewPrototypeFunctions.h: 16 (JSC::speciesConstruct): 17 (JSC::genericTypedArrayViewProtoFuncSet): 18 (JSC::genericTypedArrayViewProtoFuncJoin): 19 (JSC::genericTypedArrayViewProtoFuncSlice): 20 (JSC::genericTypedArrayViewPrivateFuncSubarrayCreate): 21 1 22 2016-11-28 Mark Lam <mark.lam@apple.com> 2 23 -
trunk/Source/JavaScriptCore/runtime/JSGenericTypedArrayViewConstructorInlines.h
r208985 r209031 101 101 102 102 ViewClass* result = ViewClass::createUninitialized(exec, structure, storage.size()); 103 if (!result) 104 RETURN_IF_EXCEPTION(scope, nullptr); 103 ASSERT(!!scope.exception() == !result); 104 if (UNLIKELY(!result)) 105 return nullptr; 105 106 106 107 for (unsigned i = 0; i < storage.size(); ++i) { 107 if (!result->setIndex(exec, i, storage.at(i))) { 108 ASSERT(scope.exception()); 108 bool success = result->setIndex(exec, i, storage.at(i)); 109 ASSERT(scope.exception() || success); 110 if (!success) 109 111 return nullptr; 110 }111 112 } 112 113 … … 134 135 } 135 136 137 scope.release(); 136 138 return ViewClass::create(exec, structure, buffer, offset, length); 137 139 } … … 155 157 PropertySlot lengthSlot(object, PropertySlot::InternalMethodType::VMInquiry); 156 158 object->getPropertySlot(exec, vm.propertyNames->length, lengthSlot); 159 RETURN_IF_EXCEPTION(scope, nullptr); 157 160 158 161 JSValue iteratorFunc = object->get(exec, vm.propertyNames->iteratorSymbol); … … 179 182 RETURN_IF_EXCEPTION(scope, nullptr); 180 183 184 scope.release(); 181 185 return constructGenericTypedArrayViewFromIterator<ViewClass>(exec, structure, iterator); 182 186 } … … 188 192 189 193 ViewClass* result = ViewClass::createUninitialized(exec, structure, length); 190 if (!result) {191 ASSERT(scope.exception());194 ASSERT(!!scope.exception() == !result); 195 if (UNLIKELY(!result)) 192 196 return nullptr; 193 }194 197 198 scope.release(); 195 199 if (!result->set(exec, 0, object, 0, length)) 196 200 return nullptr; … … 204 208 unsigned length = firstValue.toIndex(exec, "length"); 205 209 RETURN_IF_EXCEPTION(scope, nullptr); 210 scope.release(); 206 211 return ViewClass::create(exec, structure, length); 207 212 } … … 227 232 return throwVMTypeError(exec, scope, ASCIILiteral("DataView constructor requires at least one argument.")); 228 233 234 scope.release(); 229 235 return JSValue::encode(ViewClass::create(exec, structure, 0)); 230 236 } … … 252 258 } 253 259 260 scope.release(); 254 261 return JSValue::encode(constructGenericTypedArrayViewWithArguments<ViewClass>(exec, structure, JSValue::encode(firstValue), offset, length)); 255 262 } -
trunk/Source/JavaScriptCore/runtime/JSGenericTypedArrayViewInlines.h
r208985 r209031 264 264 switch (ci->typedArrayStorageType) { 265 265 case TypeInt8: 266 scope.release(); 266 267 return setWithSpecificType<Int8Adaptor>( 267 268 exec, offset, jsCast<JSInt8Array*>(object), objectOffset, length, type); 268 269 case TypeInt16: 270 scope.release(); 269 271 return setWithSpecificType<Int16Adaptor>( 270 272 exec, offset, jsCast<JSInt16Array*>(object), objectOffset, length, type); 271 273 case TypeInt32: 274 scope.release(); 272 275 return setWithSpecificType<Int32Adaptor>( 273 276 exec, offset, jsCast<JSInt32Array*>(object), objectOffset, length, type); 274 277 case TypeUint8: 278 scope.release(); 275 279 return setWithSpecificType<Uint8Adaptor>( 276 280 exec, offset, jsCast<JSUint8Array*>(object), objectOffset, length, type); 277 281 case TypeUint8Clamped: 282 scope.release(); 278 283 return setWithSpecificType<Uint8ClampedAdaptor>( 279 284 exec, offset, jsCast<JSUint8ClampedArray*>(object), objectOffset, length, type); 280 285 case TypeUint16: 286 scope.release(); 281 287 return setWithSpecificType<Uint16Adaptor>( 282 288 exec, offset, jsCast<JSUint16Array*>(object), objectOffset, length, type); 283 289 case TypeUint32: 290 scope.release(); 284 291 return setWithSpecificType<Uint32Adaptor>( 285 292 exec, offset, jsCast<JSUint32Array*>(object), objectOffset, length, type); 286 293 case TypeFloat32: 294 scope.release(); 287 295 return setWithSpecificType<Float32Adaptor>( 288 296 exec, offset, jsCast<JSFloat32Array*>(object), objectOffset, length, type); 289 297 case TypeFloat64: 298 scope.release(); 290 299 return setWithSpecificType<Float64Adaptor>( 291 300 exec, offset, jsCast<JSFloat64Array*>(object), objectOffset, length, type); … … 399 408 if (descriptor.value()) { 400 409 PutPropertySlot unused(JSValue(thisObject), shouldThrow); 410 scope.release(); 401 411 return thisObject->put(thisObject, exec, propertyName, descriptor.value(), unused); 402 412 } … … 404 414 } 405 415 416 scope.release(); 406 417 return Base::defineOwnProperty(thisObject, exec, propertyName, descriptor, shouldThrow); 407 418 } -
trunk/Source/JavaScriptCore/runtime/JSGenericTypedArrayViewPrototypeFunctions.h
r208767 r209031 54 54 RETURN_IF_EXCEPTION(scope, nullptr); 55 55 56 if (constructor.isUndefined()) 56 if (constructor.isUndefined()) { 57 scope.release(); 57 58 return defaultConstructor(); 59 } 58 60 if (!constructor.isObject()) { 59 61 throwTypeError(exec, scope, ASCIILiteral("constructor Property should not be null")); … … 64 66 RETURN_IF_EXCEPTION(scope, nullptr); 65 67 66 if (species.isUndefinedOrNull()) 68 if (species.isUndefinedOrNull()) { 69 scope.release(); 67 70 return defaultConstructor(); 71 } 68 72 69 73 JSValue result = construct(exec, species, args, "species is not a constructor"); … … 136 140 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 137 141 142 scope.release(); 138 143 thisObject->set(exec, offset, sourceArray, 0, length, CopyType::Unobservable); 139 144 return JSValue::encode(jsUndefined()); … … 274 279 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 275 280 } 281 scope.release(); 276 282 return JSValue::encode(joiner.join(*exec)); 277 283 }; … … 462 468 switch (result->classInfo()->typedArrayStorageType) { 463 469 case TypeInt8: 470 scope.release(); 464 471 jsCast<JSInt8Array*>(result)->set(exec, 0, thisObject, begin, length, CopyType::LeftToRight); 465 break;472 return JSValue::encode(result); 466 473 case TypeInt16: 474 scope.release(); 467 475 jsCast<JSInt16Array*>(result)->set(exec, 0, thisObject, begin, length, CopyType::LeftToRight); 468 break;476 return JSValue::encode(result); 469 477 case TypeInt32: 478 scope.release(); 470 479 jsCast<JSInt32Array*>(result)->set(exec, 0, thisObject, begin, length, CopyType::LeftToRight); 471 break;480 return JSValue::encode(result); 472 481 case TypeUint8: 482 scope.release(); 473 483 jsCast<JSUint8Array*>(result)->set(exec, 0, thisObject, begin, length, CopyType::LeftToRight); 474 break;484 return JSValue::encode(result); 475 485 case TypeUint8Clamped: 486 scope.release(); 476 487 jsCast<JSUint8ClampedArray*>(result)->set(exec, 0, thisObject, begin, length, CopyType::LeftToRight); 477 break;488 return JSValue::encode(result); 478 489 case TypeUint16: 490 scope.release(); 479 491 jsCast<JSUint16Array*>(result)->set(exec, 0, thisObject, begin, length, CopyType::LeftToRight); 480 break;492 return JSValue::encode(result); 481 493 case TypeUint32: 494 scope.release(); 482 495 jsCast<JSUint32Array*>(result)->set(exec, 0, thisObject, begin, length, CopyType::LeftToRight); 483 break;496 return JSValue::encode(result); 484 497 case TypeFloat32: 498 scope.release(); 485 499 jsCast<JSFloat32Array*>(result)->set(exec, 0, thisObject, begin, length, CopyType::LeftToRight); 486 break;500 return JSValue::encode(result); 487 501 case TypeFloat64: 502 scope.release(); 488 503 jsCast<JSFloat64Array*>(result)->set(exec, 0, thisObject, begin, length, CopyType::LeftToRight); 489 break;504 return JSValue::encode(result); 490 505 default: 491 506 RELEASE_ASSERT_NOT_REACHED(); 492 507 } 493 494 return JSValue::encode(result);495 508 } 496 509 … … 539 552 Structure* structure = callee->globalObject()->typedArrayStructure(ViewClass::TypedArrayStorageType); 540 553 554 scope.release(); 541 555 return JSValue::encode(ViewClass::create( 542 556 exec, structure, arrayBuffer,
Note: See TracChangeset
for help on using the changeset viewer.