Skip to content

Commit ff265c8

Browse files
committed
fourthTier: DFG IR dumps should be easier to read
https://bugs.webkit.org/show_bug.cgi?id=119050 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. Added a DumpContext that includes support for printing an endnote that describes all structures in full, while the main flow of the dump just uses made-up names for the structures. This is helpful since Structure::dump() may print a lot. The stuff it prints is useful, but if it's all inline with the surrounding thing you're dumping (often, a node in the DFG), then you get a ridiculously long print-out. All classes that dump structures (including Structure itself) now have dumpInContext() methods that use inContext() for dumping anything that might transitively print a structure. If Structure::dumpInContext() is called with a NULL context, it just uses dump() like before. Hence you don't have to know anything about DumpContext unless you want to. inContext(*structure, context) dumps something like %B4:Array, and the endnote will have something like: %B4:Array = 0x10e91a180:[Array, {Edge:100, Normal:101, Line:102, NumPx:103, LastPx:104}, ArrayWithContiguous, Proto:0x10e99ffe0] where B4 is the inferred name that StringHashDumpContext came up with. Also shortened a bunch of other dumps, removing information that isn't so important. * JavaScriptCore.xcodeproj/project.pbxproj: * bytecode/ArrayProfile.cpp: (JSC::dumpArrayModes): * bytecode/CodeBlockHash.cpp: (JSC): (JSC::CodeBlockHash::CodeBlockHash): (JSC::CodeBlockHash::dump): * bytecode/CodeOrigin.cpp: (JSC::CodeOrigin::dumpInContext): (JSC): (JSC::InlineCallFrame::dumpInContext): (JSC::InlineCallFrame::dump): * bytecode/CodeOrigin.h: (CodeOrigin): (InlineCallFrame): * bytecode/Operands.h: (JSC::OperandValueTraits::isEmptyForDump): (Operands): (JSC::Operands::dump): (JSC): * bytecode/OperandsInlines.h: Added. (JSC): (JSC::::dumpInContext): * bytecode/StructureSet.h: (JSC::StructureSet::dumpInContext): (JSC::StructureSet::dump): (StructureSet): * dfg/DFGAbstractValue.cpp: (JSC::DFG::AbstractValue::dump): (DFG): (JSC::DFG::AbstractValue::dumpInContext): * dfg/DFGAbstractValue.h: (JSC::DFG::AbstractValue::operator!): (AbstractValue): * dfg/DFGCFAPhase.cpp: (JSC::DFG::CFAPhase::performBlockCFA): * dfg/DFGCommon.cpp: * dfg/DFGCommon.h: (JSC::DFG::NodePointerTraits::isEmptyForDump): * dfg/DFGDisassembler.cpp: (JSC::DFG::Disassembler::createDumpList): * dfg/DFGDisassembler.h: (Disassembler): * dfg/DFGFlushFormat.h: (WTF::inContext): (WTF): * dfg/DFGFlushLivenessAnalysisPhase.cpp: * dfg/DFGGraph.cpp: (JSC::DFG::Graph::dumpCodeOrigin): (JSC::DFG::Graph::dump): (JSC::DFG::Graph::dumpBlockHeader): * dfg/DFGGraph.h: (Graph): * dfg/DFGLazyJSValue.cpp: (JSC::DFG::LazyJSValue::dumpInContext): (JSC::DFG::LazyJSValue::dump): (DFG): * dfg/DFGLazyJSValue.h: (LazyJSValue): * dfg/DFGNode.h: (JSC::DFG::nodeMapDump): (WTF::inContext): (WTF): * dfg/DFGOSRExitCompiler32_64.cpp: (JSC::DFG::OSRExitCompiler::compileExit): * dfg/DFGOSRExitCompiler64.cpp: (JSC::DFG::OSRExitCompiler::compileExit): * dfg/DFGStructureAbstractValue.h: (JSC::DFG::StructureAbstractValue::dumpInContext): (JSC::DFG::StructureAbstractValue::dump): (StructureAbstractValue): * ftl/FTLExitValue.cpp: (JSC::FTL::ExitValue::dumpInContext): (JSC::FTL::ExitValue::dump): (FTL): * ftl/FTLExitValue.h: (ExitValue): * ftl/FTLLowerDFGToLLVM.cpp: * ftl/FTLValueSource.cpp: (JSC::FTL::ValueSource::dumpInContext): (FTL): * ftl/FTLValueSource.h: (ValueSource): * runtime/DumpContext.cpp: Added. (JSC): (JSC::DumpContext::DumpContext): (JSC::DumpContext::~DumpContext): (JSC::DumpContext::isEmpty): (JSC::DumpContext::dump): * runtime/DumpContext.h: Added. (JSC): (DumpContext): * runtime/JSCJSValue.cpp: (JSC::JSValue::dump): (JSC): (JSC::JSValue::dumpInContext): * runtime/JSCJSValue.h: (JSC): (JSValue): * runtime/Structure.cpp: (JSC::Structure::dumpInContext): (JSC): (JSC::Structure::dumpBrief): (JSC::Structure::dumpContextHeader): * runtime/Structure.h: (JSC): (Structure): Source/WTF: Reviewed by Mark Hahnenberg. Added support for dumping values within a context. By default, if you say print(inContext(value, context)) it calls value.dumpInContext(out, context) instead of value.dump(out). Hoisted the support for six-character hashes out of JSC::CodeBlockHash into WTF, in the form of SixCharacterHash.h. Added a helper for creating dump contexts where the inContext() dump will just use a short string hash to "name" the object being dumped, and then will print out the full dumps in an endnote to your dump. Added support for using CString as a hashtable key. * WTF.xcodeproj/project.pbxproj: * wtf/PrintStream.h: (WTF): (ValueInContext): (WTF::ValueInContext::ValueInContext): (WTF::ValueInContext::dump): (WTF::inContext): * wtf/SixCharacterHash.cpp: Added. (WTF): (WTF::sixCharacterHashStringToInteger): (WTF::integerToSixCharacterHashString): * wtf/SixCharacterHash.h: Added. (WTF): * wtf/StringHashDumpContext.h: Added. (WTF): (StringHashDumpContext): (WTF::StringHashDumpContext::StringHashDumpContext): (WTF::StringHashDumpContext::getID): (WTF::StringHashDumpContext::dumpBrief): (WTF::StringHashDumpContext::brief): (WTF::StringHashDumpContext::isEmpty): (WTF::StringHashDumpContext::dump): * wtf/text/CString.cpp: (WTF::CString::hash): (WTF): (WTF::operator<): (WTF::CStringHash::equal): * wtf/text/CString.h: (WTF::CString::CString): (CString): (WTF::CString::isHashTableDeletedValue): (WTF): (WTF::CStringHash::hash): (CStringHash): Canonical link: https://commits.webkit.org/137080@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153296 268f45cc-cd09-0410-ab3c-d52691b4dbfc
1 parent 8209b8b commit ff265c8

