Changeset 243278 in webkit
- Timestamp:
- Mar 20, 2019, 10:43:08 PM (7 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 10 edited
-
Source/JavaScriptCore/ChangeLog (modified) (1 diff)
-
Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj (modified) (13 diffs)
-
Source/JavaScriptCore/bytecode/ArrayProfile.h (modified) (1 diff)
-
Source/JavaScriptCore/bytecode/SpeculatedType.h (modified) (1 diff)
-
Source/JavaScriptCore/dfg/DFGAbstractValue.h (modified) (4 diffs)
-
Source/JavaScriptCore/dfg/DFGJITCompiler.cpp (modified) (1 diff)
-
Source/JavaScriptCore/dfg/DFGStructureAbstractValue.h (modified) (1 diff)
-
Source/JavaScriptCore/dfg/testdfg.cpp (added)
-
Source/JavaScriptCore/shell/CMakeLists.txt (modified) (2 diffs)
-
Tools/ChangeLog (modified) (1 diff)
-
Tools/Scripts/run-javascriptcore-tests (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r243277 r243278 1 2019-03-20 Saam Barati <sbarati@apple.com> 2 3 DFG::AbstractValue::validateOSREntry is wrong when isHeapTop and the incoming value is Empty 4 https://bugs.webkit.org/show_bug.cgi?id=195721 5 6 Reviewed by Filip Pizlo. 7 8 There was a check in AbstractValue::validateOSREntry where it checked 9 if isHeapTop(), and if so, just returned true. However, this is wrong 10 if the value we're checking against is the empty value, since HeapTop 11 does not include the Empty value. Instead, this check should be 12 isBytecodeTop(), which does account for the empty value. 13 14 This patch also does a couple of other things: 15 - For our OSR entry AbstractValues, we were using HeapTop to mark 16 a dead value. That is now changed to BytecodeTop. (The idea here 17 is just to have validateOSREntry return early.) 18 - It wasn't obvious to me how I could make this fail in JS code. 19 The symptom we'd end up seeing is something like a nullptr derefernece 20 from forgetting to do a TDZ check. Instead, I've added a unit test. 21 This unit test lives in a new test file: testdfg. testdfg is similar 22 to testb3/testair/testapi. 23 24 * JavaScriptCore.xcodeproj/project.pbxproj: 25 * bytecode/SpeculatedType.h: 26 * dfg/DFGAbstractValue.h: 27 (JSC::DFG::AbstractValue::isBytecodeTop const): 28 (JSC::DFG::AbstractValue::validateOSREntryValue const): 29 * dfg/testdfg.cpp: Added. 30 (hiddenTruthBecauseNoReturnIsStupid): 31 (usage): 32 (JSC::DFG::testEmptyValueDoesNotValidateWithHeapTop): 33 (JSC::DFG::run): 34 (run): 35 (main): 36 * shell/CMakeLists.txt: 37 1 38 2019-03-20 Saam Barati <sbarati@apple.com> 2 39 -
trunk/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
r243254 r243278 60 60 ); 61 61 dependencies = ( 62 52CD0F662242F5A3004A18A5 /* PBXTargetDependency */, 62 63 7954BE0D20B63348009BC83A /* PBXTargetDependency */, 63 64 FE533CAF1F217EC60016A1FE /* PBXTargetDependency */, … … 885 886 52C0611F1AA51E1C00B4ADBA /* RuntimeType.h in Headers */ = {isa = PBXBuildFile; fileRef = 52C0611D1AA51E1B00B4ADBA /* RuntimeType.h */; settings = {ATTRIBUTES = (Private, ); }; }; 886 887 52C952B719A289850069B386 /* TypeProfiler.h in Headers */ = {isa = PBXBuildFile; fileRef = 52C952B619A289850069B386 /* TypeProfiler.h */; settings = {ATTRIBUTES = (Private, ); }; }; 888 52CD0F5D2242F569004A18A5 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 51F0EB6105C86C6B00E6DF1B /* Foundation.framework */; }; 889 52CD0F5E2242F569004A18A5 /* JavaScriptCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 932F5BD90822A1C700736975 /* JavaScriptCore.framework */; }; 890 52CD0F682242F71C004A18A5 /* testdfg.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 52CD0F672242F71C004A18A5 /* testdfg.cpp */; }; 887 891 52D13091221CE176009C836C /* foo.js in Copy Support Script */ = {isa = PBXBuildFile; fileRef = 52D1308F221CE03A009C836C /* foo.js */; }; 888 892 52F6C35E1E71EB080081F4CC /* WebAssemblyWrapperFunction.h in Headers */ = {isa = PBXBuildFile; fileRef = 52F6C35C1E71EB080081F4CC /* WebAssemblyWrapperFunction.h */; }; … … 1925 1929 remoteGlobalIDString = 65FB3F6609D11E9100F49DEB; 1926 1930 remoteInfo = "Derived Sources"; 1931 }; 1932 52CD0F652242F5A3004A18A5 /* PBXContainerItemProxy */ = { 1933 isa = PBXContainerItemProxy; 1934 containerPortal = 0867D690FE84028FC02AAC07 /* Project object */; 1935 proxyType = 1; 1936 remoteGlobalIDString = 52CD0F592242F569004A18A5; 1937 remoteInfo = testdfg; 1927 1938 }; 1928 1939 53B4BD131F68C2AA00D2BEA3 /* PBXContainerItemProxy */ = { … … 3382 3393 52C952B619A289850069B386 /* TypeProfiler.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = TypeProfiler.h; sourceTree = "<group>"; }; 3383 3394 52C952B819A28A1C0069B386 /* TypeProfiler.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = TypeProfiler.cpp; sourceTree = "<group>"; }; 3395 52CD0F642242F569004A18A5 /* testdfg */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = testdfg; sourceTree = BUILT_PRODUCTS_DIR; }; 3396 52CD0F672242F71C004A18A5 /* testdfg.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = testdfg.cpp; path = dfg/testdfg.cpp; sourceTree = "<group>"; }; 3384 3397 52D1308F221CE03A009C836C /* foo.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = foo.js; sourceTree = "<group>"; }; 3385 3398 52F6C35B1E71EB080081F4CC /* WebAssemblyWrapperFunction.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = WebAssemblyWrapperFunction.cpp; path = js/WebAssemblyWrapperFunction.cpp; sourceTree = "<group>"; }; … … 5001 5014 runOnlyForDeploymentPostprocessing = 0; 5002 5015 }; 5016 52CD0F5C2242F569004A18A5 /* Frameworks */ = { 5017 isa = PBXFrameworksBuildPhase; 5018 buildActionMask = 2147483647; 5019 files = ( 5020 52CD0F5D2242F569004A18A5 /* Foundation.framework in Frameworks */, 5021 52CD0F5E2242F569004A18A5 /* JavaScriptCore.framework in Frameworks */, 5022 ); 5023 runOnlyForDeploymentPostprocessing = 0; 5024 }; 5003 5025 651122FC14046A4C002B101D /* Frameworks */ = { 5004 5026 isa = PBXFrameworksBuildPhase; … … 5069 5091 6511230514046A4C002B101D /* testRegExp */, 5070 5092 932F5BD90822A1C700736975 /* JavaScriptCore.framework */, 5093 52CD0F642242F569004A18A5 /* testdfg */, 5071 5094 ); 5072 5095 name = Products; … … 7647 7670 0FDB2CE6174830A2007B3C1B /* DFGWorklist.h */, 7648 7671 0F1FB3951E1AF7DF00A9BE50 /* DFGWorklistInlines.h */, 7672 52CD0F672242F71C004A18A5 /* testdfg.cpp */, 7649 7673 ); 7650 7674 name = dfg; … … 10039 10063 productType = "com.apple.product-type.tool"; 10040 10064 }; 10065 52CD0F592242F569004A18A5 /* testdfg */ = { 10066 isa = PBXNativeTarget; 10067 buildConfigurationList = 52CD0F5F2242F569004A18A5 /* Build configuration list for PBXNativeTarget "testdfg" */; 10068 buildPhases = ( 10069 52CD0F5A2242F569004A18A5 /* Sources */, 10070 52CD0F5C2242F569004A18A5 /* Frameworks */, 10071 ); 10072 buildRules = ( 10073 ); 10074 dependencies = ( 10075 ); 10076 name = testdfg; 10077 productName = testapi; 10078 productReference = 52CD0F642242F569004A18A5 /* testdfg */; 10079 productType = "com.apple.product-type.tool"; 10080 }; 10041 10081 651122F714046A4C002B101D /* testRegExp */ = { 10042 10082 isa = PBXNativeTarget; … … 10185 10225 79281BBD20B62B3E002E2A60 /* testmem */, 10186 10226 5325BDBF21DFF2B100A0DEE1 /* Apply Configuration to XCFileLists */, 10227 52CD0F592242F569004A18A5 /* testdfg */, 10187 10228 ); 10188 10229 }; … … 10550 10591 files = ( 10551 10592 14BD689D215191C10050DAFF /* LLIntSettingsExtractor.cpp in Sources */, 10593 ); 10594 runOnlyForDeploymentPostprocessing = 0; 10595 }; 10596 52CD0F5A2242F569004A18A5 /* Sources */ = { 10597 isa = PBXSourcesBuildPhase; 10598 buildActionMask = 2147483647; 10599 files = ( 10600 52CD0F682242F71C004A18A5 /* testdfg.cpp in Sources */, 10552 10601 ); 10553 10602 runOnlyForDeploymentPostprocessing = 0; … … 10803 10852 targetProxy = 14D9D9D9218462B5009126C2 /* PBXContainerItemProxy */; 10804 10853 }; 10854 52CD0F662242F5A3004A18A5 /* PBXTargetDependency */ = { 10855 isa = PBXTargetDependency; 10856 target = 52CD0F592242F569004A18A5 /* testdfg */; 10857 targetProxy = 52CD0F652242F5A3004A18A5 /* PBXContainerItemProxy */; 10858 }; 10805 10859 53B4BD141F68C2AA00D2BEA3 /* PBXTargetDependency */ = { 10806 10860 isa = PBXTargetDependency; … … 11208 11262 name = Production; 11209 11263 }; 11264 52CD0F602242F569004A18A5 /* Debug */ = { 11265 isa = XCBuildConfiguration; 11266 baseConfigurationReference = BC021BF2136900C300FC5467 /* ToolExecutable.xcconfig */; 11267 buildSettings = { 11268 PRODUCT_NAME = "$(TARGET_NAME)"; 11269 }; 11270 name = Debug; 11271 }; 11272 52CD0F612242F569004A18A5 /* Release */ = { 11273 isa = XCBuildConfiguration; 11274 baseConfigurationReference = BC021BF2136900C300FC5467 /* ToolExecutable.xcconfig */; 11275 buildSettings = { 11276 PRODUCT_NAME = "$(TARGET_NAME)"; 11277 }; 11278 name = Release; 11279 }; 11280 52CD0F622242F569004A18A5 /* Profiling */ = { 11281 isa = XCBuildConfiguration; 11282 baseConfigurationReference = BC021BF2136900C300FC5467 /* ToolExecutable.xcconfig */; 11283 buildSettings = { 11284 PRODUCT_NAME = "$(TARGET_NAME)"; 11285 }; 11286 name = Profiling; 11287 }; 11288 52CD0F632242F569004A18A5 /* Production */ = { 11289 isa = XCBuildConfiguration; 11290 baseConfigurationReference = BC021BF2136900C300FC5467 /* ToolExecutable.xcconfig */; 11291 buildSettings = { 11292 PRODUCT_NAME = "$(TARGET_NAME)"; 11293 }; 11294 name = Production; 11295 }; 11210 11296 5325BDC021DFF2B200A0DEE1 /* Debug */ = { 11211 11297 isa = XCBuildConfiguration; … … 11649 11735 defaultConfigurationName = Production; 11650 11736 }; 11737 52CD0F5F2242F569004A18A5 /* Build configuration list for PBXNativeTarget "testdfg" */ = { 11738 isa = XCConfigurationList; 11739 buildConfigurations = ( 11740 52CD0F602242F569004A18A5 /* Debug */, 11741 52CD0F612242F569004A18A5 /* Release */, 11742 52CD0F622242F569004A18A5 /* Profiling */, 11743 52CD0F632242F569004A18A5 /* Production */, 11744 ); 11745 defaultConfigurationIsVisible = 0; 11746 defaultConfigurationName = Production; 11747 }; 11651 11748 5325BDC421DFF2B200A0DEE1 /* Build configuration list for PBXAggregateTarget "Apply Configuration to XCFileLists" */ = { 11652 11749 isa = XCConfigurationList; -
trunk/Source/JavaScriptCore/bytecode/ArrayProfile.h
r239951 r243278 59 59 const ArrayModes Float64ArrayMode = 1 << 29; 60 60 61 extern const ArrayModes typedArrayModes[NumberOfTypedArrayTypesExcludingDataView];61 JS_EXPORT_PRIVATE extern const ArrayModes typedArrayModes[NumberOfTypedArrayTypesExcludingDataView]; 62 62 63 63 constexpr ArrayModes asArrayModesIgnoringTypedArrays(IndexingType indexingMode) -
trunk/Source/JavaScriptCore/bytecode/SpeculatedType.h
r235106 r243278 483 483 SpeculatedType speculationFromStructure(Structure*); 484 484 SpeculatedType speculationFromCell(JSCell*); 485 SpeculatedType speculationFromValue(JSValue);485 JS_EXPORT_PRIVATE SpeculatedType speculationFromValue(JSValue); 486 486 SpeculatedType speculationFromJSType(JSType); 487 487 -
trunk/Source/JavaScriptCore/dfg/DFGAbstractValue.h
r242990 r243278 189 189 && !m_value; 190 190 } 191 192 bool isBytecodeTop() const 193 { 194 return (m_type | SpecBytecodeTop) == m_type 195 && m_structure.isTop() 196 && m_arrayModes == ALL_ARRAY_MODES 197 && !m_value; 198 } 191 199 192 200 bool valueIsTop() const … … 373 381 bool validateOSREntryValue(JSValue value, FlushFormat format) const 374 382 { 375 if (is HeapTop())383 if (isBytecodeTop()) 376 384 return true; 377 385 … … 412 420 void assertIsRegistered(Graph&) const { } 413 421 #else 414 void checkConsistency() const;422 JS_EXPORT_PRIVATE void checkConsistency() const; 415 423 void assertIsRegistered(Graph&) const; 416 424 #endif … … 537 545 538 546 #if USE(JSVALUE64) && !defined(NDEBUG) 539 void ensureCanInitializeWithZeros();547 JS_EXPORT_PRIVATE void ensureCanInitializeWithZeros(); 540 548 #endif 541 549 -
trunk/Source/JavaScriptCore/dfg/DFGJITCompiler.cpp
r241222 r243278 585 585 Node* node = basicBlock.variablesAtHead.argument(argument); 586 586 if (!node || !node->shouldGenerate()) 587 entry->m_expectedValues.argument(argument).make HeapTop();587 entry->m_expectedValues.argument(argument).makeBytecodeTop(); 588 588 } 589 589 for (size_t local = 0; local < basicBlock.variablesAtHead.numberOfLocals(); ++local) { 590 590 Node* node = basicBlock.variablesAtHead.local(local); 591 591 if (!node || !node->shouldGenerate()) 592 entry->m_expectedValues.local(local).make HeapTop();592 entry->m_expectedValues.local(local).makeBytecodeTop(); 593 593 else { 594 594 VariableAccessData* variable = node->variableAccessData(); -
trunk/Source/JavaScriptCore/dfg/DFGStructureAbstractValue.h
r228500 r243278 233 233 234 234 bool contains(RegisteredStructure) const; 235 bool contains(Structure* structure) const;235 JS_EXPORT_PRIVATE bool contains(Structure* structure) const; 236 236 237 237 bool isSubsetOf(const RegisteredStructureSet& other) const; -
trunk/Source/JavaScriptCore/shell/CMakeLists.txt
r243005 r243278 69 69 ) 70 70 71 set(TESTDFG_SOURCES 72 ../dfg/testdfg.cpp 73 ) 74 71 75 if (DEVELOPER_MODE AND NOT WIN32) 72 76 add_executable(testmasm ${TESTMASM_SOURCES}) … … 78 82 add_executable(testair ${TESTAIR_SOURCES}) 79 83 target_link_libraries(testair ${JSC_LIBRARIES}) 84 85 add_executable(testdfg ${TESTDFG_SOURCES}) 86 target_link_libraries(testdfg ${JSC_LIBRARIES}) 80 87 81 88 add_executable(testapi ${TESTAPI_SOURCES}) -
trunk/Tools/ChangeLog
r243275 r243278 1 2019-03-20 Saam Barati <sbarati@apple.com> 2 3 DFG::AbstractValue::validateOSREntry is wrong when isHeapTop and the incoming value is Empty 4 https://bugs.webkit.org/show_bug.cgi?id=195721 5 6 Reviewed by Filip Pizlo. 7 8 * Scripts/run-javascriptcore-tests: 9 1 10 2019-03-20 Simon Fraser <simon.fraser@apple.com> 2 11 -
trunk/Tools/Scripts/run-javascriptcore-tests
r237130 r243278 72 72 my $runTestAir = RUN_IF_NO_TESTS_SPECIFIED; 73 73 my $runTestB3 = RUN_IF_NO_TESTS_SPECIFIED; 74 my $runTestDFG = RUN_IF_NO_TESTS_SPECIFIED; 74 75 my $runTestAPI = RUN_IF_NO_TESTS_SPECIFIED; 75 76 my $runJSCStress = RUN_IF_NO_TESTS_SPECIFIED; … … 129 130 } 130 131 132 if ($ENV{RUN_JAVASCRIPTCORE_TESTS_TESTDFG}) { 133 if ($ENV{RUN_JAVASCRIPTCORE_TESTS_TESTDFG} eq "true") { 134 $runTestDFG = ENV_VAR_SAYS_DO_RUN; 135 } elsif ($ENV{RUN_JAVASCRIPTCORE_TESTS_TESTDFG} eq "false") { 136 $runTestDFG = ENV_VAR_SAYS_DONT_RUN; 137 } else { 138 print "Don't recognize value for RUN_JAVASCRIPTCORE_TESTS_TESTDFG environment variable: '" 139 . $ENV{RUN_JAVASCRIPTCORE_TESTS_TESTDFG} . "'. Should be set to 'true' or 'false'.\n"; 140 } 141 } 142 131 143 if ($ENV{RUN_JAVASCRIPTCORE_TESTS_TESTAPI}) { 132 144 if ($ENV{RUN_JAVASCRIPTCORE_TESTS_TESTAPI} eq "true") { … … 182 194 my $testairDefault = defaultStringForTestState($runTestAir); 183 195 my $testb3Default = defaultStringForTestState($runTestB3); 196 my $testDFGDefault = defaultStringForTestState($runTestDFG); 184 197 my $testapiDefault = defaultStringForTestState($runTestAPI); 185 198 my $jscStressDefault = defaultStringForTestState($runJSCStress); … … 199 212 --[no-]testair Only run (or don't run) testair (default: $testairDefault) 200 213 --[no-]testb3 Only run (or don't run) testb3 (default: $testb3Default) 214 --[no-]testdfg Only run (or don't run) testdfg (default: $testDFGDefault) 201 215 --[no-]testapi Only run (or don't run) testapi (default: $testapiDefault) 202 216 --[no-]jsc-stress Only run (or don't run) the JSC stress tests (default: $jscStressDefault) … … 239 253 - set RUN_JAVASCRIPTCORE_TESTS_TESTAIR to "true" or "false" (no quotes) to determine if we run testair by default. 240 254 - set RUN_JAVASCRIPTCORE_TESTS_TESTB3 to "true" or "false" (no quotes) to determine if we run testb3 by default. 255 - set RUN_JAVASCRIPTCORE_TESTS_TESTDFG to "true" or "false" (no quotes) to determine if we run testdfg by default. 241 256 - set RUN_JAVASCRIPTCORE_TESTS_TESTAPI to "true" or "false" (no quotes) to determine if we run testapi by default. 242 257 - set RUN_JAVASCRIPTCORE_TESTS_BUILD to "true" or "false" (no quotes) to set the should-we-build-before-running-tests setting. … … 258 273 'testair!' => \$runTestAir, 259 274 'testb3!' => \$runTestB3, 275 'testdfg!' => \$runTestDFG, 260 276 'testapi!' => \$runTestAPI, 261 277 'jsc-stress!' => \$runJSCStress, … … 288 304 || $runTestAir == DO_RUN 289 305 || $runTestB3 == DO_RUN 306 || $runTestDFG == DO_RUN 290 307 || $runTestAPI == DO_RUN 291 308 || $runJSCStress == DO_RUN … … 307 324 $runTestAir = enableTestOrNot($runTestAir); 308 325 $runTestB3 = enableTestOrNot($runTestB3); 326 $runTestDFG = enableTestOrNot($runTestDFG); 309 327 $runTestAPI = enableTestOrNot($runTestAPI); 310 328 $runJSCStress = enableTestOrNot($runJSCStress); … … 395 413 if ($runTestAir) { runTest("testair", "allAirTestsPassed") } 396 414 if ($runTestB3) { runTest("testb3", "allB3TestsPassed") } 415 if ($runTestDFG) { runTest("testdfg", "allDFGTestsPassed") } 397 416 if ($runTestAPI) { runTest("testapi", "allApiTestsPassed") } 398 417
Note:
See TracChangeset
for help on using the changeset viewer.