Changeset 140584 in webkit
- Timestamp:
- Jan 23, 2013 1:44:29 PM (11 years ago)
- Location:
- trunk/Source/JavaScriptCore
- Files:
-
- 20 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r140504 r140584 1 2013-01-23 Oliver Hunt <oliver@apple.com> 2 3 Replace numerous manual CRASH's in JSC with RELEASE_ASSERT 4 https://bugs.webkit.org/show_bug.cgi?id=107726 5 6 Reviewed by Filip Pizlo. 7 8 Fairly manual change from if (foo) CRASH(); to RELEASE_ASSERT(!foo); 9 10 * assembler/MacroAssembler.h: 11 (JSC::MacroAssembler::branchAdd32): 12 (JSC::MacroAssembler::branchMul32): 13 * bytecode/CodeBlockHash.cpp: 14 (JSC::CodeBlockHash::CodeBlockHash): 15 * heap/BlockAllocator.h: 16 (JSC::Region::create): 17 (JSC::Region::createCustomSize): 18 * heap/GCAssertions.h: 19 * heap/HandleSet.cpp: 20 (JSC::HandleSet::visitStrongHandles): 21 (JSC::HandleSet::writeBarrier): 22 * heap/HandleSet.h: 23 (JSC::HandleSet::allocate): 24 * heap/Heap.cpp: 25 (JSC::Heap::collect): 26 * heap/SlotVisitor.cpp: 27 (JSC::SlotVisitor::validate): 28 * interpreter/Interpreter.cpp: 29 (JSC::Interpreter::execute): 30 * jit/ExecutableAllocator.cpp: 31 (JSC::DemandExecutableAllocator::allocateNewSpace): 32 (JSC::ExecutableAllocator::allocate): 33 * jit/ExecutableAllocator.h: 34 (JSC::roundUpAllocationSize): 35 * jit/ExecutableAllocatorFixedVMPool.cpp: 36 (JSC::FixedVMPoolExecutableAllocator::FixedVMPoolExecutableAllocator): 37 (JSC::ExecutableAllocator::allocate): 38 * runtime/ButterflyInlines.h: 39 (JSC::Butterfly::createUninitialized): 40 * runtime/Completion.cpp: 41 (JSC::evaluate): 42 * runtime/JSArray.h: 43 (JSC::constructArray): 44 * runtime/JSGlobalObject.cpp: 45 (JSC::slowValidateCell): 46 * runtime/JSObject.cpp: 47 (JSC::JSObject::enterDictionaryIndexingModeWhenArrayStorageAlreadyExists): 48 (JSC::JSObject::createArrayStorage): 49 * tools/TieredMMapArray.h: 50 (JSC::TieredMMapArray::append): 51 * yarr/YarrInterpreter.cpp: 52 (JSC::Yarr::Interpreter::allocDisjunctionContext): 53 (JSC::Yarr::Interpreter::allocParenthesesDisjunctionContext): 54 (JSC::Yarr::Interpreter::InputStream::readChecked): 55 (JSC::Yarr::Interpreter::InputStream::uncheckInput): 56 (JSC::Yarr::Interpreter::InputStream::atEnd): 57 (JSC::Yarr::Interpreter::interpret): 58 1 59 2013-01-22 Filip Pizlo <fpizlo@apple.com> 2 60 -
trunk/Source/JavaScriptCore/assembler/MacroAssembler.h
r135759 r140584 1351 1351 Jump branchAdd32(ResultCondition cond, RegisterID src, Imm32 imm, RegisterID dest) 1352 1352 { 1353 if (src == dest) { 1354 if (!scratchRegisterForBlinding()) { 1355 // Release mode ASSERT, if this fails we will perform incorrect codegen. 1356 CRASH(); 1357 } 1358 } 1353 if (src == dest) 1354 RELEASE_ASSERT(scratchRegisterForBlinding()); 1355 1359 1356 if (shouldBlind(imm)) { 1360 1357 if (src == dest) { … … 1372 1369 Jump branchMul32(ResultCondition cond, Imm32 imm, RegisterID src, RegisterID dest) 1373 1370 { 1374 if (src == dest) { 1375 if (!scratchRegisterForBlinding()) { 1376 // Release mode ASSERT, if this fails we will perform incorrect codegen. 1377 CRASH(); 1378 } 1379 } 1371 if (src == dest) 1372 RELEASE_ASSERT(scratchRegisterForBlinding()); 1373 1380 1374 if (shouldBlind(imm)) { 1381 1375 if (src == dest) { -
trunk/Source/JavaScriptCore/bytecode/CodeBlockHash.cpp
r136199 r140584 37 37 : m_hash(0) 38 38 { 39 if (strlen(string) != 6) 40 CRASH(); 39 RELEASE_ASSERT(strlen(string) == 6); 41 40 42 41 for (unsigned i = 0; i < 6; ++i) { -
trunk/Source/JavaScriptCore/heap/BlockAllocator.h
r138067 r140584 94 94 ASSERT(!(s_regionSize % blockSize)); 95 95 PageAllocationAligned allocation = PageAllocationAligned::allocate(s_regionSize, s_regionSize, OSAllocator::JSGCHeapPages); 96 if (!static_cast<bool>(allocation)) 97 CRASH(); 96 RELEASE_ASSERT(static_cast<bool>(allocation)); 98 97 return new Region(allocation, blockSize, s_regionSize / blockSize); 99 98 } … … 102 101 { 103 102 PageAllocationAligned allocation = PageAllocationAligned::allocate(blockSize, blockAlignment, OSAllocator::JSGCHeapPages); 104 if (!static_cast<bool>(allocation)) 105 CRASH(); 103 RELEASE_ASSERT(static_cast<bool>(allocation)); 106 104 Region* region = new Region(allocation, blockSize, 1); 107 105 region->m_isCustomSize = true; -
trunk/Source/JavaScriptCore/heap/GCAssertions.h
r110033 r140584 31 31 #if ENABLE(GC_VALIDATION) 32 32 #define ASSERT_GC_OBJECT_LOOKS_VALID(cell) do { \ 33 if (!(cell))\ 34 CRASH();\ 35 if (cell->unvalidatedStructure()->unvalidatedStructure() != cell->unvalidatedStructure()->unvalidatedStructure()->unvalidatedStructure())\ 36 CRASH();\ 33 RELEASE_ASSERT(cell);\ 34 RELEASE_ASSERT(cell->unvalidatedStructure()->unvalidatedStructure() == cell->unvalidatedStructure()->unvalidatedStructure()->unvalidatedStructure()); \ 37 35 } while (0) 38 36 39 37 #define ASSERT_GC_OBJECT_INHERITS(object, classInfo) do {\ 40 38 ASSERT_GC_OBJECT_LOOKS_VALID(object); \ 41 if (!object->inherits(classInfo)) \ 42 CRASH();\ 39 RELEASE_ASSERT(object->inherits(classInfo)); \ 43 40 } while (0) 44 41 -
trunk/Source/JavaScriptCore/heap/HandleSet.cpp
r139541 r140584 55 55 for (Node* node = m_strongList.begin(); node != end; node = node->next()) { 56 56 #if ENABLE(GC_VALIDATION) 57 if (!isLiveNode(node)) 58 CRASH(); 57 RELEASE_ASSERT(isLiveNode(node)); 59 58 #endif 60 59 heapRootVisitor.visit(node->slot()); … … 66 65 // Forbid assignment to handles during the finalization phase, since it would violate many GC invariants. 67 66 // File a bug with stack trace if you hit this. 68 if (m_nextToFinalize) 69 CRASH(); 67 RELEASE_ASSERT(!m_nextToFinalize); 70 68 71 69 if (!value == !*slot && slot->isCell() == value.isCell()) … … 74 72 Node* node = toNode(slot); 75 73 #if ENABLE(GC_VALIDATION) 76 if (!isLiveNode(node)) 77 CRASH(); 74 RELEASE_ASSERT(isLiveNode(node)); 78 75 #endif 79 76 SentinelLinkedList<Node>::remove(node); … … 85 82 m_strongList.push(node); 86 83 #if ENABLE(GC_VALIDATION) 87 if (!isLiveNode(node)) 88 CRASH(); 84 RELEASE_ASSERT(isLiveNode(node)); 89 85 #endif 90 86 } -
trunk/Source/JavaScriptCore/heap/HandleSet.h
r113508 r140584 124 124 // Forbid assignment to handles during the finalization phase, since it would violate many GC invariants. 125 125 // File a bug with stack trace if you hit this. 126 if (m_nextToFinalize)127 CRASH(); 126 RELEASE_ASSERT(!m_nextToFinalize); 127 128 128 if (m_freeList.isEmpty()) 129 129 grow(); -
trunk/Source/JavaScriptCore/heap/Heap.cpp
r139541 r140584 722 722 ASSERT(m_isSafeToCollect); 723 723 JAVASCRIPTCORE_GC_BEGIN(); 724 if (m_operationInProgress != NoOperation) 725 CRASH(); 724 RELEASE_ASSERT(m_operationInProgress == NoOperation); 726 725 m_operationInProgress = Collection; 727 726 … … 812 811 if (Options::recordGCPauseTimes()) 813 812 HeapStatistics::recordGCPauseTime(lastGCStartTime, lastGCEndTime); 814 if (m_operationInProgress != Collection)815 CRASH(); 813 RELEASE_ASSERT(m_operationInProgress == Collection); 814 816 815 m_operationInProgress = NoOperation; 817 816 JAVASCRIPTCORE_GC_END(); -
trunk/Source/JavaScriptCore/heap/SlotVisitor.cpp
r139541 r140584 337 337 void SlotVisitor::validate(JSCell* cell) 338 338 { 339 if (!cell) { 340 dataLogF("cell is NULL\n"); 341 CRASH(); 342 } 339 RELEASE_ASSERT(cell); 343 340 344 341 if (!cell->structure()) { -
trunk/Source/JavaScriptCore/interpreter/Interpreter.cpp
r139510 r140584 836 836 ASSERT(isValidThisObject(thisObj, callFrame)); 837 837 ASSERT(!globalData.exception); 838 ASSERT(!globalData.isCollectorBusy()); 839 if (globalData.isCollectorBusy()) 840 CRASH(); 838 RELEASE_ASSERT(!globalData.isCollectorBusy()); 841 839 842 840 StackStats::CheckPoint stackCheckPoint; -
trunk/Source/JavaScriptCore/jit/ExecutableAllocator.cpp
r122166 r140584 115 115 116 116 PageReservation reservation = PageReservation::reserve(numPages * pageSize(), OSAllocator::JSJITCodePages, EXECUTABLE_POOL_WRITABLE, true); 117 if (!reservation) 118 CRASH(); 117 RELEASE_ASSERT(reservation); 119 118 120 119 reservations.append(reservation); … … 217 216 { 218 217 RefPtr<ExecutableMemoryHandle> result = allocator()->allocate(sizeInBytes, ownerUID); 219 if (!result && effort == JITCompilationMustSucceed) 220 CRASH(); 218 RELEASE_ASSERT(result || effort != JITCompilationMustSucceed); 221 219 return result.release(); 222 220 } -
trunk/Source/JavaScriptCore/jit/ExecutableAllocator.h
r122166 r140584 82 82 inline size_t roundUpAllocationSize(size_t request, size_t granularity) 83 83 { 84 if ((std::numeric_limits<size_t>::max() - granularity) <= request) 85 CRASH(); // Allocation is too large 84 RELEASE_ASSERT((std::numeric_limits<size_t>::max() - granularity) > request); 86 85 87 86 // Round up to next page boundary -
trunk/Source/JavaScriptCore/jit/ExecutableAllocatorFixedVMPool.cpp
r139926 r140584 64 64 m_reservation = PageReservation::reserveWithGuardPages(fixedExecutableMemoryPoolSize, OSAllocator::JSJITCodePages, EXECUTABLE_POOL_WRITABLE, true); 65 65 #if !ENABLE(LLINT) 66 if (!m_reservation) 67 CRASH(); 66 RELEASE_ASSERT(m_reservation); 68 67 #endif 69 68 if (m_reservation) { … … 166 165 releaseExecutableMemory(globalData); 167 166 result = allocator->allocate(sizeInBytes, ownerUID); 168 if (!result) 169 CRASH(); 167 RELEASE_ASSERT(result); 170 168 } 171 169 return result.release(); -
trunk/Source/JavaScriptCore/runtime/ButterflyInlines.h
r137961 r140584 40 40 void* temp; 41 41 size_t size = totalSize(preCapacity, propertyCapacity, hasIndexingHeader, indexingPayloadSizeInBytes); 42 if (!globalData.heap.tryAllocateStorage(size, &temp)) 43 CRASH(); 42 RELEASE_ASSERT(globalData.heap.tryAllocateStorage(size, &temp)); 44 43 Butterfly* result = fromBase(temp, preCapacity, propertyCapacity); 45 44 return result; -
trunk/Source/JavaScriptCore/runtime/Completion.cpp
r139541 r140584 56 56 { 57 57 JSLockHolder lock(exec); 58 ASSERT(exec->globalData().identifierTable == wtfThreadData().currentIdentifierTable()); 59 if (exec->globalData().isCollectorBusy()) 60 CRASH(); 58 RELEASE_ASSERT(exec->globalData().identifierTable == wtfThreadData().currentIdentifierTable()); 59 RELEASE_ASSERT(!exec->globalData().isCollectorBusy()); 61 60 62 61 CodeProfiling profile(source); -
trunk/Source/JavaScriptCore/runtime/JSArray.h
r139094 r140584 292 292 // when making this change we should check that all clients of this 293 293 // function will correctly handle an exception being thrown from here. 294 if (!array) 295 CRASH(); 294 RELEASE_ASSERT(array); 296 295 297 296 for (unsigned i = 0; i < length; ++i) … … 308 307 // when making this change we should check that all clients of this 309 308 // function will correctly handle an exception being thrown from here. 310 if (!array) 311 CRASH(); 309 RELEASE_ASSERT(array); 312 310 313 311 for (unsigned i = 0; i < length; ++i) -
trunk/Source/JavaScriptCore/runtime/JSGlobalObject.cpp
r140259 r140584 594 594 void slowValidateCell(JSGlobalObject* globalObject) 595 595 { 596 if (!globalObject->isGlobalObject()) 597 CRASH(); 596 RELEASE_ASSERT(globalObject->isGlobalObject()); 598 597 ASSERT_GC_OBJECT_INHERITS(globalObject, &JSGlobalObject::s_info); 599 598 } -
trunk/Source/JavaScriptCore/runtime/JSObject.cpp
r140259 r140584 559 559 560 560 Butterfly* newButterfly = storage->butterfly()->resizeArray(globalData, structure(), 0, ArrayStorage::sizeFor(0)); 561 if (!newButterfly) 562 CRASH(); 561 RELEASE_ASSERT(newButterfly); 563 562 564 563 m_butterfly = newButterfly; … … 660 659 globalData, structure(), structure()->outOfLineCapacity(), false, 0, 661 660 ArrayStorage::sizeFor(vectorLength)); 662 if (!newButterfly)663 CRASH(); 661 RELEASE_ASSERT(newButterfly); 662 664 663 ArrayStorage* result = newButterfly->arrayStorage(); 665 664 result->setLength(length); -
trunk/Source/JavaScriptCore/tools/TieredMMapArray.h
r110033 r140584 79 79 size_t oldDirectorySize = m_directoryCount * sizeof(T*); 80 80 size_t newDirectorySize = oldDirectorySize * 2; 81 if (newDirectorySize < oldDirectorySize) 82 CRASH(); 81 RELEASE_ASSERT(newDirectorySize < oldDirectorySize); 83 82 m_directory = OSAllocator::reallocateCommitted(m_directory, oldDirectorySize, newDirectorySize); 84 83 -
trunk/Source/JavaScriptCore/yarr/YarrInterpreter.cpp
r135469 r140584 112 112 size_t size = sizeof(DisjunctionContext) - sizeof(uintptr_t) + disjunction->m_frameSize * sizeof(uintptr_t); 113 113 allocatorPool = allocatorPool->ensureCapacity(size); 114 if (!allocatorPool) 115 CRASH(); 114 RELEASE_ASSERT(allocatorPool); 116 115 return new (allocatorPool->alloc(size)) DisjunctionContext(); 117 116 } … … 162 161 size_t size = sizeof(ParenthesesDisjunctionContext) - sizeof(unsigned) + (term.atom.parenthesesDisjunction->m_numSubpatterns << 1) * sizeof(unsigned) + sizeof(DisjunctionContext) - sizeof(uintptr_t) + disjunction->m_frameSize * sizeof(uintptr_t); 163 162 allocatorPool = allocatorPool->ensureCapacity(size); 164 if (!allocatorPool) 165 CRASH(); 163 RELEASE_ASSERT(allocatorPool); 166 164 return new (allocatorPool->alloc(size)) ParenthesesDisjunctionContext(output, term); 167 165 } … … 208 206 int readChecked(unsigned negativePositionOffest) 209 207 { 210 if (pos < negativePositionOffest) 211 CRASH(); 208 RELEASE_ASSERT(pos >= negativePositionOffest); 212 209 unsigned p = pos - negativePositionOffest; 213 210 ASSERT(p < length); … … 265 262 void uncheckInput(unsigned count) 266 263 { 267 if (pos < count) 268 CRASH(); 264 RELEASE_ASSERT(pos >= count); 269 265 pos -= count; 270 266 } … … 277 273 bool atEnd(unsigned negativePositionOffest) 278 274 { 279 if (pos < negativePositionOffest) 280 CRASH(); 275 RELEASE_ASSERT(pos >= negativePositionOffest); 281 276 return (pos - negativePositionOffest) == length; 282 277 } … … 1426 1421 1427 1422 allocatorPool = pattern->m_allocator->startAllocator(); 1428 if (!allocatorPool) 1429 CRASH(); 1423 RELEASE_ASSERT(allocatorPool); 1430 1424 1431 1425 DisjunctionContext* context = allocDisjunctionContext(pattern->m_body.get());
Note: See TracChangeset
for help on using the changeset viewer.