Title: [212782] trunk/Source/_javascript_Core
Revision
212782
Author
[email protected]
Date
2017-02-21 17:16:42 -0800 (Tue, 21 Feb 2017)

Log Message

FullCodeOrigin for CodeBlock+CodeOrigin printing
https://bugs.webkit.org/show_bug.cgi?id=168673

Reviewed by Filip Pizlo.

WebAssembly doesn't have a CodeBlock, so printing it isn't
valid. This patch adds FullCodeOrigin to handle the
CodeBlock+CodeOrigin printing pattern, and uses it through all the
places I could find, including Repatch.cpp where it's relevant for
WebAssembly.

* CMakeLists.txt:
* _javascript_Core.xcodeproj/project.pbxproj:
* bytecode/CodeBlock.cpp:
(JSC::CodeBlock::noticeIncomingCall):
* bytecode/FullCodeOrigin.cpp: Added.
(JSC::FullCodeOrigin::dump):
(JSC::FullCodeOrigin::dumpInContext):
* bytecode/FullCodeOrigin.h: Added.
(JSC::FullCodeOrigin::FullCodeOrigin):
* bytecode/PolymorphicAccess.cpp:
(JSC::PolymorphicAccess::regenerate):
* jit/PolymorphicCallStubRoutine.cpp:
(JSC::PolymorphicCallStubRoutine::PolymorphicCallStubRoutine):
* jit/Repatch.cpp:
(JSC::linkFor):
(JSC::linkDirectFor):
(JSC::linkVirtualFor):

Modified Paths

Added Paths

Diff

Modified: trunk/Source/_javascript_Core/CMakeLists.txt (212781 => 212782)


--- trunk/Source/_javascript_Core/CMakeLists.txt	2017-02-22 01:07:10 UTC (rev 212781)
+++ trunk/Source/_javascript_Core/CMakeLists.txt	2017-02-22 01:16:42 UTC (rev 212782)
@@ -217,6 +217,7 @@
     bytecode/ExecutionCounter.cpp
     bytecode/ExitKind.cpp
     bytecode/ExitingJITType.cpp
+    bytecode/FullCodeOrigin.cpp
     bytecode/FunctionCodeBlock.cpp
     bytecode/GetByIdStatus.cpp
     bytecode/GetByIdVariant.cpp

Modified: trunk/Source/_javascript_Core/ChangeLog (212781 => 212782)


--- trunk/Source/_javascript_Core/ChangeLog	2017-02-22 01:07:10 UTC (rev 212781)
+++ trunk/Source/_javascript_Core/ChangeLog	2017-02-22 01:16:42 UTC (rev 212782)
@@ -1,3 +1,34 @@
+2017-02-21  JF Bastien  <[email protected]>
+
+        FullCodeOrigin for CodeBlock+CodeOrigin printing
+        https://bugs.webkit.org/show_bug.cgi?id=168673
+
+        Reviewed by Filip Pizlo.
+
+        WebAssembly doesn't have a CodeBlock, so printing it isn't
+        valid. This patch adds FullCodeOrigin to handle the
+        CodeBlock+CodeOrigin printing pattern, and uses it through all the
+        places I could find, including Repatch.cpp where it's relevant for
+        WebAssembly.
+
+        * CMakeLists.txt:
+        * _javascript_Core.xcodeproj/project.pbxproj:
+        * bytecode/CodeBlock.cpp:
+        (JSC::CodeBlock::noticeIncomingCall):
+        * bytecode/FullCodeOrigin.cpp: Added.
+        (JSC::FullCodeOrigin::dump):
+        (JSC::FullCodeOrigin::dumpInContext):
+        * bytecode/FullCodeOrigin.h: Added.
+        (JSC::FullCodeOrigin::FullCodeOrigin):
+        * bytecode/PolymorphicAccess.cpp:
+        (JSC::PolymorphicAccess::regenerate):
+        * jit/PolymorphicCallStubRoutine.cpp:
+        (JSC::PolymorphicCallStubRoutine::PolymorphicCallStubRoutine):
+        * jit/Repatch.cpp:
+        (JSC::linkFor):
+        (JSC::linkDirectFor):
+        (JSC::linkVirtualFor):
+
 2017-02-21  Filip Pizlo  <[email protected]>
 
         Unreviewed, fix cloop. I managed to have my local patch for relanding be the one without the cloop

