Changeset 219046 in webkit
- Timestamp:
- Jun 30, 2017 11:24:44 PM (7 years ago)
- Location:
- trunk/Source
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r219043 r219046 1 2017-06-30 Keith Miller <keith_miller@apple.com> 2 3 Force crashWithInfo to be out of line. 4 https://bugs.webkit.org/show_bug.cgi?id=174028 5 6 Reviewed by Filip Pizlo. 7 8 Update DFG_ASSERT macro to call CRASH_WITH_SECURITY_IMPLICATION_AND_INFO. 9 10 * dfg/DFGGraph.cpp: 11 (JSC::DFG::logDFGAssertionFailure): 12 (JSC::DFG::Graph::logAssertionFailure): 13 (JSC::DFG::crash): Deleted. 14 (JSC::DFG::Graph::handleAssertionFailure): Deleted. 15 * dfg/DFGGraph.h: 16 1 17 2017-06-30 Yusuke Suzuki <utatane.tea@gmail.com> 2 18 -
trunk/Source/JavaScriptCore/dfg/DFGGraph.cpp
r219006 r219046 1439 1439 } 1440 1440 1441 NO_RETURN_DUE_TO_CRASH static void crash(1441 static void logDFGAssertionFailure( 1442 1442 Graph& graph, const CString& whileText, const char* file, int line, const char* function, 1443 1443 const char* assertion) … … 1453 1453 dataLog("DFG ASSERTION FAILED: ", assertion, "\n"); 1454 1454 dataLog(file, "(", line, ") : ", function, "\n"); 1455 CRASH_WITH_SECURITY_IMPLICATION();1456 } 1457 1458 void Graph:: handleAssertionFailure(1455 WTFReportBacktrace(); 1456 } 1457 1458 void Graph::logAssertionFailure( 1459 1459 std::nullptr_t, const char* file, int line, const char* function, const char* assertion) 1460 1460 { 1461 crash(*this, "", file, line, function, assertion);1462 } 1463 1464 void Graph:: handleAssertionFailure(1461 logDFGAssertionFailure(*this, "", file, line, function, assertion); 1462 } 1463 1464 void Graph::logAssertionFailure( 1465 1465 Node* node, const char* file, int line, const char* function, const char* assertion) 1466 1466 { 1467 crash(*this, toCString("While handling node ", node, "\n\n"), file, line, function, assertion);1468 } 1469 1470 void Graph:: handleAssertionFailure(1467 logDFGAssertionFailure(*this, toCString("While handling node ", node, "\n\n"), file, line, function, assertion); 1468 } 1469 1470 void Graph::logAssertionFailure( 1471 1471 BasicBlock* block, const char* file, int line, const char* function, const char* assertion) 1472 1472 { 1473 crash(*this, toCString("While handling block ", pointerDump(block), "\n\n"), file, line, function, assertion);1473 logDFGAssertionFailure(*this, toCString("While handling block ", pointerDump(block), "\n\n"), file, line, function, assertion); 1474 1474 } 1475 1475 -
trunk/Source/JavaScriptCore/dfg/DFGGraph.h
r219006 r219046 94 94 } while (false) 95 95 96 #define DFG_ASSERT(graph, node, assertion ) do {\96 #define DFG_ASSERT(graph, node, assertion, ...) do { \ 97 97 if (!!(assertion)) \ 98 98 break; \ 99 (graph). handleAssertionFailure(\99 (graph).logAssertionFailure( \ 100 100 (node), __FILE__, __LINE__, WTF_PRETTY_FUNCTION, #assertion); \ 101 CRASH_WITH_SECURITY_IMPLICATION_AND_INFO(__VA_ARGS__); \ 101 102 } while (false) 102 103 103 #define DFG_CRASH(graph, node, reason ) do {\104 (graph). handleAssertionFailure(\104 #define DFG_CRASH(graph, node, reason, ...) do { \ 105 (graph).logAssertionFailure( \ 105 106 (node), __FILE__, __LINE__, WTF_PRETTY_FUNCTION, (reason)); \ 107 CRASH_WITH_SECURITY_IMPLICATION_AND_INFO(__VA_ARGS__); \ 106 108 } while (false) 107 109 … … 888 890 void visitChildren(SlotVisitor&) override; 889 891 890 NO_RETURN_DUE_TO_CRASH void handleAssertionFailure(892 void logAssertionFailure( 891 893 std::nullptr_t, const char* file, int line, const char* function, 892 894 const char* assertion); 893 NO_RETURN_DUE_TO_CRASH void handleAssertionFailure(895 void logAssertionFailure( 894 896 Node*, const char* file, int line, const char* function, 895 897 const char* assertion); 896 NO_RETURN_DUE_TO_CRASH void handleAssertionFailure(898 void logAssertionFailure( 897 899 BasicBlock*, const char* file, int line, const char* function, 898 900 const char* assertion); -
trunk/Source/WTF/ChangeLog
r219042 r219046 1 2017-06-30 Keith Miller <keith_miller@apple.com> 2 3 Force crashWithInfo to be out of line. 4 https://bugs.webkit.org/show_bug.cgi?id=174028 5 6 Reviewed by Filip Pizlo. 7 8 The first pass at making crashes hold information about why they 9 were crashing had the problem that it would inline the assertion. 10 This meant that clang could coalesce DFG_ASSERTS with other 11 assertion failures in the same function. This patch moves it out 12 of line to help fix that issue. 13 14 * wtf/Assertions.cpp: 15 (WTFCrashWithInfo): 16 * wtf/Assertions.h: 17 (WTF::isIntegralType): 18 1 19 2017-06-30 Yusuke Suzuki <utatane.tea@gmail.com> 2 20 -
trunk/Source/WTF/wtf/Assertions.cpp
r218069 r219046 560 560 } // extern "C" 561 561 562 #if OS(DARWIN) && (CPU(X64_64) || CPU(ARM64)) 563 #if CPU(X86_64) 564 #define STUFF_REGISTER_FOR_CRASH(reg, info) __asm__ volatile ("movq %0, %%" reg : : "r" (static_cast<uint64_t>(info)) : reg) 565 566 // This ordering was chosen to be consistent with JSC's JIT asserts. We probably shouldn't change this ordering 567 // since it would make tooling crash reports much harder. If, for whatever reason, we decide to change the ordering 568 // here we should update the abortWithuint64_t functions. 569 #define STUFF_FOR_CRASH_REGISTER1 "r11" 570 #define STUFF_FOR_CRASH_REGISTER2 "r10" 571 #define STUFF_FOR_CRASH_REGISTER3 "r9" 572 #define STUFF_FOR_CRASH_REGISTER4 "r8" 573 #define STUFF_FOR_CRASH_REGISTER5 "r15" 574 575 #elif CPU(ARM64) // CPU(X86_64) 576 #define STUFF_REGISTER_FOR_CRASH(reg, info) __asm__ volatile ("mov " reg ", %0" : : "r" (static_cast<uint64_t>(info)) : reg) 577 578 // See comment above on the ordering. 579 #define STUFF_FOR_CRASH_REGISTER1 "x16" 580 #define STUFF_FOR_CRASH_REGISTER2 "x17" 581 #define STUFF_FOR_CRASH_REGISTER3 "x18" 582 #define STUFF_FOR_CRASH_REGISTER4 "x19" 583 #define STUFF_FOR_CRASH_REGISTER5 "x20" 584 585 #endif // CPU(ARM64) 586 587 void WTFCrashWithInfo(int, const char*, const char*, int, uint64_t reason, uint64_t misc1, uint64_t misc2, uint64_t misc3, uint64_t misc4) 588 { 589 STUFF_REGISTER_FOR_CRASH(STUFF_FOR_CRASH_REGISTER1, reason); 590 STUFF_REGISTER_FOR_CRASH(STUFF_FOR_CRASH_REGISTER2, misc1); 591 STUFF_REGISTER_FOR_CRASH(STUFF_FOR_CRASH_REGISTER3, misc2); 592 STUFF_REGISTER_FOR_CRASH(STUFF_FOR_CRASH_REGISTER4, misc3); 593 STUFF_REGISTER_FOR_CRASH(STUFF_FOR_CRASH_REGISTER5, misc4); 594 CRASH(); 595 } 596 597 void WTFCrashWithInfo(int, const char*, const char*, int, uint64_t reason, uint64_t misc1, uint64_t misc2, uint64_t misc3) 598 { 599 STUFF_REGISTER_FOR_CRASH(STUFF_FOR_CRASH_REGISTER1, reason); 600 STUFF_REGISTER_FOR_CRASH(STUFF_FOR_CRASH_REGISTER2, misc1); 601 STUFF_REGISTER_FOR_CRASH(STUFF_FOR_CRASH_REGISTER3, misc2); 602 STUFF_REGISTER_FOR_CRASH(STUFF_FOR_CRASH_REGISTER4, misc3); 603 CRASH(); 604 } 605 606 void WTFCrashWithInfo(int, const char*, const char*, int, uint64_t reason, uint64_t misc1, uint64_t misc2) 607 { 608 STUFF_REGISTER_FOR_CRASH(STUFF_FOR_CRASH_REGISTER1, reason); 609 STUFF_REGISTER_FOR_CRASH(STUFF_FOR_CRASH_REGISTER2, misc1); 610 STUFF_REGISTER_FOR_CRASH(STUFF_FOR_CRASH_REGISTER3, misc2); 611 CRASH(); 612 } 613 614 void WTFCrashWithInfo(int, const char*, const char*, int, uint64_t reason, uint64_t misc1) 615 { 616 STUFF_REGISTER_FOR_CRASH(STUFF_FOR_CRASH_REGISTER1, reason); 617 STUFF_REGISTER_FOR_CRASH(STUFF_FOR_CRASH_REGISTER2, misc1); 618 CRASH(); 619 } 620 621 void WTFCrashWithInfo(int, const char*, const char*, int, uint64_t reason) 622 { 623 STUFF_REGISTER_FOR_CRASH(STUFF_FOR_CRASH_REGISTER1, reason); 624 CRASH(); 625 } 626 627 void WTFCrashWithInfo(int, const char*, const char*, int) 628 { 629 CRASH(); 630 } 631 632 #else 633 634 void WTFCrashWithInfo(int, const char*, const char*, int, uint64_t, uint64_t, uint64_t, uint64_t, uint64_t) { CRASH(); } 635 void WTFCrashWithInfo(int, const char*, const char*, int, uint64_t, uint64_t, uint64_t, uint64_t) { CRASH(); } 636 void WTFCrashWithInfo(int, const char*, const char*, int, uint64_t, uint64_t, uint64_t) { CRASH(); } 637 void WTFCrashWithInfo(int, const char*, const char*, int, uint64_t, uint64_t) { CRASH(); } 638 void WTFCrashWithInfo(int, const char*, const char*, int, uint64_t) { CRASH(); } 639 void WTFCrashWithInfo(int, const char*, const char*, int) { CRASH(); } 640 641 #endif // OS(DARWIN) && (CPU(X64_64) || CPU(ARM64)) 642 562 643 namespace WTF { 563 644 -
trunk/Source/WTF/wtf/Assertions.h
r219006 r219046 52 52 #endif 53 53 54 #ifdef __cplusplus 55 #include <type_traits> 56 #endif 57 54 58 #ifdef NDEBUG 55 59 /* Disable ASSERT* macros in release mode. */ … … 466 470 #endif 467 471 472 #ifdef __cplusplus 473 474 // The combination of line, file, function, and counter should be a unique number per call to this crash. This forces the compiler to not coalesce calls to WTFCrashWithInfo. 475 // The easiest way to fill these values per translation unit is to pass __LINE__, __FILE__, WTF_PRETTY_FUNCTION, and __COUNTER__. 476 WTF_EXPORT_PRIVATE NO_RETURN_DUE_TO_CRASH void WTFCrashWithInfo(int line, const char* file, const char* function, int counter, uint64_t reason, uint64_t misc1, uint64_t misc2, uint64_t misc3, uint64_t misc4); 477 WTF_EXPORT_PRIVATE NO_RETURN_DUE_TO_CRASH void WTFCrashWithInfo(int line, const char* file, const char* function, int counter, uint64_t reason, uint64_t misc1, uint64_t misc2, uint64_t misc3); 478 WTF_EXPORT_PRIVATE NO_RETURN_DUE_TO_CRASH void WTFCrashWithInfo(int line, const char* file, const char* function, int counter, uint64_t reason, uint64_t misc1, uint64_t misc2); 479 WTF_EXPORT_PRIVATE NO_RETURN_DUE_TO_CRASH void WTFCrashWithInfo(int line, const char* file, const char* function, int counter, uint64_t reason, uint64_t misc1); 480 WTF_EXPORT_PRIVATE NO_RETURN_DUE_TO_CRASH void WTFCrashWithInfo(int line, const char* file, const char* function, int counter, uint64_t reason); 481 WTF_EXPORT_PRIVATE NO_RETURN_DUE_TO_CRASH void WTFCrashWithInfo(int line, const char* file, const char* function, int counter); 482 483 484 namespace WTF { 485 inline void isIntegralType() { } 486 487 template<typename T, typename... Types> 488 void isIntegralType(T, Types... types) 489 { 490 static_assert(std::is_integral<T>::value || std::is_enum<T>::value, "All types need to be integral bitwise_cast to integral type for logging"); 491 isIntegralType(types...); 492 } 493 } 494 495 #ifndef INLINE_CRASH_WITH_SECURITY_IMPLICATION_AND_INFO 496 // This is useful if you are going to stuff data into registers before crashing. Like the crashWithInfo functions below... 497 // GCC doesn't like the ##__VA_ARGS__ here since this macro is called from another macro so we just CRASH instead there. 498 #if COMPILER(CLANG) || COMPILER(MSVC) 499 #define CRASH_WITH_SECURITY_IMPLICATION_AND_INFO(...) do { \ 500 WTF::isIntegralType(__VA_ARGS__); \ 501 WTFCrashWithInfo(__LINE__, __FILE__, WTF_PRETTY_FUNCTION, __COUNTER__, ##__VA_ARGS__); \ 502 } while (false) 503 #else 504 #define CRASH_WITH_SECURITY_IMPLICATION_AND_INFO(...) CRASH() 505 #endif 506 #endif // INLINE_CRASH_WITH_SECURITY_IMPLICATION_AND_INFO 507 508 #endif // __cplusplus 468 509 469 510 #endif /* WTF_Assertions_h */
Note: See TracChangeset
for help on using the changeset viewer.