Changeset 201787 in webkit
- Timestamp:
- Jun 7, 2016, 7:53:32 PM (9 years ago)
- Location:
- trunk/Source
- Files:
-
- 1 added
- 22 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified trunk/Source/JavaScriptCore/ChangeLog ¶
r201783 r201787 1 2016-06-07 Mark Lam <mark.lam@apple.com> 2 3 Need an exception check after constructEmptyArray(). 4 https://bugs.webkit.org/show_bug.cgi?id=158411 5 6 Reviewed by Saam Barati. 7 8 Added an exception check after each call to constructEmptyArray(). 9 10 * inspector/JSInjectedScriptHost.cpp: 11 (Inspector::JSInjectedScriptHost::getInternalProperties): 12 (Inspector::JSInjectedScriptHost::weakMapEntries): 13 (Inspector::JSInjectedScriptHost::weakSetEntries): 14 (Inspector::JSInjectedScriptHost::iteratorEntries): 15 * interpreter/ShadowChicken.cpp: 16 (JSC::ShadowChicken::functionsOnStack): 17 * profiler/ProfilerBytecodeSequence.cpp: 18 (JSC::Profiler::BytecodeSequence::addSequenceProperties): 19 * profiler/ProfilerCompilation.cpp: 20 (JSC::Profiler::Compilation::toJS): 21 * profiler/ProfilerDatabase.cpp: 22 (JSC::Profiler::Database::toJS): 23 * profiler/ProfilerOSRExitSite.cpp: 24 (JSC::Profiler::OSRExitSite::toJS): 25 * profiler/ProfilerOriginStack.cpp: 26 (JSC::Profiler::OriginStack::toJS): 27 * runtime/ArrayPrototype.cpp: 28 (JSC::arrayProtoFuncConcat): 29 (JSC::arrayProtoFuncSlice): 30 (JSC::arrayProtoFuncSplice): 31 * runtime/LiteralParser.cpp: 32 (JSC::LiteralParser<CharType>::parse): 33 * runtime/ModuleLoaderObject.cpp: 34 (JSC::moduleLoaderObjectRequestedModules): 35 * runtime/ObjectConstructor.cpp: 36 (JSC::ownPropertyKeys): 37 * runtime/RegExpObject.cpp: 38 (JSC::collectMatches): 39 * runtime/RegExpPrototype.cpp: 40 (JSC::regExpProtoFuncSplitFast): 41 * runtime/StringPrototype.cpp: 42 (JSC::stringProtoFuncSplitFast): 43 * runtime/TemplateRegistry.cpp: 44 (JSC::TemplateRegistry::getTemplateObject): 45 46 * tests/stress/regress-158411.js: Added. 47 1 48 2016-06-07 Filip Pizlo <fpizlo@apple.com> 2 49 -
TabularUnified trunk/Source/JavaScriptCore/inspector/JSInjectedScriptHost.cpp ¶
r201766 r201787 258 258 return jsUndefined(); 259 259 260 VM& vm = exec->vm(); 260 261 JSValue value = exec->uncheckedArgument(0); 261 262 … … 263 264 unsigned index = 0; 264 265 JSArray* array = constructEmptyArray(exec, nullptr); 266 if (UNLIKELY(vm.exception())) 267 return jsUndefined(); 265 268 switch (promise->status(exec->vm())) { 266 269 case JSPromise::Status::Pending: … … 283 286 unsigned index = 0; 284 287 JSArray* array = constructEmptyArray(exec, nullptr); 288 if (UNLIKELY(vm.exception())) 289 return jsUndefined(); 285 290 array->putDirectIndex(exec, index++, constructInternalProperty(exec, "targetFunction", boundFunction->targetFunction())); 286 291 array->putDirectIndex(exec, index++, constructInternalProperty(exec, "boundThis", boundFunction->boundThis())); … … 293 298 unsigned index = 0; 294 299 JSArray* array = constructEmptyArray(exec, nullptr, 2); 300 if (UNLIKELY(vm.exception())) 301 return jsUndefined(); 295 302 array->putDirectIndex(exec, index++, constructInternalProperty(exec, ASCIILiteral("target"), proxy->target())); 296 303 array->putDirectIndex(exec, index++, constructInternalProperty(exec, ASCIILiteral("handler"), proxy->handler())); … … 305 312 unsigned index = 0; 306 313 JSArray* array = constructEmptyArray(exec, nullptr, 2); 314 if (UNLIKELY(vm.exception())) 315 return jsUndefined(); 307 316 array->putDirectIndex(exec, index++, constructInternalProperty(exec, "array", iteratedValue)); 308 317 array->putDirectIndex(exec, index++, constructInternalProperty(exec, "kind", kind)); … … 326 335 unsigned index = 0; 327 336 JSArray* array = constructEmptyArray(exec, nullptr, 2); 337 if (UNLIKELY(vm.exception())) 338 return jsUndefined(); 328 339 array->putDirectIndex(exec, index++, constructInternalProperty(exec, "array", arrayIterator->iteratedValue(exec))); 329 340 array->putDirectIndex(exec, index++, constructInternalProperty(exec, "kind", jsNontrivialString(exec, kind))); … … 346 357 unsigned index = 0; 347 358 JSArray* array = constructEmptyArray(exec, nullptr, 2); 359 if (UNLIKELY(vm.exception())) 360 return jsUndefined(); 348 361 array->putDirectIndex(exec, index++, constructInternalProperty(exec, "map", mapIterator->iteratedValue())); 349 362 array->putDirectIndex(exec, index++, constructInternalProperty(exec, "kind", jsNontrivialString(exec, kind))); … … 366 379 unsigned index = 0; 367 380 JSArray* array = constructEmptyArray(exec, nullptr, 2); 381 if (UNLIKELY(vm.exception())) 382 return jsUndefined(); 368 383 array->putDirectIndex(exec, index++, constructInternalProperty(exec, "set", setIterator->iteratedValue())); 369 384 array->putDirectIndex(exec, index++, constructInternalProperty(exec, "kind", jsNontrivialString(exec, kind))); … … 374 389 unsigned index = 0; 375 390 JSArray* array = constructEmptyArray(exec, nullptr, 1); 391 if (UNLIKELY(vm.exception())) 392 return jsUndefined(); 376 393 array->putDirectIndex(exec, index++, constructInternalProperty(exec, "string", stringIterator->iteratedValue(exec))); 377 394 return array; … … 381 398 unsigned index = 0; 382 399 JSArray* array = constructEmptyArray(exec, nullptr, 1); 400 if (UNLIKELY(vm.exception())) 401 return jsUndefined(); 383 402 array->putDirectIndex(exec, index++, constructInternalProperty(exec, "object", propertyNameIterator->iteratedValue())); 384 403 return array; … … 406 425 return jsUndefined(); 407 426 427 VM& vm = exec->vm(); 408 428 JSValue value = exec->uncheckedArgument(0); 409 429 JSWeakMap* weakMap = jsDynamicCast<JSWeakMap*>(value); … … 420 440 421 441 JSArray* array = constructEmptyArray(exec, nullptr); 442 if (UNLIKELY(vm.exception())) 443 return jsUndefined(); 422 444 for (auto it = weakMap->weakMapData()->begin(); it != weakMap->weakMapData()->end(); ++it) { 423 445 JSObject* entry = constructEmptyObject(exec); … … 450 472 return jsUndefined(); 451 473 474 VM& vm = exec->vm(); 452 475 JSValue value = exec->uncheckedArgument(0); 453 476 JSWeakSet* weakSet = jsDynamicCast<JSWeakSet*>(value); … … 464 487 465 488 JSArray* array = constructEmptyArray(exec, nullptr); 489 if (UNLIKELY(vm.exception())) 490 return jsUndefined(); 466 491 for (auto it = weakSet->weakMapData()->begin(); it != weakSet->weakMapData()->end(); ++it) { 467 492 JSObject* entry = constructEmptyObject(exec); … … 502 527 else if (JSPropertyNameIterator* propertyNameIterator = jsDynamicCast<JSPropertyNameIterator*>(value)) { 503 528 iterator = propertyNameIterator->clone(exec); 504 if (UNLIKELY( exec->hadException()))529 if (UNLIKELY(vm.exception())) 505 530 return JSValue(); 506 531 } else { … … 522 547 523 548 JSArray* array = constructEmptyArray(exec, nullptr); 549 if (UNLIKELY(vm.exception())) 550 return jsUndefined(); 524 551 525 552 for (unsigned i = 0; i < numberToFetch; ++i) { 526 553 JSValue next = iteratorStep(exec, iterator); 527 if ( exec->hadException())554 if (UNLIKELY(vm.exception())) 528 555 break; 529 556 if (next.isFalse()) … … 531 558 532 559 JSValue nextValue = iteratorValue(exec, next); 533 if ( exec->hadException())560 if (UNLIKELY(vm.exception())) 534 561 break; 535 562 -
TabularUnified trunk/Source/JavaScriptCore/interpreter/ShadowChicken.cpp ¶
r201465 r201787 436 436 JSArray* ShadowChicken::functionsOnStack(ExecState* exec) 437 437 { 438 VM& vm = exec->vm(); 438 439 JSArray* result = constructEmptyArray(exec, 0); 440 if (UNLIKELY(vm.exception())) 441 return nullptr; 439 442 440 443 iterate( 441 exec->vm(), exec,444 vm, exec, 442 445 [&] (const Frame& frame) -> bool { 443 446 result->push(exec, frame.callee); -
TabularUnified trunk/Source/JavaScriptCore/profiler/ProfilerBytecodeSequence.cpp ¶
r179503 r201787 78 78 void BytecodeSequence::addSequenceProperties(ExecState* exec, JSObject* result) const 79 79 { 80 VM& vm = exec->vm(); 80 81 JSArray* header = constructEmptyArray(exec, 0); 82 if (UNLIKELY(vm.exception())) 83 return; 81 84 for (unsigned i = 0; i < m_header.size(); ++i) 82 85 header->putDirectIndex(exec, i, jsString(exec, String::fromUTF8(m_header[i]))); 83 result->putDirect( exec->vm(), exec->propertyNames().header, header);86 result->putDirect(vm, exec->propertyNames().header, header); 84 87 85 88 JSArray* sequence = constructEmptyArray(exec, 0); 89 if (UNLIKELY(vm.exception())) 90 return; 86 91 for (unsigned i = 0; i < m_sequence.size(); ++i) 87 92 sequence->putDirectIndex(exec, i, m_sequence[i].toJS(exec)); 88 result->putDirect( exec->vm(), exec->propertyNames().bytecode, sequence);93 result->putDirect(vm, exec->propertyNames().bytecode, sequence); 89 94 } 90 95 -
TabularUnified trunk/Source/JavaScriptCore/profiler/ProfilerCompilation.cpp ¶
r200658 r201787 115 115 JSValue Compilation::toJS(ExecState* exec) const 116 116 { 117 VM& vm = exec->vm(); 117 118 JSObject* result = constructEmptyObject(exec); 118 119 result->putDirect(exec->vm(), exec->propertyNames().bytecodesID, jsNumber(m_bytecodes->id())); 120 result->putDirect(exec->vm(), exec->propertyNames().compilationKind, jsString(exec, String::fromUTF8(toCString(m_kind)))); 119 if (UNLIKELY(vm.exception())) 120 return jsUndefined(); 121 result->putDirect(vm, exec->propertyNames().bytecodesID, jsNumber(m_bytecodes->id())); 122 result->putDirect(vm, exec->propertyNames().compilationKind, jsString(exec, String::fromUTF8(toCString(m_kind)))); 121 123 122 124 JSArray* profiledBytecodes = constructEmptyArray(exec, 0); 125 if (UNLIKELY(vm.exception())) 126 return jsUndefined(); 123 127 for (unsigned i = 0; i < m_profiledBytecodes.size(); ++i) 124 128 profiledBytecodes->putDirectIndex(exec, i, m_profiledBytecodes[i].toJS(exec)); 125 result->putDirect( exec->vm(), exec->propertyNames().profiledBytecodes, profiledBytecodes);129 result->putDirect(vm, exec->propertyNames().profiledBytecodes, profiledBytecodes); 126 130 127 131 JSArray* descriptions = constructEmptyArray(exec, 0); 132 if (UNLIKELY(vm.exception())) 133 return jsUndefined(); 128 134 for (unsigned i = 0; i < m_descriptions.size(); ++i) 129 135 descriptions->putDirectIndex(exec, i, m_descriptions[i].toJS(exec)); 130 result->putDirect( exec->vm(), exec->propertyNames().descriptions, descriptions);136 result->putDirect(vm, exec->propertyNames().descriptions, descriptions); 131 137 132 138 JSArray* counters = constructEmptyArray(exec, 0); 139 if (UNLIKELY(vm.exception())) 140 return jsUndefined(); 133 141 for (auto it = m_counters.begin(), end = m_counters.end(); it != end; ++it) { 134 142 JSObject* counterEntry = constructEmptyObject(exec); 135 counterEntry->putDirect( exec->vm(), exec->propertyNames().origin, it->key.toJS(exec));136 counterEntry->putDirect( exec->vm(), exec->propertyNames().executionCount, jsNumber(it->value->count()));143 counterEntry->putDirect(vm, exec->propertyNames().origin, it->key.toJS(exec)); 144 counterEntry->putDirect(vm, exec->propertyNames().executionCount, jsNumber(it->value->count())); 137 145 counters->push(exec, counterEntry); 138 146 } 139 result->putDirect( exec->vm(), exec->propertyNames().counters, counters);147 result->putDirect(vm, exec->propertyNames().counters, counters); 140 148 141 149 JSArray* exitSites = constructEmptyArray(exec, 0); 150 if (UNLIKELY(vm.exception())) 151 return jsUndefined(); 142 152 for (unsigned i = 0; i < m_osrExitSites.size(); ++i) 143 153 exitSites->putDirectIndex(exec, i, m_osrExitSites[i].toJS(exec)); 144 result->putDirect( exec->vm(), exec->propertyNames().osrExitSites, exitSites);154 result->putDirect(vm, exec->propertyNames().osrExitSites, exitSites); 145 155 146 156 JSArray* exits = constructEmptyArray(exec, 0); 157 if (UNLIKELY(vm.exception())) 158 return jsUndefined(); 147 159 for (unsigned i = 0; i < m_osrExits.size(); ++i) 148 160 exits->putDirectIndex(exec, i, m_osrExits[i].toJS(exec)); 149 result->putDirect( exec->vm(), exec->propertyNames().osrExits, exits);161 result->putDirect(vm, exec->propertyNames().osrExits, exits); 150 162 151 result->putDirect( exec->vm(), exec->propertyNames().numInlinedGetByIds, jsNumber(m_numInlinedGetByIds));152 result->putDirect( exec->vm(), exec->propertyNames().numInlinedPutByIds, jsNumber(m_numInlinedPutByIds));153 result->putDirect( exec->vm(), exec->propertyNames().numInlinedCalls, jsNumber(m_numInlinedCalls));154 result->putDirect( exec->vm(), exec->propertyNames().jettisonReason, jsString(exec, String::fromUTF8(toCString(m_jettisonReason))));163 result->putDirect(vm, exec->propertyNames().numInlinedGetByIds, jsNumber(m_numInlinedGetByIds)); 164 result->putDirect(vm, exec->propertyNames().numInlinedPutByIds, jsNumber(m_numInlinedPutByIds)); 165 result->putDirect(vm, exec->propertyNames().numInlinedCalls, jsNumber(m_numInlinedCalls)); 166 result->putDirect(vm, exec->propertyNames().jettisonReason, jsString(exec, String::fromUTF8(toCString(m_jettisonReason)))); 155 167 if (!m_additionalJettisonReason.isNull()) 156 result->putDirect( exec->vm(), exec->propertyNames().additionalJettisonReason, jsString(exec, String::fromUTF8(m_additionalJettisonReason)));168 result->putDirect(vm, exec->propertyNames().additionalJettisonReason, jsString(exec, String::fromUTF8(m_additionalJettisonReason))); 157 169 158 result->putDirect( exec->vm(), exec->propertyNames().uid, m_uid.toJS(exec));170 result->putDirect(vm, exec->propertyNames().uid, m_uid.toJS(exec)); 159 171 160 172 return result; -
TabularUnified trunk/Source/JavaScriptCore/profiler/ProfilerDatabase.cpp ¶
r201361 r201787 100 100 JSValue Database::toJS(ExecState* exec) const 101 101 { 102 VM& vm = exec->vm(); 102 103 JSObject* result = constructEmptyObject(exec); 103 104 104 105 JSArray* bytecodes = constructEmptyArray(exec, 0); 106 if (UNLIKELY(vm.exception())) 107 return jsUndefined(); 105 108 for (unsigned i = 0; i < m_bytecodes.size(); ++i) 106 109 bytecodes->putDirectIndex(exec, i, m_bytecodes[i].toJS(exec)); 107 result->putDirect( exec->vm(), exec->propertyNames().bytecodes, bytecodes);110 result->putDirect(vm, exec->propertyNames().bytecodes, bytecodes); 108 111 109 112 JSArray* compilations = constructEmptyArray(exec, 0); 113 if (UNLIKELY(vm.exception())) 114 return jsUndefined(); 110 115 for (unsigned i = 0; i < m_compilations.size(); ++i) 111 116 compilations->putDirectIndex(exec, i, m_compilations[i]->toJS(exec)); 112 result->putDirect( exec->vm(), exec->propertyNames().compilations, compilations);117 result->putDirect(vm, exec->propertyNames().compilations, compilations); 113 118 114 119 JSArray* events = constructEmptyArray(exec, 0); 120 if (UNLIKELY(vm.exception())) 121 return jsUndefined(); 115 122 for (unsigned i = 0; i < m_events.size(); ++i) 116 123 events->putDirectIndex(exec, i, m_events[i].toJS(exec)); 117 result->putDirect( exec->vm(), exec->propertyNames().events, events);124 result->putDirect(vm, exec->propertyNames().events, events); 118 125 119 126 return result; -
TabularUnified trunk/Source/JavaScriptCore/profiler/ProfilerOSRExitSite.cpp ¶
r163844 r201787 37 37 JSValue OSRExitSite::toJS(ExecState* exec) const 38 38 { 39 VM& vm = exec->vm(); 39 40 JSArray* result = constructEmptyArray(exec, 0); 41 if (UNLIKELY(vm.exception())) 42 return jsUndefined(); 40 43 for (unsigned i = 0; i < m_codeAddresses.size(); ++i) 41 44 result->putDirectIndex(exec, i, jsString(exec, toString(RawPointer(m_codeAddresses[i])))); -
TabularUnified trunk/Source/JavaScriptCore/profiler/ProfilerOriginStack.cpp ¶
r190827 r201787 101 101 JSValue OriginStack::toJS(ExecState* exec) const 102 102 { 103 VM& vm = exec->vm(); 103 104 JSArray* result = constructEmptyArray(exec, 0); 105 if (UNLIKELY(vm.exception())) 106 return jsUndefined(); 104 107 105 108 for (unsigned i = 0; i < m_stack.size(); ++i) -
TabularUnified trunk/Source/JavaScriptCore/runtime/ArrayPrototype.cpp ¶
r201049 r201787 591 591 EncodedJSValue JSC_HOST_CALL arrayProtoFuncConcat(ExecState* exec) 592 592 { 593 VM& vm = exec->vm(); 593 594 JSValue thisValue = exec->thisValue().toThis(exec, StrictMode); 594 595 unsigned argCount = exec->argumentCount(); … … 611 612 // Can't use JSArray::length here because this might be a RuntimeArray! 612 613 finalArraySize += getLength(exec, currentArray); 613 if ( exec->hadException())614 if (UNLIKELY(vm.exception())) 614 615 return JSValue::encode(jsUndefined()); 615 616 } else … … 637 638 // We add the newTarget because the compiler gets confused between 0 being a number and a pointer. 638 639 result = constructEmptyArray(exec, nullptr, 0, JSValue()); 639 if ( exec->hadException())640 if (UNLIKELY(vm.exception())) 640 641 return JSValue::encode(jsUndefined()); 641 642 } 642 643 643 644 curArg = thisValue.toObject(exec); 644 ASSERT(! exec->hadException());645 ASSERT(!vm.exception()); 645 646 unsigned n = 0; 646 647 for (unsigned i = 0; ; ++i) { … … 648 649 // Can't use JSArray::length here because this might be a RuntimeArray! 649 650 unsigned length = getLength(exec, currentArray); 650 if ( exec->hadException())651 if (UNLIKELY(vm.exception())) 651 652 return JSValue::encode(jsUndefined()); 652 653 for (unsigned k = 0; k < length; ++k) { 653 654 JSValue v = getProperty(exec, currentArray, k); 654 if ( exec->hadException())655 if (UNLIKELY(vm.exception())) 655 656 return JSValue::encode(jsUndefined()); 656 657 if (v) … … 847 848 { 848 849 // http://developer.netscape.com/docs/manuals/js/client/jsref/array.htm#1193713 or 15.4.4.10 850 VM& vm = exec->vm(); 849 851 JSObject* thisObj = exec->thisValue().toThis(exec, StrictMode).toObject(exec); 850 852 if (!thisObj) 851 853 return JSValue::encode(JSValue()); 852 854 unsigned length = getLength(exec, thisObj); 853 if ( exec->hadException())855 if (UNLIKELY(vm.exception())) 854 856 return JSValue::encode(jsUndefined()); 855 857 … … 870 872 if (speciesResult.first == SpeciesConstructResult::CreatedObject) 871 873 result = speciesResult.second; 872 else 874 else { 873 875 result = constructEmptyArray(exec, nullptr, end - begin); 876 if (UNLIKELY(vm.exception())) 877 return JSValue::encode(jsUndefined()); 878 } 874 879 875 880 unsigned n = 0; 876 881 for (unsigned k = begin; k < end; k++, n++) { 877 882 JSValue v = getProperty(exec, thisObj, k); 878 if ( exec->hadException())883 if (UNLIKELY(vm.exception())) 879 884 return JSValue::encode(jsUndefined()); 880 885 if (v) … … 895 900 return JSValue::encode(JSValue()); 896 901 unsigned length = getLength(exec, thisObj); 897 if ( exec->hadException())902 if (UNLIKELY(vm.exception())) 898 903 return JSValue::encode(jsUndefined()); 899 904 … … 906 911 if (speciesResult.first == SpeciesConstructResult::CreatedObject) 907 912 result = speciesResult.second; 908 else 913 else { 909 914 result = constructEmptyArray(exec, nullptr); 915 if (UNLIKELY(vm.exception())) 916 return JSValue::encode(jsUndefined()); 917 } 910 918 911 919 setLength(exec, result, 0); … … 940 948 for (unsigned k = 0; k < deleteCount; ++k) { 941 949 JSValue v = getProperty(exec, thisObj, k + begin); 942 if ( exec->hadException())950 if (UNLIKELY(vm.exception())) 943 951 return JSValue::encode(jsUndefined()); 944 952 result->putByIndexInline(exec, k, v, true); 945 if ( exec->hadException())953 if (UNLIKELY(vm.exception())) 946 954 return JSValue::encode(jsUndefined()); 947 955 } … … 953 961 for (unsigned k = 0; k < deleteCount; ++k) { 954 962 JSValue v = getProperty(exec, thisObj, k + begin); 955 if ( exec->hadException())963 if (UNLIKELY(vm.exception())) 956 964 return JSValue::encode(jsUndefined()); 957 965 result->initializeIndex(vm, k, v); … … 963 971 if (additionalArgs < deleteCount) { 964 972 shift<JSArray::ShiftCountForSplice>(exec, thisObj, begin, deleteCount, additionalArgs, length); 965 if ( exec->hadException())973 if (UNLIKELY(vm.exception())) 966 974 return JSValue::encode(jsUndefined()); 967 975 } else if (additionalArgs > deleteCount) { 968 976 unshift<JSArray::ShiftCountForSplice>(exec, thisObj, begin, deleteCount, additionalArgs, length); 969 if ( exec->hadException())977 if (UNLIKELY(vm.exception())) 970 978 return JSValue::encode(jsUndefined()); 971 979 } 972 980 for (unsigned k = 0; k < additionalArgs; ++k) { 973 981 thisObj->putByIndexInline(exec, k + begin, exec->uncheckedArgument(k + 2), true); 974 if ( exec->hadException())982 if (UNLIKELY(vm.exception())) 975 983 return JSValue::encode(jsUndefined()); 976 984 } -
TabularUnified trunk/Source/JavaScriptCore/runtime/LiteralParser.cpp ¶
r199968 r201787 584 584 case StartParseArray: { 585 585 JSArray* array = constructEmptyArray(m_exec, 0); 586 if (UNLIKELY(m_exec->hadException())) 587 return JSValue(); 586 588 objectStack.append(array); 587 589 } -
TabularUnified trunk/Source/JavaScriptCore/runtime/ModuleLoaderObject.cpp ¶
r201542 r201787 298 298 299 299 JSArray* result = constructEmptyArray(exec, nullptr, moduleRecord->requestedModules().size()); 300 if (UNLIKELY(exec->hadException())) 301 JSValue::encode(jsUndefined()); 300 302 size_t i = 0; 301 303 for (auto& key : moduleRecord->requestedModules()) -
TabularUnified trunk/Source/JavaScriptCore/runtime/ObjectConstructor.cpp ¶
r201448 r201787 704 704 JSArray* ownPropertyKeys(ExecState* exec, JSObject* object, PropertyNameMode propertyNameMode, DontEnumPropertiesMode dontEnumPropertiesMode) 705 705 { 706 VM& vm = exec->vm(); 706 707 PropertyNameArray properties(exec, propertyNameMode); 707 object->methodTable( exec->vm())->getOwnPropertyNames(object, exec, properties, EnumerationMode(dontEnumPropertiesMode));708 if ( exec->hadException())708 object->methodTable(vm)->getOwnPropertyNames(object, exec, properties, EnumerationMode(dontEnumPropertiesMode)); 709 if (UNLIKELY(vm.exception())) 709 710 return nullptr; 710 711 711 712 JSArray* keys = constructEmptyArray(exec, 0); 713 if (UNLIKELY(vm.exception())) 714 return nullptr; 712 715 713 716 switch (propertyNameMode) { … … 728 731 ASSERT(identifier.isSymbol()); 729 732 if (!exec->propertyNames().isPrivateName(identifier)) 730 keys->push(exec, Symbol::create( exec->vm(), static_cast<SymbolImpl&>(*identifier.impl())));733 keys->push(exec, Symbol::create(vm, static_cast<SymbolImpl&>(*identifier.impl()))); 731 734 } 732 735 break; … … 747 750 // To ensure the order defined in the spec (9.1.12), we append symbols at the last elements of keys. 748 751 for (const auto& identifier : propertySymbols) 749 keys->push(exec, Symbol::create( exec->vm(), static_cast<SymbolImpl&>(*identifier.impl())));752 keys->push(exec, Symbol::create(vm, static_cast<SymbolImpl&>(*identifier.impl()))); 750 753 751 754 break; -
TabularUnified trunk/Source/JavaScriptCore/runtime/RegExpObject.cpp ¶
r201451 r201787 180 180 181 181 JSArray* array = constructEmptyArray(exec, nullptr); 182 if (UNLIKELY(vm.exception())) 183 return jsUndefined(); 182 184 183 185 auto iterate = [&] () { -
TabularUnified trunk/Source/JavaScriptCore/runtime/RegExpPrototype.cpp ¶
r201467 r201787 564 564 // 12. Let lengthA be 0. 565 565 JSArray* result = constructEmptyArray(exec, 0); 566 if (UNLIKELY(vm.exception())) 567 return JSValue::encode(jsUndefined()); 566 568 unsigned resultLength = 0; 567 569 -
TabularUnified trunk/Source/JavaScriptCore/runtime/StringPrototype.cpp ¶
r201782 r201787 1083 1083 EncodedJSValue JSC_HOST_CALL stringProtoFuncSplitFast(ExecState* exec) 1084 1084 { 1085 VM& vm = exec->vm(); 1085 1086 JSValue thisValue = exec->thisValue(); 1086 1087 ASSERT(checkObjectCoercible(thisValue)); … … 1089 1090 // 7. Let s be the number of characters in S. 1090 1091 String input = thisValue.toString(exec)->value(exec); 1091 if ( exec->hadException())1092 if (UNLIKELY(vm.exception())) 1092 1093 return JSValue::encode(jsUndefined()); 1093 1094 ASSERT(!input.isNull()); … … 1096 1097 // where Array is the standard built-in constructor with that name. 1097 1098 JSArray* result = constructEmptyArray(exec, 0); 1099 if (UNLIKELY(vm.exception())) 1100 return JSValue::encode(jsUndefined()); 1098 1101 1099 1102 // 5. Let lengthA be 0. … … 1111 1114 JSValue separatorValue = exec->uncheckedArgument(0); 1112 1115 String separator = separatorValue.toString(exec)->value(exec); 1113 if ( exec->hadException())1116 if (UNLIKELY(vm.exception())) 1114 1117 return JSValue::encode(jsUndefined()); 1115 1118 -
TabularUnified trunk/Source/JavaScriptCore/runtime/TemplateRegistry.cpp ¶
r184352 r201787 46 46 return cached; 47 47 48 VM& vm = exec->vm(); 48 49 unsigned count = templateKey.cookedStrings().size(); 49 50 JSArray* templateObject = constructEmptyArray(exec, nullptr, count); 51 if (UNLIKELY(vm.exception())) 52 return nullptr; 50 53 JSArray* rawObject = constructEmptyArray(exec, nullptr, count); 54 if (UNLIKELY(vm.exception())) 55 return nullptr; 51 56 52 57 for (unsigned index = 0; index < count; ++index) { … … 58 63 ASSERT(!exec->hadException()); 59 64 60 templateObject->putDirect( exec->vm(), exec->propertyNames().raw, rawObject, ReadOnly | DontEnum | DontDelete);65 templateObject->putDirect(vm, exec->propertyNames().raw, rawObject, ReadOnly | DontEnum | DontDelete); 61 66 62 67 objectConstructorFreeze(exec, templateObject); -
TabularUnified trunk/Source/WebCore/ChangeLog ¶
r201785 r201787 1 2016-06-07 Mark Lam <mark.lam@apple.com> 2 3 Need an exception check after constructEmptyArray(). 4 https://bugs.webkit.org/show_bug.cgi?id=158411 5 6 Reviewed by Saam Barati. 7 8 A stress test for this was added in JavaScriptCore. 9 10 * bindings/js/IDBBindingUtilities.cpp: 11 (WebCore::toJS): 12 * bindings/js/JSCommandLineAPIHostCustom.cpp: 13 (WebCore::getJSListenerFunctions): 14 * bindings/js/JSCryptoKeySerializationJWK.cpp: 15 (WebCore::buildJSONForRSAComponents): 16 (WebCore::addBoolToJSON): 17 (WebCore::addUsagesToJSON): 18 (WebCore::JSCryptoKeySerializationJWK::serialize): 19 * bindings/js/JSDOMBinding.h: 20 (WebCore::toJS): 21 * bindings/js/SerializedScriptValue.cpp: 22 (WebCore::CloneDeserializer::deserialize): 23 1 24 2016-06-07 Antoine Quint <graouts@apple.com> 2 25 -
TabularUnified trunk/Source/WebCore/bindings/js/IDBBindingUtilities.cpp ¶
r201665 r201787 89 89 } 90 90 91 Locker<JSLock> locker(state.vm().apiLock()); 91 VM& vm = state.vm(); 92 Locker<JSLock> locker(vm.apiLock()); 92 93 93 94 switch (key->type()) { … … 95 96 auto& inArray = key->array(); 96 97 unsigned size = inArray.size(); 97 auto& outArray = *constructEmptyArray(&state, 0, &globalObject, size); 98 auto outArray = constructEmptyArray(&state, 0, &globalObject, size); 99 if (UNLIKELY(vm.exception())) 100 return jsUndefined(); 98 101 for (size_t i = 0; i < size; ++i) 99 outArray .putDirectIndex(&state, i, toJS(state, globalObject, inArray.at(i).get()));100 return &outArray;102 outArray->putDirectIndex(&state, i, toJS(state, globalObject, inArray.at(i).get())); 103 return outArray; 101 104 } 102 105 case KeyType::String: -
TabularUnified trunk/Source/WebCore/bindings/js/JSCommandLineAPIHostCustom.cpp ¶
r199642 r201787 68 68 static JSArray* getJSListenerFunctions(ExecState& state, Document* document, const EventListenerInfo& listenerInfo) 69 69 { 70 VM& vm = state.vm(); 70 71 JSArray* result = constructEmptyArray(&state, nullptr); 72 if (UNLIKELY(vm.exception())) 73 return nullptr; 71 74 size_t handlersCount = listenerInfo.eventListenerVector.size(); 72 75 for (size_t i = 0, outputIndex = 0; i < handlersCount; ++i) { … … 86 89 87 90 JSObject* listenerEntry = constructEmptyObject(&state); 88 listenerEntry->putDirect( state.vm(), Identifier::fromString(&state, "listener"), function);89 listenerEntry->putDirect( state.vm(), Identifier::fromString(&state, "useCapture"), jsBoolean(listenerInfo.eventListenerVector[i].useCapture));91 listenerEntry->putDirect(vm, Identifier::fromString(&state, "listener"), function); 92 listenerEntry->putDirect(vm, Identifier::fromString(&state, "useCapture"), jsBoolean(listenerInfo.eventListenerVector[i].useCapture)); 90 93 result->putDirectIndex(&state, outputIndex++, JSValue(listenerEntry)); 91 94 } -
TabularUnified trunk/Source/WebCore/bindings/js/JSCryptoKeySerializationJWK.cpp ¶
r196722 r201787 535 535 return; 536 536 537 VM& vm = exec->vm(); 537 538 JSArray* oth = constructEmptyArray(exec, 0, exec->lexicalGlobalObject(), data.otherPrimeInfos().size()); 539 if (UNLIKELY(vm.exception())) 540 return; 538 541 for (size_t i = 0, size = data.otherPrimeInfos().size(); i < size; ++i) { 539 542 JSObject* jsPrimeInfo = constructEmptyObject(exec); … … 543 546 oth->putDirectIndex(exec, i, jsPrimeInfo); 544 547 } 545 result->putDirect( exec->vm(), Identifier::fromString(exec, "oth"), oth);548 result->putDirect(vm, Identifier::fromString(exec, "oth"), oth); 546 549 } 547 550 … … 656 659 static void addUsagesToJSON(ExecState* exec, JSObject* json, CryptoKeyUsage usages) 657 660 { 661 VM& vm = exec->vm(); 658 662 JSArray* keyOps = constructEmptyArray(exec, 0, exec->lexicalGlobalObject(), 0); 663 if (UNLIKELY(vm.exception())) 664 return; 659 665 660 666 unsigned index = 0; … … 676 682 keyOps->putDirectIndex(exec, index++, jsNontrivialString(exec, ASCIILiteral("deriveBits"))); 677 683 678 json->putDirect( exec->vm(), Identifier::fromString(exec, "key_ops"), keyOps);684 json->putDirect(vm, Identifier::fromString(exec, "key_ops"), keyOps); 679 685 } 680 686 -
TabularUnified trunk/Source/WebCore/bindings/js/JSDOMBinding.h ¶
r201703 r201787 541 541 { 542 542 JSC::JSArray* array = constructEmptyArray(exec, nullptr, vector.size()); 543 if (UNLIKELY(exec->hadException())) 544 return JSC::jsUndefined(); 543 545 for (size_t i = 0; i < vector.size(); ++i) 544 546 array->putDirectIndex(exec, i, toJS(exec, globalObject, vector[i])); … … 549 551 { 550 552 JSC::JSArray* array = constructEmptyArray(exec, nullptr, vector.size()); 553 if (UNLIKELY(exec->hadException())) 554 return JSC::jsUndefined(); 551 555 for (size_t i = 0; i < vector.size(); ++i) 552 556 array->putDirectIndex(exec, i, toJS(exec, globalObject, vector[i].get())); -
TabularUnified trunk/Source/WebCore/bindings/js/SerializedScriptValue.cpp ¶
r201717 r201787 2464 2464 } 2465 2465 JSArray* outArray = constructEmptyArray(m_exec, 0, m_globalObject, length); 2466 if (UNLIKELY(m_exec->hadException())) 2467 goto error; 2466 2468 m_gcBuffer.append(outArray); 2467 2469 outputObjectStack.append(outArray);
Note:
See TracChangeset
for help on using the changeset viewer.