Modified: trunk/Source/_javascript_Core/_javascript_Core.xcodeproj/project.pbxproj (212781 => 212782)


--- trunk/Source/_javascript_Core/_javascript_Core.xcodeproj/project.pbxproj	2017-02-22 01:07:10 UTC (rev 212781)
+++ trunk/Source/_javascript_Core/_javascript_Core.xcodeproj/project.pbxproj	2017-02-22 01:16:42 UTC (rev 212782)
@@ -2058,6 +2058,8 @@
 		AD2FCC301DB83D4900B3E736 /* JSWebAssembly.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AD2FCC2E1DB839F700B3E736 /* JSWebAssembly.cpp */; };
 		AD2FCC311DB83D4900B3E736 /* JSWebAssembly.h in Headers */ = {isa = PBXBuildFile; fileRef = AD2FCC2F1DB839F700B3E736 /* JSWebAssembly.h */; };
 		AD2FCC331DC4045400B3E736 /* WasmFormat.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AD2FCC321DC4045300B3E736 /* WasmFormat.cpp */; };
+		AD4252511E5D0E14009D2A97 /* FullCodeOrigin.h in Headers */ = {isa = PBXBuildFile; fileRef = AD4252501E5D0DEB009D2A97 /* FullCodeOrigin.h */; };
+		AD4252531E5D0F47009D2A97 /* FullCodeOrigin.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AD4252521E5D0F22009D2A97 /* FullCodeOrigin.cpp */; };
 		AD4937C31DDBE6140077C807 /* AbstractModuleRecord.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AD4937C11DDBE60A0077C807 /* AbstractModuleRecord.cpp */; };
 		AD4937C41DDBE6140077C807 /* AbstractModuleRecord.h in Headers */ = {isa = PBXBuildFile; fileRef = AD4937C21DDBE60A0077C807 /* AbstractModuleRecord.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		AD4937C71DDD0AAE0077C807 /* WebAssemblyModuleRecord.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AD4937C51DDCDCF00077C807 /* WebAssemblyModuleRecord.cpp */; };
@@ -4595,6 +4597,8 @@
 		AD2FCC2E1DB839F700B3E736 /* JSWebAssembly.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSWebAssembly.cpp; sourceTree = "<group>"; };
 		AD2FCC2F1DB839F700B3E736 /* JSWebAssembly.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSWebAssembly.h; sourceTree = "<group>"; };
 		AD2FCC321DC4045300B3E736 /* WasmFormat.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WasmFormat.cpp; sourceTree = "<group>"; };
+		AD4252501E5D0DEB009D2A97 /* FullCodeOrigin.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FullCodeOrigin.h; sourceTree = "<group>"; };
+		AD4252521E5D0F22009D2A97 /* FullCodeOrigin.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FullCodeOrigin.cpp; sourceTree = "<group>"; };
 		AD4937C11DDBE60A0077C807 /* AbstractModuleRecord.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AbstractModuleRecord.cpp; sourceTree = "<group>"; };
 		AD4937C21DDBE60A0077C807 /* AbstractModuleRecord.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AbstractModuleRecord.h; sourceTree = "<group>"; };
 		AD4937C51DDCDCF00077C807 /* WebAssemblyModuleRecord.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = WebAssemblyModuleRecord.cpp; path = js/WebAssemblyModuleRecord.cpp; sourceTree = "<group>"; };
@@ -7424,6 +7428,8 @@
 				0FB105831675480C00F8AB6E /* ExitKind.h */,
 				0F0B83AA14BCF5B900885B4F /* ExpressionRangeInfo.h */,
 				0F666EBF183566F900D017F1 /* FullBytecodeLiveness.h */,