45 files changed

Lines changed: 898 additions & 159 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎Source/JavaScriptCore/ChangeLog‎

Lines changed: 139 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,142 @@
1+
2013-07-24 Filip Pizlo <fpizlo@apple.com>
2+
3+
fourthTier: DFG IR dumps should be easier to read
4+
https://bugs.webkit.org/show_bug.cgi?id=119050
5+
6+
Reviewed by Mark Hahnenberg.
7+
8+
Added a DumpContext that includes support for printing an endnote
9+
that describes all structures in full, while the main flow of the
10+
dump just uses made-up names for the structures. This is helpful
11+
since Structure::dump() may print a lot. The stuff it prints is
12+
useful, but if it's all inline with the surrounding thing you're
13+
dumping (often, a node in the DFG), then you get a ridiculously
14+
long print-out. All classes that dump structures (including
15+
Structure itself) now have dumpInContext() methods that use
16+
inContext() for dumping anything that might transitively print a
17+
structure. If Structure::dumpInContext() is called with a NULL
18+
context, it just uses dump() like before. Hence you don't have to
19+
know anything about DumpContext unless you want to.
20+
21+
inContext(*structure, context) dumps something like %B4:Array,
22+
and the endnote will have something like:
23+
24+
%B4:Array = 0x10e91a180:[Array, {Edge:100, Normal:101, Line:102, NumPx:103, LastPx:104}, ArrayWithContiguous, Proto:0x10e99ffe0]
25+
26+
where B4 is the inferred name that StringHashDumpContext came up
27+
with.
28+
29+
Also shortened a bunch of other dumps, removing information that
30+
isn't so important.
31+
32+
* JavaScriptCore.xcodeproj/project.pbxproj:
33+
* bytecode/ArrayProfile.cpp:
34+
(JSC::dumpArrayModes):
35+
* bytecode/CodeBlockHash.cpp:
36+
(JSC):
37+
(JSC::CodeBlockHash::CodeBlockHash):
38+
(JSC::CodeBlockHash::dump):
39+
* bytecode/CodeOrigin.cpp:
40+
(JSC::CodeOrigin::dumpInContext):
41+
(JSC):
42+
(JSC::InlineCallFrame::dumpInContext):
43+
(JSC::InlineCallFrame::dump):
44+
* bytecode/CodeOrigin.h:
45+
(CodeOrigin):
46+
(InlineCallFrame):
47+
* bytecode/Operands.h:
48+
(JSC::OperandValueTraits::isEmptyForDump):
49+
(Operands):
50+
(JSC::Operands::dump):
51+
(JSC):
52+
* bytecode/OperandsInlines.h: Added.
53+
(JSC):
54+
(JSC::::dumpInContext):
55+
* bytecode/StructureSet.h:
56+
(JSC::StructureSet::dumpInContext):
57+
(JSC::StructureSet::dump):
58+
(StructureSet):
59+
* dfg/DFGAbstractValue.cpp:
60+
(JSC::DFG::AbstractValue::dump):
61+
(DFG):
62+
(JSC::DFG::AbstractValue::dumpInContext):
63+
* dfg/DFGAbstractValue.h:
64+
(JSC::DFG::AbstractValue::operator!):
65+
(AbstractValue):
66+
* dfg/DFGCFAPhase.cpp:
67+
(JSC::DFG::CFAPhase::performBlockCFA):
68+
* dfg/DFGCommon.cpp:
69+
* dfg/DFGCommon.h:
70+
(JSC::DFG::NodePointerTraits::isEmptyForDump):
71+
* dfg/DFGDisassembler.cpp:
72+
(JSC::DFG::Disassembler::createDumpList):
73+
* dfg/DFGDisassembler.h:
74+
(Disassembler):
75+
* dfg/DFGFlushFormat.h:
76+
(WTF::inContext):
77+
(WTF):
78+
* dfg/DFGFlushLivenessAnalysisPhase.cpp:
79+
* dfg/DFGGraph.cpp:
80+
(JSC::DFG::Graph::dumpCodeOrigin):
81+
(JSC::DFG::Graph::dump):
82+
(JSC::DFG::Graph::dumpBlockHeader):
83+
* dfg/DFGGraph.h:
84+
(Graph):
85+
* dfg/DFGLazyJSValue.cpp:
86+
(JSC::DFG::LazyJSValue::dumpInContext):
87+
(JSC::DFG::LazyJSValue::dump):
88+
(DFG):
89+
* dfg/DFGLazyJSValue.h:
90+
(LazyJSValue):
91+
* dfg/DFGNode.h:
92+
(JSC::DFG::nodeMapDump):
93+
(WTF::inContext):
94+
(WTF):
95+
* dfg/DFGOSRExitCompiler32_64.cpp:
96+
(JSC::DFG::OSRExitCompiler::compileExit):
97+
* dfg/DFGOSRExitCompiler64.cpp:
98+
(JSC::DFG::OSRExitCompiler::compileExit):
99+
* dfg/DFGStructureAbstractValue.h:
100+
(JSC::DFG::StructureAbstractValue::dumpInContext):
101+
(JSC::DFG::StructureAbstractValue::dump):
102+
(StructureAbstractValue):
103+
* ftl/FTLExitValue.cpp:
104+
(JSC::FTL::ExitValue::dumpInContext):
105+
(JSC::FTL::ExitValue::dump):
106+
(FTL):
107+
* ftl/FTLExitValue.h:
108+
(ExitValue):
109+
* ftl/FTLLowerDFGToLLVM.cpp:
110+
* ftl/FTLValueSource.cpp:
111+
(JSC::FTL::ValueSource::dumpInContext):
112+
(FTL):
113+
* ftl/FTLValueSource.h:
114+
(ValueSource):
115+
* runtime/DumpContext.cpp: Added.
116+
(JSC):
117+
(JSC::DumpContext::DumpContext):
118+
(JSC::DumpContext::~DumpContext):
119+
(JSC::DumpContext::isEmpty):
120+
(JSC::DumpContext::dump):
121+
* runtime/DumpContext.h: Added.
122+
(JSC):
123+
(DumpContext):
124+
* runtime/JSCJSValue.cpp:
125+
(JSC::JSValue::dump):
126+
(JSC):
127+
(JSC::JSValue::dumpInContext):
128+
* runtime/JSCJSValue.h:
129+
(JSC):
130+
(JSValue):
131+
* runtime/Structure.cpp:
132+
(JSC::Structure::dumpInContext):
133+
(JSC):
134+
(JSC::Structure::dumpBrief):
135+
(JSC::Structure::dumpContextHeader):
136+
* runtime/Structure.h:
137+
(JSC):
138+
(Structure):
139+
1140
2013-07-22 Filip Pizlo <fpizlo@apple.com>
2141

