Changeset 267726 in webkit
- Timestamp:
- Sep 28, 2020, 9:54:36 PM (5 years ago)
- Location:
- trunk
- Files:
-
- 21 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r267624 r267726 1 2020-09-28 Mark Lam <mark.lam@apple.com> 2 3 Add Bounds Check Elimination validation for debugging. 4 https://bugs.webkit.org/show_bug.cgi?id=217055 5 rdar://69122891 6 7 Reviewed by Keith Miller. 8 9 Added a JSC_validateBoundsCheckElimination option (with alias 10 JSC_validateBCE) that adds an AssertInBounds whenever a CheckInBounds 11 node is elided. 12 13 * dfg/DFGAbstractInterpreterInlines.h: 14 (JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects): 15 * dfg/DFGClobberize.h: 16 (JSC::DFG::clobberize): 17 * dfg/DFGDoesGC.cpp: 18 (JSC::DFG::doesGC): 19 * dfg/DFGFixupPhase.cpp: 20 (JSC::DFG::FixupPhase::fixupNode): 21 * dfg/DFGIntegerCheckCombiningPhase.cpp: 22 (JSC::DFG::IntegerCheckCombiningPhase::handleBlock): 23 * dfg/DFGIntegerRangeOptimizationPhase.cpp: 24 * dfg/DFGNodeType.h: 25 * dfg/DFGOperations.h: 26 * dfg/DFGPredictionPropagationPhase.cpp: 27 * dfg/DFGSafeToExecute.h: 28 (JSC::DFG::safeToExecute): 29 * dfg/DFGSpeculativeJIT32_64.cpp: 30 (JSC::DFG::SpeculativeJIT::compile): 31 * dfg/DFGSpeculativeJIT64.cpp: 32 (JSC::DFG::SpeculativeJIT::compile): 33 * dfg/DFGValidate.cpp: 34 * ftl/FTLCapabilities.cpp: 35 (JSC::FTL::canCompile): 36 * ftl/FTLLowerDFGToB3.cpp: 37 (JSC::FTL::DFG::LowerDFGToB3::validateAIState): 38 (JSC::FTL::DFG::LowerDFGToB3::compileNode): 39 (JSC::FTL::DFG::LowerDFGToB3::compileAssertNotEmpty): 40 (JSC::FTL::DFG::LowerDFGToB3::compileAssertInBounds): 41 * ftl/FTLOperations.cpp: 42 (JSC::FTL::operationReportBoundsCheckEliminationErrorAndCrash): 43 * ftl/FTLOperations.h: 44 * runtime/OptionsList.h: 45 1 46 2020-09-26 Yusuke Suzuki <ysuzuki@apple.com> 2 47 -
trunk/Source/JavaScriptCore/dfg/DFGAbstractInterpreterInlines.h
r267624 r267726 4015 4015 } 4016 4016 4017 case AssertInBounds: 4018 break; 4019 4017 4020 case CheckInBounds: { 4018 4021 JSValue left = forNode(node->child1()).value(); -
trunk/Source/JavaScriptCore/dfg/DFGClobberize.h
r267489 r267726 458 458 return; 459 459 460 case AssertInBounds: 460 461 case AssertNotEmpty: 461 462 write(SideState); -
trunk/Source/JavaScriptCore/dfg/DFGDoesGC.cpp
r267489 r267726 1 1 /* 2 * Copyright (C) 2014-20 19Apple Inc. All rights reserved.2 * Copyright (C) 2014-2020 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 183 183 case InvalidationPoint: 184 184 case NotifyWrite: 185 case AssertInBounds: 185 186 case CheckInBounds: 186 187 case ConstantStoragePointer: -
trunk/Source/JavaScriptCore/dfg/DFGFixupPhase.cpp
r267489 r267726 2119 2119 case CheckTierUpAtReturn: 2120 2120 case CheckTierUpAndOSREnter: 2121 case AssertInBounds: 2121 2122 case CheckInBounds: 2122 2123 case ConstantStoragePointer: -
trunk/Source/JavaScriptCore/dfg/DFGIntegerCheckCombiningPhase.cpp
r261895 r267726 1 1 /* 2 * Copyright (C) 2014-20 19Apple Inc. All rights reserved.2 * Copyright (C) 2014-2020 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 283 283 284 284 case ArrayBounds: 285 ASSERT(node->op() == CheckInBounds); 286 if (UNLIKELY(Options::validateBoundsCheckElimination())) 287 m_insertionSet.insertNode(nodeIndex, SpecNone, AssertInBounds, node->origin, node->child1(), node->child2()); 285 288 node->convertToIdentityOn(m_map[data.m_key].m_dependency); 286 289 m_changed = true; -
trunk/Source/JavaScriptCore/dfg/DFGIntegerRangeOptimizationPhase.cpp
r261895 r267726 1 1 /* 2 * Copyright (C) 2015-20 19Apple Inc. All rights reserved.2 * Copyright (C) 2015-2020 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 1336 1336 if (nonNegative && lessThanLength) { 1337 1337 executeNode(block->at(nodeIndex)); 1338 if (UNLIKELY(Options::validateBoundsCheckElimination())) 1339 m_insertionSet.insertNode(nodeIndex, SpecNone, AssertInBounds, node->origin, node->child1(), node->child2()); 1338 1340 // We just need to make sure we are a value-producing node. 1339 1341 node->convertToIdentityOn(node->child1().node()); -
trunk/Source/JavaScriptCore/dfg/DFGNodeType.h
r267489 r267726 281 281 macro(AssertNotEmpty, NodeMustGenerate) \ 282 282 macro(CheckBadValue, NodeMustGenerate) \ 283 macro(AssertInBounds, NodeMustGenerate) \ 283 284 macro(CheckInBounds, NodeMustGenerate | NodeResultJS) \ 284 285 macro(CheckIdent, NodeMustGenerate) \ -
trunk/Source/JavaScriptCore/dfg/DFGOperations.h
r267624 r267726 331 331 void JIT_OPERATION operationProcessTypeProfilerLogDFG(VM*) WTF_INTERNAL; 332 332 333 void JIT_OPERATION operationTriggerReoptimizationNow(CodeBlock* baselineCodeBlock, CodeBlock* opti imzedCodeBlock, OSRExitBase*) WTF_INTERNAL;333 void JIT_OPERATION operationTriggerReoptimizationNow(CodeBlock* baselineCodeBlock, CodeBlock* optimizedCodeBlock, OSRExitBase*) WTF_INTERNAL; 334 334 void triggerReoptimizationNow(CodeBlock* baselineCodeBlock, CodeBlock* optiimzedCodeBlock, OSRExitBase*); // This is not JIT_OPERATION. 335 335 -
trunk/Source/JavaScriptCore/dfg/DFGPredictionPropagationPhase.cpp
r267489 r267726 1 1 /* 2 * Copyright (C) 2011-20 17Apple Inc. All rights reserved.2 * Copyright (C) 2011-2020 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 1316 1316 case CheckTierUpAtReturn: 1317 1317 case CheckTierUpAndOSREnter: 1318 case AssertInBounds: 1318 1319 case CheckInBounds: 1319 1320 case ValueToInt32: -
trunk/Source/JavaScriptCore/dfg/DFGSafeToExecute.h
r267489 r267726 1 1 /* 2 * Copyright (C) 2013-20 18Apple Inc. All rights reserved.2 * Copyright (C) 2013-2020 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 282 282 case ExtractOSREntryLocal: 283 283 case ExtractCatchLocal: 284 case AssertInBounds: 284 285 case CheckInBounds: 285 286 case ConstantStoragePointer: -
trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT32_64.cpp
r267489 r267726 4246 4246 case FiatInt52: 4247 4247 case Int52Constant: 4248 case AssertInBounds: 4248 4249 case CheckInBounds: 4249 4250 case ArithIMul: -
trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT64.cpp
r267624 r267726 5671 5671 case Upsilon: 5672 5672 case ExtractOSREntryLocal: 5673 case AssertInBounds: 5673 5674 case CheckInBounds: 5674 5675 case ArithIMul: -
trunk/Source/JavaScriptCore/dfg/DFGValidate.cpp
r266101 r267726 1 1 /* 2 * Copyright (C) 2012-20 16Apple Inc. All rights reserved.2 * Copyright (C) 2012-2020 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 639 639 case Phi: 640 640 case Upsilon: 641 case AssertInBounds: 641 642 case CheckInBounds: 642 643 case PhantomNewObject: -
trunk/Source/JavaScriptCore/ftl/FTLCapabilities.cpp
r267489 r267726 1 1 /* 2 * Copyright (C) 2013-20 17Apple Inc. All rights reserved.2 * Copyright (C) 2013-2020 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 197 197 case Branch: 198 198 case LogicalNot: 199 case AssertInBounds: 199 200 case CheckInBounds: 200 201 case ConstantStoragePointer: -
trunk/Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp
r267624 r267726 591 591 continue; 592 592 593 if (node->op() == AssertInBounds) 594 continue; 593 595 if (node->op() == CheckInBounds) 594 596 continue; … … 996 998 case GetVectorLength: 997 999 compileGetVectorLength(); 1000 break; 1001 case AssertInBounds: 1002 compileAssertInBounds(); 998 1003 break; 999 1004 case CheckInBounds: … … 3714 3719 [=] (CCallHelpers& jit, const StackmapGenerationParams& params) { 3715 3720 AllowMacroScratchRegisterUsage allowScratch(jit); 3716 GPRReg input = 3721 GPRReg input = params[0].gpr(); 3717 3722 CCallHelpers::Jump done = jit.branchIfNotEmpty(input); 3718 3723 jit.breakpoint(); … … 4644 4649 } 4645 4650 } 4646 4651 4652 void compileAssertInBounds() 4653 { 4654 ASSERT(Options::validateBoundsCheckElimination()); 4655 LValue index = lowInt32(m_node->child1()); 4656 LValue bounds = lowInt32(m_node->child2()); 4657 4658 LBasicBlock outOfBoundsCase = m_out.newBlock(); 4659 LBasicBlock continuation = m_out.newBlock(); 4660 m_out.branch(m_out.below(index, bounds), usually(continuation), rarely(outOfBoundsCase)); 4661 4662 LBasicBlock lastNext = m_out.appendTo(outOfBoundsCase, continuation); 4663 vmCall(Void, operationReportBoundsCheckEliminationErrorAndCrash, 4664 m_out.constIntPtr(bitwise_cast<intptr_t>(codeBlock())), 4665 m_out.constInt32(m_node->index()), 4666 m_out.constInt32(m_node->child1()->index()), 4667 m_out.constInt32(m_node->child2()->index()), 4668 index, bounds); 4669 m_out.unreachable(); 4670 4671 m_out.appendTo(continuation, lastNext); 4672 } 4673 4647 4674 void compileCheckInBounds() 4648 4675 { -
trunk/Source/JavaScriptCore/ftl/FTLOperations.cpp
r261755 r267726 1 1 /* 2 * Copyright (C) 2014-20 19Apple Inc. All rights reserved.2 * Copyright (C) 2014-2020 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 48 48 #include "JSSetIterator.h" 49 49 #include "RegExpObject.h" 50 #include <wtf/Assertions.h> 50 51 51 52 IGNORE_WARNINGS_BEGIN("frame-address") … … 742 743 } 743 744 745 extern "C" NO_RETURN_DUE_TO_CRASH void JIT_OPERATION operationReportBoundsCheckEliminationErrorAndCrash(intptr_t codeBlockAsIntPtr, int32_t nodeIndex, int32_t child1Index, int32_t child2Index, int32_t checkedIndex, int32_t bounds) 746 { 747 CodeBlock* codeBlock = bitwise_cast<CodeBlock*>(codeBlockAsIntPtr); 748 dataLogLn("Bounds Check Eimination error found @ D@", nodeIndex, ": AssertInBounds(index D@", child1Index, ": ", checkedIndex, ", bounds D@", child2Index, " ", bounds, ") in ", codeBlock); 749 CRASH(); 750 } 751 744 752 } } // namespace JSC::FTL 745 753 -
trunk/Source/JavaScriptCore/ftl/FTLOperations.h
r259320 r267726 1 1 /* 2 * Copyright (C) 2014 Apple Inc. All rights reserved.2 * Copyright (C) 2014-2020 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 46 46 int32_t JIT_OPERATION operationTypeOfObjectAsTypeofType(JSGlobalObject*, JSCell*) WTF_INTERNAL; 47 47 48 void JIT_OPERATION operationReportBoundsCheckEliminationErrorAndCrash(intptr_t codeBlockAsIntPtr, int32_t, int32_t, int32_t, int32_t, int32_t); 49 48 50 } // extern "C" 49 51 -
trunk/Source/JavaScriptCore/runtime/OptionsList.h
r267454 r267726 385 385 v(Unsigned, unexpectedExceptionStackTraceLimit, 100, Normal, "Stack trace limit for debugging unexpected exceptions observed in the VM") \ 386 386 \ 387 v(Bool, validateDFGClobberize, false, Normal, "Emits extra validation code in the DFG/FTL for the Clobberize phase")\ 387 v(Bool, validateDFGClobberize, false, Normal, "Emits code in the DFG/FTL to validate the Clobberize phase")\ 388 v(Bool, validateBoundsCheckElimination, false, Normal, "Emits code in the DFG/FTL to validate bounds check elimination")\ 388 389 \ 389 390 v(Bool, useExecutableAllocationFuzz, false, Normal, nullptr) \ … … 560 561 v(maximumFunctionForConstructInlineCandidateInstructionCount, maximumFunctionForConstructInlineCandidateBytecoodeCost, SameOption) \ 561 562 v(maximumFTLCandidateInstructionCount, maximumFTLCandidateBytecodeCost, SameOption) \ 562 v(maximumInliningCallerSize, maximumInliningCallerBytecodeCost, SameOption) 563 v(maximumInliningCallerSize, maximumInliningCallerBytecodeCost, SameOption) \ 564 v(validateBCE, validateBoundsCheckElimination, SameOption) 563 565 564 566 enum ExperimentalOptionFlags { -
trunk/Tools/ChangeLog
r267712 r267726 1 2020-09-28 Mark Lam <mark.lam@apple.com> 2 3 Add Bounds Check Elimination validation for debugging. 4 https://bugs.webkit.org/show_bug.cgi?id=217055 5 rdar://69122891 6 7 Reviewed by Keith Miller. 8 9 Added --validateBCE=true to ftl-no-cjit-validate-sampling-profiler 10 and ftl-eager-no-cjit. 11 12 * Scripts/run-jsc-stress-tests: 13 1 14 2020-09-28 Matt Lewis <jlewis3@apple.com> 2 15 -
trunk/Tools/Scripts/run-jsc-stress-tests
r267330 r267726 1 1 #!/usr/bin/env ruby 2 2 3 # Copyright (C) 2013-20 16Apple Inc. All rights reserved.3 # Copyright (C) 2013-2020 Apple Inc. All rights reserved. 4 4 # 5 5 # Redistribution and use in source and binary forms, with or without … … 755 755 756 756 def runFTLNoCJITValidate(*optionalTestSpecificOptions) 757 run("ftl-no-cjit-validate-sampling-profiler", "--validateGraph=true", "-- useSamplingProfiler=true", "--airForceIRCAllocator=true", *(FTL_OPTIONS + NO_CJIT_OPTIONS + optionalTestSpecificOptions))757 run("ftl-no-cjit-validate-sampling-profiler", "--validateGraph=true", "--validateBCE=true", "--useSamplingProfiler=true", "--airForceIRCAllocator=true", *(FTL_OPTIONS + NO_CJIT_OPTIONS + optionalTestSpecificOptions)) 758 758 end 759 759 … … 788 788 789 789 def runFTLEagerNoCJITValidate(*optionalTestSpecificOptions) 790 run("ftl-eager-no-cjit", "--validateGraph=true", "-- airForceIRCAllocator=true", *(FTL_OPTIONS + NO_CJIT_OPTIONS + EAGER_OPTIONS + COLLECT_CONTINUOUSLY_OPTIONS + FORCE_LLINT_EXIT_OPTIONS + optionalTestSpecificOptions))790 run("ftl-eager-no-cjit", "--validateGraph=true", "--validateBCE=true", "--airForceIRCAllocator=true", *(FTL_OPTIONS + NO_CJIT_OPTIONS + EAGER_OPTIONS + COLLECT_CONTINUOUSLY_OPTIONS + FORCE_LLINT_EXIT_OPTIONS + optionalTestSpecificOptions)) 791 791 end 792 792
Note:
See TracChangeset
for help on using the changeset viewer.