+				AD4252521E5D0F22009D2A97 /* FullCodeOrigin.cpp */,
+				AD4252501E5D0DEB009D2A97 /* FullCodeOrigin.h */,
 				14AD91161DCA97FD0014F9FE /* FunctionCodeBlock.cpp */,
 				14AD91071DCA92940014F9FE /* FunctionCodeBlock.h */,
 				0F93329514CA7DC10085F3C6 /* GetByIdStatus.cpp */,
@@ -8914,6 +8920,7 @@
 				A700873E17CBE8D300C3E643 /* MapPrototype.h in Headers */,
 				C2B916C214DA014E00CBAC86 /* MarkedAllocator.h in Headers */,
 				0F7DF1461E2BEF6A0095951B /* MarkedAllocatorInlines.h in Headers */,
+				AD4252511E5D0E14009D2A97 /* FullCodeOrigin.h in Headers */,
 				142D6F0913539A2800B02E86 /* MarkedBlock.h in Headers */,
 				0F7C5FB81D888A0C0044F5E2 /* MarkedBlockInlines.h in Headers */,
 				141448CB13A176EC00F5BA1A /* MarkedBlockSet.h in Headers */,
@@ -10448,6 +10455,7 @@
 				0FB5467D14F5CFD6002C2989 /* MethodOfGettingAValueProfile.cpp in Sources */,
 				E3794E751B77EB97005543AE /* ModuleAnalyzer.cpp in Sources */,
 				E355F3521B7DC85300C50DC5 /* ModuleLoaderPrototype.cpp in Sources */,
+				AD4252531E5D0F47009D2A97 /* FullCodeOrigin.cpp in Sources */,
 				14AD91181DCA97FD0014F9FE /* ModuleProgramCodeBlock.cpp in Sources */,
 				147341E41DC2CE9600AA29BA /* ModuleProgramExecutable.cpp in Sources */,
 				0F1FB3901E173A6B00A9BE50 /* MutatorScheduler.cpp in Sources */,

Modified: trunk/Source/_javascript_Core/bytecode/CodeBlock.cpp (212781 => 212782)


--- trunk/Source/_javascript_Core/bytecode/CodeBlock.cpp	2017-02-22 01:07:10 UTC (rev 212781)
+++ trunk/Source/_javascript_Core/bytecode/CodeBlock.cpp	2017-02-22 01:16:42 UTC (rev 212782)
@@ -44,6 +44,7 @@
 #include "DFGWorklist.h"
 #include "Debugger.h"
 #include "EvalCodeBlock.h"
+#include "FullCodeOrigin.h"
 #include "FunctionCodeBlock.h"
 #include "FunctionExecutableDump.h"
 #include "GetPutInfo.h"
@@ -3580,7 +3581,7 @@
     }
     
     if (callerCodeBlock->capabilityLevelState() == DFG::CapabilityLevelNotSet) {
-        dataLog("In call from ", *callerCodeBlock, " ", callerFrame->codeOrigin(), " to ", *this, ": caller's DFG capability level is not set.\n");
+        dataLog("In call from ", FullCodeOrigin(callerCodeBlock, callerFrame->codeOrigin()), " to ", *this, ": caller's DFG capability level is not set.\n");
         CRASH();
     }
     

Added: trunk/Source/_javascript_Core/bytecode/FullCodeOrigin.cpp (0 => 212782)