3142
fourthTier: DFG should do a high-level LICM before going to FTL

‎Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj‎

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -735,6 +735,9 @@
735735
A1712B3B11C7B212007A5315 /* RegExpCache.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A1712B3A11C7B212007A5315 /* RegExpCache.cpp */; };
736736
A1712B3F11C7B228007A5315 /* RegExpCache.h in Headers */ = {isa = PBXBuildFile; fileRef = A1712B3E11C7B228007A5315 /* RegExpCache.h */; settings = {ATTRIBUTES = (Private, ); }; };
737737
A1712B4111C7B235007A5315 /* RegExpKey.h in Headers */ = {isa = PBXBuildFile; fileRef = A1712B4011C7B235007A5315 /* RegExpKey.h */; settings = {ATTRIBUTES = (Private, ); }; };
738+
A70447EA17A0BD4600F5898E /* OperandsInlines.h in Headers */ = {isa = PBXBuildFile; fileRef = A70447E917A0BD4600F5898E /* OperandsInlines.h */; settings = {ATTRIBUTES = (Private, ); }; };
739+
A70447ED17A0BD7000F5898E /* DumpContext.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A70447EB17A0BD7000F5898E /* DumpContext.cpp */; };
740+
A70447EE17A0BD7000F5898E /* DumpContext.h in Headers */ = {isa = PBXBuildFile; fileRef = A70447EC17A0BD7000F5898E /* DumpContext.h */; settings = {ATTRIBUTES = (Private, ); }; };
738741
A704D90317A0BAA8006BA554 /* DFGAbstractInterpreter.h in Headers */ = {isa = PBXBuildFile; fileRef = A704D8FE17A0BAA8006BA554 /* DFGAbstractInterpreter.h */; settings = {ATTRIBUTES = (Private, ); }; };
739742
A704D90417A0BAA8006BA554 /* DFGAbstractInterpreterInlines.h in Headers */ = {isa = PBXBuildFile; fileRef = A704D8FF17A0BAA8006BA554 /* DFGAbstractInterpreterInlines.h */; settings = {ATTRIBUTES = (Private, ); }; };
740743
A704D90517A0BAA8006BA554 /* DFGInPlaceAbstractState.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A704D90017A0BAA8006BA554 /* DFGInPlaceAbstractState.cpp */; };
@@ -1814,6 +1817,9 @@
18141817
A1712B3A11C7B212007A5315 /* RegExpCache.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RegExpCache.cpp; sourceTree = "<group>"; };
18151818
A1712B3E11C7B228007A5315 /* RegExpCache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RegExpCache.h; sourceTree = "<group>"; };
18161819
A1712B4011C7B235007A5315 /* RegExpKey.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RegExpKey.h; sourceTree = "<group>"; };
1820+
A70447E917A0BD4600F5898E /* OperandsInlines.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OperandsInlines.h; sourceTree = "<group>"; };
1821+
A70447EB17A0BD7000F5898E /* DumpContext.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DumpContext.cpp; sourceTree = "<group>"; };
1822+
A70447EC17A0BD7000F5898E /* DumpContext.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DumpContext.h; sourceTree = "<group>"; };
18171823
A704D8FE17A0BAA8006BA554 /* DFGAbstractInterpreter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DFGAbstractInterpreter.h; path = dfg/DFGAbstractInterpreter.h; sourceTree = "<group>"; };
18181824
A704D8FF17A0BAA8006BA554 /* DFGAbstractInterpreterInlines.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DFGAbstractInterpreterInlines.h; path = dfg/DFGAbstractInterpreterInlines.h; sourceTree = "<group>"; };
18191825
A704D90017A0BAA8006BA554 /* DFGInPlaceAbstractState.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DFGInPlaceAbstractState.cpp; path = dfg/DFGInPlaceAbstractState.cpp; sourceTree = "<group>"; };
@@ -2197,9 +2203,9 @@
21972203
034768DFFF38A50411DB9C8B /* Products */ = {
21982204
isa = PBXGroup;
21992205
children = (
2200-
0FF922CF14F46B130041A24E /* JSCLLIntOffsetsExtractor */,
22012206
932F5BD90822A1C700736975 /* JavaScriptCore.framework */,
22022207
932F5BE10822A1C700736975 /* jsc */,
2208+
0FF922CF14F46B130041A24E /* JSCLLIntOffsetsExtractor */,
22032209
141211200A48793C00480255 /* minidom */,
22042210
14BD59BF0A3E8F9000BAF59C /* testapi */,
22052211
6511230514046A4C002B101D /* testRegExp */,
@@ -2833,6 +2839,8 @@
28332839
14A1563010966365006FA260 /* DateInstanceCache.h */,
28342840
BCD203470E17135E002C7E82 /* DatePrototype.cpp */,
28352841
BCD203480E17135E002C7E82 /* DatePrototype.h */,
2842+
A70447EB17A0BD7000F5898E /* DumpContext.cpp */,
2843+
A70447EC17A0BD7000F5898E /* DumpContext.h */,
28362844
BC337BEA0E1B00CB0076918A /* Error.cpp */,
28372845
BC3046060E1F497F003232CF /* Error.h */,
28382846
BC02E9040E1839DB000F9297 /* ErrorConstructor.cpp */,
@@ -3403,6 +3411,7 @@
34033411
969A07940ED1D3AE00F1F681 /* Opcode.cpp */,
34043412
969A07950ED1D3AE00F1F681 /* Opcode.h */,
34053413
0F2BDC2B151FDE8B00CD8910 /* Operands.h */,
3414+
A70447E917A0BD4600F5898E /* OperandsInlines.h */,
34063415
0F34B14B16D43E0C001CDA5A /* PolymorphicAccessStructureList.h */,
34073416
0F9FC8BF14E1B5FB00D52AE0 /* PolymorphicPutByIdList.cpp */,
34083417
0F9FC8C014E1B5FB00D52AE0 /* PolymorphicPutByIdList.h */,
@@ -3647,6 +3656,7 @@
36473656
0FFFC96014EF90BD00C72532 /* DFGVirtualRegisterAllocationPhase.h in Headers */,
36483657
0FDB2CE8174830A2007B3C1B /* DFGWorklist.h in Headers */,
36493658
0FF42731158EBD54004CB9FF /* Disassembler.h in Headers */,
3659+
A70447EE17A0BD7000F5898E /* DumpContext.h in Headers */,
36503660
BC3046070E1F497F003232CF /* Error.h in Headers */,
36513661
BC02E90D0E1839DB000F9297 /* ErrorConstructor.h in Headers */,
36523662
BC02E98D0E183E38000F9297 /* ErrorInstance.h in Headers */,
@@ -3885,6 +3895,7 @@
38853895
E124A8F70E555775003091F1 /* OpaqueJSString.h in Headers */,
38863896
969A079B0ED1D3AE00F1F681 /* Opcode.h in Headers */,
38873897
0F2BDC2C151FDE9100CD8910 /* Operands.h in Headers */,
3898+
A70447EA17A0BD4600F5898E /* OperandsInlines.h in Headers */,
38883899
BC18C4480E16F5CD00B34460 /* Operations.h in Headers */,
38893900
0FE228ED1436AB2700196C48 /* Options.h in Headers */,
38903901
BC18C44B0E16F5CD00B34460 /* Parser.h in Headers */,
@@ -4490,6 +4501,7 @@
44904501
0FFFC95F14EF90BB00C72532 /* DFGVirtualRegisterAllocationPhase.cpp in Sources */,
44914502
0FDB2CE7174830A2007B3C1B /* DFGWorklist.cpp in Sources */,
44924503
0F9D3370165DBB90005AD387 /* Disassembler.cpp in Sources */,
4504+
A70447ED17A0BD7000F5898E /* DumpContext.cpp in Sources */,
44934505
147F39C7107EC37600427A48 /* Error.cpp in Sources */,
44944506
147F39C8107EC37600427A48 /* ErrorConstructor.cpp in Sources */,
44954507
147F39C9107EC37600427A48 /* ErrorInstance.cpp in Sources */,

‎Source/JavaScriptCore/bytecode/ArrayProfile.cpp‎

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ namespace JSC {
3535
void dumpArrayModes(PrintStream& out, ArrayModes arrayModes)
3636
{
3737
if (!arrayModes) {
38-
out.print("0:<empty>");
38+
out.print("<empty>");
3939
return;
4040
}
4141

@@ -44,34 +44,33 @@ void dumpArrayModes(PrintStream& out, ArrayModes arrayModes)
4444
return;
4545
}
4646

47-
out.print(arrayModes, ":");
48-
47+
CommaPrinter comma("|");
4948
if (arrayModes & asArrayModes(NonArray))
50-
out.print("NonArray");
49+
out.print(comma, "NonArray");
5150
if (arrayModes & asArrayModes(NonArrayWithInt32))
52-
out.print("NonArrayWithInt32");
51+
out.print(comma, "NonArrayWithInt32");
5352
if (arrayModes & asArrayModes(NonArrayWithDouble))
54-
out.print("NonArrayWithDouble");
53+
out.print(comma, "NonArrayWithDouble");
5554
if (arrayModes & asArrayModes(NonArrayWithContiguous))
56-
out.print("NonArrayWithContiguous");
55+
out.print(comma, "NonArrayWithContiguous");
5756
if (arrayModes & asArrayModes(NonArrayWithArrayStorage))
58-
out.print("NonArrayWithArrayStorage");
57+
out.print(comma, "NonArrayWithArrayStorage");
5958
if (arrayModes & asArrayModes(NonArrayWithSlowPutArrayStorage))
60-
out.print("NonArrayWithSlowPutArrayStorage");
59+
out.print(comma, "NonArrayWithSlowPutArrayStorage");
6160
if (arrayModes & asArrayModes(ArrayClass))
62-
out.print("ArrayClass");
61+
out.print(comma, "ArrayClass");
6362
if (arrayModes & asArrayModes(ArrayWithUndecided))
64-
out.print("ArrayWithUndecided");
63+
out.print(comma, "ArrayWithUndecided");
6564
if (arrayModes & asArrayModes(ArrayWithInt32))
66-
out.print("ArrayWithInt32");
65+
out.print(comma, "ArrayWithInt32");
6766
if (arrayModes & asArrayModes(ArrayWithDouble))
68-
out.print("ArrayWithDouble");
67+
out.print(comma, "ArrayWithDouble");
6968
if (arrayModes & asArrayModes(ArrayWithContiguous))
70-
out.print("ArrayWithContiguous");
69+
out.print(comma, "ArrayWithContiguous");
7170
if (arrayModes & asArrayModes(ArrayWithArrayStorage))
72-
out.print("ArrayWithArrayStorage");
71+
out.print(comma, "ArrayWithArrayStorage");
7372
if (arrayModes & asArrayModes(ArrayWithSlowPutArrayStorage))
74-
out.print("ArrayWithSlowPutArrayStorage");
73+
out.print(comma, "ArrayWithSlowPutArrayStorage");
7574
}
7675

7776
void ArrayProfile::computeUpdatedPrediction(const ConcurrentJITLocker&, CodeBlock* codeBlock)

‎Source/JavaScriptCore/bytecode/CodeBlockHash.cpp‎

Lines changed: 6 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C) 2012 Apple Inc. All rights reserved.
2+
* Copyright (C) 2012, 2013 Apple Inc. All rights reserved.
33
*
44
* Redistribution and use in source and binary forms, with or without
55
* modification, are permitted provided that the following conditions
@@ -28,30 +28,13 @@
2828

2929
#include "SourceCode.h"
3030
#include <wtf/SHA1.h>
31+
#include <wtf/SixCharacterHash.h>
3132

3233
namespace JSC {
3334

34-
#define TABLE ("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789")
35-
3635
CodeBlockHash::CodeBlockHash(const char* string)
37-
: m_hash(0)
36+
: m_hash(sixCharacterHashStringToInteger(string))
3837
{
39-
RELEASE_ASSERT(strlen(string) == 6);
40-
41-
for (unsigned i = 0; i < 6; ++i) {
42-
m_hash *= 62;
43-
unsigned c = string[i];
44-
if (c >= 'A' && c <= 'Z') {
45-
m_hash += c - 'A';
46-
continue;
47-
}
48-
if (c >= 'a' && c <= 'z') {
49-
m_hash += c - 'a' + 26;
50-
continue;
51-
}
52-
ASSERT(c >= '0' && c <= '9');
53-
m_hash += c - '0' + 26 * 2;
54-
}
5538
}
5639

5740
CodeBlockHash::CodeBlockHash(const SourceCode& sourceCode, CodeSpecializationKind kind)
@@ -71,22 +54,14 @@ CodeBlockHash::CodeBlockHash(const SourceCode& sourceCode, CodeSpecializationKin
7154

7255
void CodeBlockHash::dump(PrintStream& out) const
7356
{
74-
ASSERT(strlen(TABLE) == 62);
75-
76-
char buffer[7];
77-
unsigned accumulator = m_hash;
78-
for (unsigned i = 6; i--;) {
79-
buffer[i] = TABLE[accumulator % 62];
80-
accumulator /= 62;
81-
}
82-
buffer[6] = 0;
57+
FixedArray<char, 7> buffer = integerToSixCharacterHashString(m_hash);
8358

8459
#if !ASSERT_DISABLED
85-
CodeBlockHash recompute(buffer);
60+
CodeBlockHash recompute(buffer.data());
8661
ASSERT(recompute == *this);
8762
#endif // !ASSERT_DISABLED
8863

89-
out.print(buffer);
64+
out.print(buffer.data());
9065
}
9166

9267
} // namespace JSC

‎Source/JavaScriptCore/bytecode/CodeOrigin.cpp‎

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,11 @@ void CodeOrigin::dump(PrintStream& out) const
7474
}
7575
}
7676

