Changeset 215747 in webkit
- Timestamp:
- Apr 25, 2017, 11:42:33 AM (8 years ago)
- Location:
- trunk/Source/JavaScriptCore
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r215743 r215747 1 2017-04-25 Mark Lam <mark.lam@apple.com> 2 3 Make DFG SpeculatedType dumps easier to read. 4 https://bugs.webkit.org/show_bug.cgi?id=171280 5 6 Reviewed by Saam Barati. 7 8 Adding a pretty printer to insert |s between each type string and changing the 9 dumped strings to match the SpeculatedType names case-wise. 10 11 * bytecode/SpeculatedType.cpp: 12 (JSC::PrettyPrinter::PrettyPrinter): 13 (JSC::PrettyPrinter::print): 14 (JSC::dumpSpeculation): 15 * bytecode/SpeculatedType.h: 16 1 17 2017-04-25 JF Bastien <jfbastien@apple.com> 2 18 -
trunk/Source/JavaScriptCore/bytecode/SpeculatedType.cpp
r211247 r215747 1 1 /* 2 * Copyright (C) 2011-201 3, 2015-2016Apple Inc. All rights reserved.2 * Copyright (C) 2011-2017 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 45 45 namespace JSC { 46 46 47 void dumpSpeculation(PrintStream& out, SpeculatedType value) 48 { 47 struct PrettyPrinter { 48 PrettyPrinter(PrintStream& out) 49 : out(out) 50 , separator("|") 51 { } 52 53 template<typename T> 54 void print(const T& value) 55 { 56 out.print(separator, value); 57 } 58 59 PrintStream& out; 60 CommaPrinter separator; 61 }; 62 63 void dumpSpeculation(PrintStream& outStream, SpeculatedType value) 64 { 65 StringPrintStream strStream; 66 PrettyPrinter out(outStream); 67 PrettyPrinter strOut(strStream); 68 49 69 if (value == SpecNone) { 50 70 out.print("None"); … … 52 72 } 53 73 54 StringPrintStream myOut;55 56 74 bool isTop = true; 57 75 58 76 if ((value & SpecCell) == SpecCell) 59 myOut.print("Cell");77 strOut.print("Cell"); 60 78 else { 61 79 if ((value & SpecObject) == SpecObject) 62 myOut.print("Object");80 strOut.print("Object"); 63 81 else { 64 82 if (value & SpecCellOther) 65 myOut.print("Othercell");83 strOut.print("OtherCell"); 66 84 else 67 85 isTop = false; 68 86 69 87 if (value & SpecObjectOther) 70 myOut.print("Otherobj");88 strOut.print("OtherObj"); 71 89 else 72 90 isTop = false; 73 91 74 92 if (value & SpecFinalObject) 75 myOut.print("Final");93 strOut.print("Final"); 76 94 else 77 95 isTop = false; 78 96 79 97 if (value & SpecArray) 80 myOut.print("Array");98 strOut.print("Array"); 81 99 else 82 100 isTop = false; 83 101 84 102 if (value & SpecInt8Array) 85 myOut.print("Int8array");103 strOut.print("Int8Array"); 86 104 else 87 105 isTop = false; 88 106 89 107 if (value & SpecInt16Array) 90 myOut.print("Int16array");108 strOut.print("Int16Array"); 91 109 else 92 110 isTop = false; 93 111 94 112 if (value & SpecInt32Array) 95 myOut.print("Int32array");113 strOut.print("Int32Array"); 96 114 else 97 115 isTop = false; 98 116 99 117 if (value & SpecUint8Array) 100 myOut.print("Uint8array");118 strOut.print("Uint8Array"); 101 119 else 102 120 isTop = false; 103 121 104 122 if (value & SpecUint8ClampedArray) 105 myOut.print("Uint8clampedarray");123 strOut.print("Uint8ClampedArray"); 106 124 else 107 125 isTop = false; 108 126 109 127 if (value & SpecUint16Array) 110 myOut.print("Uint16array");128 strOut.print("Uint16Array"); 111 129 else 112 130 isTop = false; 113 131 114 132 if (value & SpecUint32Array) 115 myOut.print("Uint32array");133 strOut.print("Uint32Array"); 116 134 else 117 135 isTop = false; 118 136 119 137 if (value & SpecFloat32Array) 120 myOut.print("Float32array");138 strOut.print("Float32array"); 121 139 else 122 140 isTop = false; 123 141 124 142 if (value & SpecFloat64Array) 125 myOut.print("Float64array");143 strOut.print("Float64Array"); 126 144 else 127 145 isTop = false; 128 146 129 147 if (value & SpecFunction) 130 myOut.print("Function");148 strOut.print("Function"); 131 149 else 132 150 isTop = false; 133 151 134 152 if (value & SpecDirectArguments) 135 myOut.print("Directarguments");153 strOut.print("DirectArguments"); 136 154 else 137 155 isTop = false; 138 156 139 157 if (value & SpecScopedArguments) 140 myOut.print("Scopedarguments");158 strOut.print("ScopedArguments"); 141 159 else 142 160 isTop = false; 143 161 144 162 if (value & SpecStringObject) 145 myOut.print("Stringobject");163 strOut.print("StringObject"); 146 164 else 147 165 isTop = false; 148 166 149 167 if (value & SpecRegExpObject) 150 myOut.print("Regexpobject");168 strOut.print("RegExpObject"); 151 169 else 152 170 isTop = false; 153 171 154 172 if (value & SpecMapObject) 155 myOut.print("Mapobject");173 strOut.print("MapObject"); 156 174 else 157 175 isTop = false; 158 176 159 177 if (value & SpecSetObject) 160 myOut.print("Setobject");178 strOut.print("SetObject"); 161 179 else 162 180 isTop = false; 163 181 164 182 if (value & SpecProxyObject) 165 myOut.print("Proxyobject");183 strOut.print("ProxyObject"); 166 184 else 167 185 isTop = false; 168 186 169 187 if (value & SpecDerivedArray) 170 myOut.print("Derivedarray");188 strOut.print("DerivedArray"); 171 189 else 172 190 isTop = false; … … 174 192 175 193 if ((value & SpecString) == SpecString) 176 myOut.print("String");194 strOut.print("String"); 177 195 else { 178 196 if (value & SpecStringIdent) 179 myOut.print("Stringident");197 strOut.print("StringIdent"); 180 198 else 181 199 isTop = false; 182 200 183 201 if (value & SpecStringVar) 184 myOut.print("Stringvar");202 strOut.print("StringVar"); 185 203 else 186 204 isTop = false; … … 188 206 189 207 if (value & SpecSymbol) 190 myOut.print("Symbol");208 strOut.print("Symbol"); 191 209 else 192 210 isTop = false; … … 194 212 195 213 if (value == SpecInt32Only) 196 myOut.print("Int32");214 strOut.print("Int32"); 197 215 else { 198 216 if (value & SpecBoolInt32) 199 myOut.print("Boolint32");217 strOut.print("BoolInt32"); 200 218 else 201 219 isTop = false; 202 220 203 221 if (value & SpecNonBoolInt32) 204 myOut.print("Nonboolint32");222 strOut.print("NonBoolInt32"); 205 223 else 206 224 isTop = false; … … 208 226 209 227 if (value & SpecInt52Only) 210 myOut.print("Int52");228 strOut.print("Int52"); 211 229 212 230 if ((value & SpecBytecodeDouble) == SpecBytecodeDouble) 213 myOut.print("Bytecodedouble");231 strOut.print("BytecodeDouble"); 214 232 else { 215 233 if (value & SpecAnyIntAsDouble) 216 myOut.print("AnyIntAsDouble");234 strOut.print("AnyIntAsDouble"); 217 235 else 218 236 isTop = false; 219 237 220 238 if (value & SpecNonIntAsDouble) 221 myOut.print("Nonintasdouble");239 strOut.print("NonIntAsdouble"); 222 240 else 223 241 isTop = false; 224 242 225 243 if (value & SpecDoublePureNaN) 226 myOut.print("Doublepurenan");244 strOut.print("DoublePureNan"); 227 245 else 228 246 isTop = false; … … 230 248 231 249 if (value & SpecDoubleImpureNaN) 232 out.print("Double impurenan");250 out.print("DoubleImpureNan"); 233 251 234 252 if (value & SpecBoolean) 235 myOut.print("Bool");253 strOut.print("Bool"); 236 254 else 237 255 isTop = false; 238 256 239 257 if (value & SpecOther) 240 myOut.print("Other");258 strOut.print("Other"); 241 259 else 242 260 isTop = false; … … 245 263 out.print("Top"); 246 264 else 247 out.print( myOut.toCString());265 out.print(strStream.toCString()); 248 266 249 267 if (value & SpecEmpty) -
trunk/Source/JavaScriptCore/bytecode/SpeculatedType.h
r208320 r215747 1 1 /* 2 * Copyright (C) 2011-201 6Apple Inc. All rights reserved.2 * Copyright (C) 2011-2017 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 76 76 static const SpeculatedType SpecNonIntAsDouble = 1ull << 29; // It's definitely not an Int52 but it's a real number and it's a double. 77 77 static const SpeculatedType SpecDoubleReal = SpecNonIntAsDouble | SpecAnyIntAsDouble; // It's definitely a non-NaN double. 78 static const SpeculatedType SpecDoublePureNaN = 1ull << 30; // It's definitely a NaN that is sa e to tag (i.e. pure).78 static const SpeculatedType SpecDoublePureNaN = 1ull << 30; // It's definitely a NaN that is safe to tag (i.e. pure). 79 79 static const SpeculatedType SpecDoubleImpureNaN = 1ull << 31; // It's definitely a NaN that is unsafe to tag (i.e. impure). 80 80 static const SpeculatedType SpecDoubleNaN = SpecDoublePureNaN | SpecDoubleImpureNaN; // It's definitely some kind of NaN.
Note:
See TracChangeset
for help on using the changeset viewer.