--- trunk/Source/_javascript_Core/bytecode/FullCodeOrigin.cpp	                        (rev 0)
+++ trunk/Source/_javascript_Core/bytecode/FullCodeOrigin.cpp	2017-02-22 01:16:42 UTC (rev 212782)
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2017 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+
+#include "config.h"
+#include "FullCodeOrigin.h"
+
+namespace JSC {
+
+void FullCodeOrigin::dump(PrintStream& out) const
+{
+    if (m_codeBlock)
+        out.print(*m_codeBlock);
+    else
+        out.print("<none>");
+
+    out.print(" ", m_codeOrigin);
+}
+
+void FullCodeOrigin::dumpInContext(PrintStream& out, DumpContext*) const
+{
+    dump(out);
+}
+
+} // namespace JSC

Added: trunk/Source/_javascript_Core/bytecode/FullCodeOrigin.h (0 => 212782)


--- trunk/Source/_javascript_Core/bytecode/FullCodeOrigin.h	                        (rev 0)
+++ trunk/Source/_javascript_Core/bytecode/FullCodeOrigin.h	2017-02-22 01:16:42 UTC (rev 212782)
@@ -0,0 +1,51 @@
+/*
+ * Copyright (C) 2017 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+
+#pragma once
+
+#include "CodeBlock.h"
+#include "CodeOrigin.h"
+#include <wtf/PrintStream.h>
+
+namespace JSC {
+
+class FullCodeOrigin {
+public:
+    FullCodeOrigin(CodeBlock* codeBlock, CodeOrigin codeOrigin)
+        : m_codeBlock(codeBlock)
+        , m_codeOrigin(codeOrigin)
+    {
+    }
+    FullCodeOrigin() = delete;
+
+    JS_EXPORT_PRIVATE void dump(PrintStream&) const;
+    void dumpInContext(PrintStream&, DumpContext*) const;
+
+private:
+    CodeBlock* m_codeBlock;
+    CodeOrigin m_codeOrigin;
+};
+
+} // namespace JSC

Modified: trunk/Source/_javascript_Core/bytecode/PolymorphicAccess.cpp (212781 => 212782)


--- trunk/Source/_javascript_Core/bytecode/PolymorphicAccess.cpp	2017-02-22 01:07:10 UTC (rev 212781)
+++ trunk/Source/_javascript_Core/bytecode/PolymorphicAccess.cpp	2017-02-22 01:16:42 UTC (rev 212782)
@@ -31,6 +31,7 @@
 #include "BinarySwitch.h"
 #include "CCallHelpers.h"
 #include "CodeBlock.h"
+#include "FullCodeOrigin.h"
 #include "Heap.h"
 #include "JITOperations.h"
 #include "JSCInlines.h"
@@ -524,7 +525,7 @@
     linkBuffer.link(failure, stubInfo.slowPathStartLocation());
     
     if (verbose)
-        dataLog(*codeBlock, " ", stubInfo.codeOrigin, ": Generating polymorphic access stub for ", listDump(cases), "\n");
+        dataLog(FullCodeOrigin(codeBlock, stubInfo.codeOrigin), ": Generating polymorphic access stub for ", listDump(cases), "\n");
 
     MacroAssemblerCodeRef code = FINALIZE_CODE_FOR(
         codeBlock, linkBuffer,

Modified: trunk/Source/_javascript_Core/jit/PolymorphicCallStubRoutine.cpp (212781 => 212782)


--- trunk/Source/_javascript_Core/jit/PolymorphicCallStubRoutine.cpp	2017-02-22 01:07:10 UTC (rev 212781)
+++ trunk/Source/_javascript_Core/jit/PolymorphicCallStubRoutine.cpp	2017-02-22 01:16:42 UTC (rev 212782)
@@ -30,6 +30,7 @@
 
 #include "CallLinkInfo.h"
 #include "CodeBlock.h"
+#include "FullCodeOrigin.h"
 #include "JSCInlines.h"
 #include "LinkBuffer.h"
 
@@ -77,7 +78,7 @@
     for (PolymorphicCallCase callCase : cases) {
         m_variants.append(WriteBarrier<JSCell>(vm, owner, callCase.variant().rawCalleeCell()));
         if (shouldDumpDisassemblyFor(callerFrame->codeBlock()))
-            dataLog("Linking polymorphic call in ", *callerFrame->codeBlock(), " at ", callerFrame->codeOrigin(), " to ", callCase.variant(), ", codeBlock = ", pointerDump(callCase.codeBlock()), "\n");
+            dataLog("Linking polymorphic call in ", FullCodeOrigin(callerFrame->codeBlock(), callerFrame->codeOrigin()), " to ", callCase.variant(), ", codeBlock = ", pointerDump(callCase.codeBlock()), "\n");
         if (CodeBlock* codeBlock = callCase.codeBlock())
             codeBlock->linkIncomingPolymorphicCall(callerFrame, m_callNodes.add(&info));
     }

Modified: trunk/Source/_javascript_Core/jit/Repatch.cpp (212781 => 212782)


--- trunk/Source/_javascript_Core/jit/Repatch.cpp	2017-02-22 01:07:10 UTC (rev 212781)
+++ trunk/Source/_javascript_Core/jit/Repatch.cpp	2017-02-22 01:16:42 UTC (rev 212782)
@@ -36,6 +36,7 @@
 #include "DOMJITGetterSetter.h"
 #include "DirectArguments.h"
 #include "FTLThunks.h"
+#include "FullCodeOrigin.h"
 #include "FunctionCodeBlock.h"
 #include "GCAwareJITStubRoutine.h"
 #include "GetterSetter.h"
@@ -602,7 +603,8 @@
     callLinkInfo.setCallee(vm, owner, callee);
     callLinkInfo.setLastSeenCallee(vm, owner, callee);
     if (shouldDumpDisassemblyFor(callerCodeBlock))
-        dataLog("Linking call in ", *callerCodeBlock, " at ", callLinkInfo.codeOrigin(), " to ", pointerDump(calleeCodeBlock), ", entrypoint at ", codePtr, "\n");
+        dataLog("Linking call in ", FullCodeOrigin(callerCodeBlock, callLinkInfo.codeOrigin()), " to ", pointerDump(calleeCodeBlock), ", entrypoint at ", codePtr, "\n");
+
     MacroAssembler::repatchNearCall(callLinkInfo.hotPathOther(), CodeLocationLabel(codePtr));
 
     if (calleeCodeBlock)
@@ -629,7 +631,8 @@
     ASSERT(!callLinkInfo.isLinked());
     callLinkInfo.setCodeBlock(*vm, callerCodeBlock, jsCast<FunctionCodeBlock*>(calleeCodeBlock));
     if (shouldDumpDisassemblyFor(callerCodeBlock))
-        dataLog("Linking call in ", *callerCodeBlock, " at ", callLinkInfo.codeOrigin(), " to ", pointerDump(calleeCodeBlock), ", entrypoint at ", codePtr, "\n");
+        dataLog("Linking call in ", FullCodeOrigin(callerCodeBlock, callLinkInfo.codeOrigin()), " to ", pointerDump(calleeCodeBlock), ", entrypoint at ", codePtr, "\n");
+
     if (callLinkInfo.callType() == CallLinkInfo::DirectTailCall)
         MacroAssembler::repatchJumpToNop(callLinkInfo.patchableJump());
     MacroAssembler::repatchNearCall(callLinkInfo.hotPathOther(), CodeLocationLabel(codePtr));
@@ -684,7 +687,7 @@
     CodeBlock* callerCodeBlock = callerFrame->codeBlock();
 
     if (shouldDumpDisassemblyFor(callerCodeBlock))
-        dataLog("Linking virtual call at ", *callerCodeBlock, " ", callerFrame->codeOrigin(), "\n");
+        dataLog("Linking virtual call at ", FullCodeOrigin(callerCodeBlock, callerFrame->codeOrigin()), "\n");
 
     MacroAssemblerCodeRef virtualThunk = virtualThunkFor(&vm, callLinkInfo);
     revertCall(&vm, callLinkInfo, virtualThunk);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to