77+
void CodeOrigin::dumpInContext(PrintStream& out, DumpContext*) const
78+
{
79+
dump(out);
80+
}
81+
7782
JSFunction* InlineCallFrame::calleeForCallFrame(ExecState* exec) const
7883
{
7984
if (!isClosureCall())
@@ -103,17 +108,22 @@ void InlineCallFrame::dumpBriefFunctionInformation(PrintStream& out) const
103108
out.print(inferredName(), "#", hash());
104109
}
105110

106-
void InlineCallFrame::dump(PrintStream& out) const
111+
void InlineCallFrame::dumpInContext(PrintStream& out, DumpContext* context) const
107112
{
108113
out.print(briefFunctionInformation(), ":<", RawPointer(executable.get()), ", bc#", caller.bytecodeIndex, ", ", specializationKind());
109114
if (callee)
110-
out.print(", known callee: ", JSValue(callee.get()));
115+
out.print(", known callee: ", inContext(JSValue(callee.get()), context));
111116
else
112117
out.print(", closure call");
113118
out.print(", numArgs+this = ", arguments.size());
114119
out.print(", stack >= r", stackOffset);
115120
out.print(">");
116121
}
117122

123+
void InlineCallFrame::dump(PrintStream& out) const
124+
{
125+
dumpInContext(out, 0);
126+
}
127+
118128
} // namespace JSC
119129

‎Source/JavaScriptCore/bytecode/CodeOrigin.h‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ struct CodeOrigin {
8888
Vector<CodeOrigin> inlineStack() const;
8989

9090
void dump(PrintStream&) const;
91+
void dumpInContext(PrintStream&, DumpContext*) const;
9192
};
9293

9394
struct InlineCallFrame {
@@ -113,6 +114,7 @@ struct InlineCallFrame {
113114

114115
void dumpBriefFunctionInformation(PrintStream&) const;
115116
void dump(PrintStream&) const;
117+
void dumpInContext(PrintStream&, DumpContext*) const;
116118

117119
MAKE_PRINT_METHOD(InlineCallFrame, dumpBriefFunctionInformation, briefFunctionInformation);
118120
};

0 commit comments

Comments
 (0)