Changeset 189130 in webkit
- Timestamp:
- Aug 28, 2015, 3:58:48 PM (10 years ago)
- Location:
- trunk/Source/JavaScriptCore
- Files:
-
- 2 added
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/CMakeLists.txt
r189124 r189130 64 64 assembler/MacroAssemblerARM.cpp 65 65 assembler/MacroAssemblerARMv7.cpp 66 assembler/MacroAssemblerPrinter.cpp 66 67 assembler/MacroAssemblerX86Common.cpp 67 68 -
trunk/Source/JavaScriptCore/ChangeLog
r189126 r189130 1 2015-08-28 Mark Lam <mark.lam@apple.com> 2 3 Refactor the JIT printer out of the AbstractMacroAssembler into MacroAssemblerPrinter. 4 https://bugs.webkit.org/show_bug.cgi?id=148595 5 6 Reviewed by Geoffrey Garen. 7 8 Why do this? 9 1. MacroAssembler::print() code (except for the prototype) need no longer be parsed 10 when compiling C++ files that don't need it. 11 2. Adding support for more printable types to MacroAssemblerPrinter::PrintArg 12 triggers recompilation of less files. 13 3. The printing code is for most the part common between all target platforms and 14 was previously duplicated by cut-and-paste to all the varieties of MacroAssemblers 15 that support the MASM_PROBE mechanism. Now, there is only one copy in 16 MacroAssemblerPrinter. 17 18 * CMakeLists.txt: 19 * JavaScriptCore.vcxproj/JavaScriptCore.vcxproj: 20 * JavaScriptCore.vcxproj/JavaScriptCore.vcxproj.filters: 21 * JavaScriptCore.xcodeproj/project.pbxproj: 22 23 * assembler/AbstractMacroAssembler.h: 24 (JSC::AbstractMacroAssembler::ProbeContext::print): Deleted. 25 - Removed this function because it is no longer useful since we have this more 26 flexible print() functionality. 27 28 (JSC::AbstractMacroAssembler::printIndent): Deleted. 29 (JSC::AbstractMacroAssembler::printCPU): Deleted. 30 (JSC::AbstractMacroAssembler::print): Deleted. 31 (JSC::AbstractMacroAssembler::PrintArg::PrintArg): Deleted. 32 (JSC::AbstractMacroAssembler::appendPrintArg): Deleted. 33 (JSC::AbstractMacroAssembler::printInternal): Deleted. 34 (JSC::AbstractMacroAssembler::printCallback): Deleted. 35 - These got moved into MacroAssemblerPrinter.cpp. 36 37 * assembler/MacroAssembler.h: 38 * assembler/MacroAssemblerARM.cpp: 39 (JSC::MacroAssemblerARM::printCPURegisters): Deleted. 40 (JSC::MacroAssemblerARM::printRegister): Deleted. 41 * assembler/MacroAssemblerARM.h: 42 * assembler/MacroAssemblerARMv7.cpp: 43 (JSC::MacroAssemblerARMv7::printCPURegisters): Deleted. 44 (JSC::MacroAssemblerARMv7::printRegister): Deleted. 45 * assembler/MacroAssemblerARMv7.h: 46 * assembler/MacroAssemblerX86Common.cpp: 47 (JSC::MacroAssemblerX86Common::printCPURegisters): Deleted. 48 (JSC::MacroAssemblerX86Common::printRegister): Deleted. 49 * assembler/MacroAssemblerX86Common.h: 50 - Deleted a whole bunch of mostly duplicated code. 51 52 * assembler/MacroAssemblerPrinter.cpp: Added. 53 (JSC::printIndent): 54 (JSC::printCPU): 55 (JSC::printCPURegisters): 56 (JSC::printRegister): 57 (JSC::MacroAssemblerPrinter::printCallback): 58 * assembler/MacroAssemblerPrinter.h: Added. 59 (JSC::MacroAssemblerPrinter::print): 60 (JSC::MacroAssemblerPrinter::PrintArg::PrintArg): 61 (JSC::MacroAssemblerPrinter::appendPrintArg): 62 (JSC::MacroAssembler::print): 63 1 64 2015-08-28 Filip Pizlo <fpizlo@apple.com> 2 65 -
trunk/Source/JavaScriptCore/JavaScriptCore.vcxproj/JavaScriptCore.vcxproj
r189124 r189130 306 306 <ClCompile Include="..\assembler\LinkBuffer.cpp" /> 307 307 <ClCompile Include="..\assembler\MacroAssembler.cpp" /> 308 <ClCompile Include="..\assembler\MacroAssemblerPrinter.cpp" /> 308 309 <ClCompile Include="..\assembler\MacroAssemblerX86Common.cpp" /> 309 310 <ClCompile Include="..\bindings\ScriptFunctionCall.cpp" /> … … 987 988 <ClInclude Include="..\assembler\LinkBuffer.h" /> 988 989 <ClInclude Include="..\assembler\MacroAssembler.h" /> 990 <ClInclude Include="..\assembler\MacroAssemblerPrinter.h" /> 989 991 <ClInclude Include="..\assembler\MacroAssemblerX86.h" /> 990 992 <ClInclude Include="..\assembler\MacroAssemblerX86Common.h" /> -
trunk/Source/JavaScriptCore/JavaScriptCore.vcxproj/JavaScriptCore.vcxproj.filters
r189124 r189130 133 133 <Filter>assembler</Filter> 134 134 </ClCompile> 135 <ClCompile Include="..\assembler\MacroAssemblerPrinter.cpp"> 136 <Filter>assembler</Filter> 137 </ClCompile> 135 138 <ClCompile Include="..\assembler\MacroAssemblerX86Common.cpp"> 136 139 <Filter>assembler</Filter> … … 1979 1982 </ClInclude> 1980 1983 <ClInclude Include="..\assembler\MacroAssembler.h"> 1984 <Filter>assembler</Filter> 1985 </ClInclude> 1986 <ClInclude Include="..\assembler\MacroAssemblerPrinter.h"> 1981 1987 <Filter>assembler</Filter> 1982 1988 </ClInclude> -
trunk/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
r189124 r189130 1752 1752 FE5932A7183C5A2600A1ECCC /* VMEntryScope.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FE5932A5183C5A2600A1ECCC /* VMEntryScope.cpp */; }; 1753 1753 FE5932A8183C5A2600A1ECCC /* VMEntryScope.h in Headers */ = {isa = PBXBuildFile; fileRef = FE5932A6183C5A2600A1ECCC /* VMEntryScope.h */; settings = {ATTRIBUTES = (Private, ); }; }; 1754 FE68C6371B90DE040042BCB3 /* MacroAssemblerPrinter.h in Headers */ = {isa = PBXBuildFile; fileRef = FE68C6361B90DDD90042BCB3 /* MacroAssemblerPrinter.h */; settings = {ATTRIBUTES = (Private, ); }; }; 1755 FE68C6381B90DE0B0042BCB3 /* MacroAssemblerPrinter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FE68C6351B90DDD90042BCB3 /* MacroAssemblerPrinter.cpp */; }; 1754 1756 FE7BA60F1A1A7CEC00F1F7B4 /* HeapVerifier.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FE7BA60D1A1A7CEC00F1F7B4 /* HeapVerifier.cpp */; }; 1755 1757 FE7BA6101A1A7CEC00F1F7B4 /* HeapVerifier.h in Headers */ = {isa = PBXBuildFile; fileRef = FE7BA60E1A1A7CEC00F1F7B4 /* HeapVerifier.h */; settings = {ATTRIBUTES = (Private, ); }; }; … … 3644 3646 FE5932A5183C5A2600A1ECCC /* VMEntryScope.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = VMEntryScope.cpp; sourceTree = "<group>"; }; 3645 3647 FE5932A6183C5A2600A1ECCC /* VMEntryScope.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VMEntryScope.h; sourceTree = "<group>"; }; 3648 FE68C6351B90DDD90042BCB3 /* MacroAssemblerPrinter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MacroAssemblerPrinter.cpp; sourceTree = "<group>"; }; 3649 FE68C6361B90DDD90042BCB3 /* MacroAssemblerPrinter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MacroAssemblerPrinter.h; sourceTree = "<group>"; }; 3646 3650 FE7BA60D1A1A7CEC00F1F7B4 /* HeapVerifier.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HeapVerifier.cpp; sourceTree = "<group>"; }; 3647 3651 FE7BA60E1A1A7CEC00F1F7B4 /* HeapVerifier.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HeapVerifier.h; sourceTree = "<group>"; }; … … 5470 5474 863B23DF0FC60E6200703AA4 /* MacroAssemblerCodeRef.h */, 5471 5475 86C568DE11A213EE0007F7F0 /* MacroAssemblerMIPS.h */, 5476 FE68C6351B90DDD90042BCB3 /* MacroAssemblerPrinter.cpp */, 5477 FE68C6361B90DDD90042BCB3 /* MacroAssemblerPrinter.h */, 5472 5478 86AE64A6135E5E1C00963012 /* MacroAssemblerSH4.h */, 5473 5479 860161E00F3A83C100F84710 /* MacroAssemblerX86.h */, … … 6140 6146 A704D90717A0BAA8006BA554 /* DFGMergeMode.h in Headers */, 6141 6147 0FB17663196B8F9E0091052A /* DFGPureValue.h in Headers */, 6148 FE68C6371B90DE040042BCB3 /* MacroAssemblerPrinter.h in Headers */, 6142 6149 0F2BDC451522801B00CD8910 /* DFGMinifiedGraph.h in Headers */, 6143 6150 0F2E892D16D02BAF009E4FD2 /* DFGMinifiedID.h in Headers */, … … 7968 7975 FE5932A7183C5A2600A1ECCC /* VMEntryScope.cpp in Sources */, 7969 7976 FED94F2E171E3E2300BE77A4 /* Watchdog.cpp in Sources */, 7977 FE68C6381B90DE0B0042BCB3 /* MacroAssemblerPrinter.cpp in Sources */, 7970 7978 7B98D1361B60CD5F0023B1A4 /* JSWASMModule.cpp in Sources */, 7971 7979 0F919D2515853CE0004A4E7D /* Watchpoint.cpp in Sources */, -
trunk/Source/JavaScriptCore/assembler/AbstractMacroAssembler.h
r181993 r189130 909 909 void* arg2; 910 910 CPUState cpu; 911 912 void print(int indentation = 0) 913 { 914 #define INDENT MacroAssemblerType::printIndent(indentation) 915 916 INDENT, dataLogF("ProbeContext %p {\n", this); 917 indentation++; 918 { 919 INDENT, dataLogF("probeFunction: %p\n", probeFunction); 920 INDENT, dataLogF("arg1: %p %llu\n", arg1, reinterpret_cast<int64_t>(arg1)); 921 INDENT, dataLogF("arg2: %p %llu\n", arg2, reinterpret_cast<int64_t>(arg2)); 922 MacroAssemblerType::printCPU(cpu, indentation); 923 } 924 indentation--; 925 INDENT, dataLog("}\n"); 926 927 #undef INDENT 928 } 929 }; 930 931 static void printIndent(int indentation) 932 { 933 for (; indentation > 0; indentation--) 934 dataLog(" "); 935 } 936 937 static void printCPU(CPUState& cpu, int indentation = 0) 938 { 939 #define INDENT printIndent(indentation) 940 941 INDENT, dataLog("cpu: {\n"); 942 MacroAssemblerType::printCPURegisters(cpu, indentation + 1); 943 INDENT, dataLog("}\n"); 944 945 #undef INDENT 946 } 947 948 // This is a marker type only used with print(). See print() below for details. 949 struct AllRegisters { }; 950 951 // Emits code which will print debugging info at runtime. The type of values that 952 // can be printed is encapsulated in the PrintArg struct below. Here are some 953 // examples: 954 // 955 // print("Hello world\n"); // Emits code to print the string. 956 // 957 // CodeBlock* cb = ...; 958 // print(cb); // Emits code to print the pointer value. 959 // 960 // RegisterID regID = ...; 961 // print(regID); // Emits code to print the register value (not the id). 962 // 963 // // Emits code to print all registers. Unlike other items, this prints 964 // // multiple lines as follows: 965 // // cpu { 966 // // eax: 0x123456789 967 // // ebx: 0x000000abc 968 // // ... 969 // // } 970 // print(AllRegisters()); 971 // 972 // // Print multiple things at once. This incurs the probe overhead only once 973 // // to print all the items. 974 // print("cb:", cb, " regID:", regID, " cpu:\n", AllRegisters()); 975 976 template<typename... Arguments> 977 void print(Arguments... args) 978 { 979 printInternal(static_cast<MacroAssemblerType*>(this), args...); 980 } 981 982 // This function will be called by printCPU() to print the contents of the 983 // target specific registers which are saved away in the CPUState struct. 984 // printCPURegisters() should make use of printIndentation() to print the 985 // registers with the appropriate amount of indentation. 986 // 987 // Note: printCPURegisters() should be implemented by the target specific 988 // MacroAssembler. This prototype is only provided here to document the 989 // interface. 990 991 static void printCPURegisters(CPUState&, int indentation = 0); 992 993 // This function will be called by print() to print the contents of a 994 // specific register (from the CPUState) in line with other items in the 995 // print stream. Hence, no indentation is needed. 996 // 997 // Note: printRegister() should be implemented by the target specific 998 // MacroAssembler. These prototypes are only provided here to document their 999 // interface. 1000 1001 static void printRegister(CPUState&, RegisterID); 1002 static void printRegister(CPUState&, FPRegisterID); 911 }; 1003 912 1004 913 // This function emits code to preserve the CPUState (e.g. registers), … … 1187 1096 private: 1188 1097 1189 #if ENABLE(MASM_PROBE)1190 1191 struct PrintArg {1192 1193 enum class Type {1194 AllRegisters,1195 RegisterID,1196 FPRegisterID,1197 ConstCharPtr,1198 ConstVoidPtr,1199 IntptrValue,1200 UintptrValue,1201 };1202 1203 PrintArg(AllRegisters&)1204 : type(Type::AllRegisters)1205 {1206 }1207 1208 PrintArg(RegisterID regID)1209 : type(Type::RegisterID)1210 {1211 u.gpRegisterID = regID;1212 }1213 1214 PrintArg(FPRegisterID regID)1215 : type(Type::FPRegisterID)1216 {1217 u.fpRegisterID = regID;1218 }1219 1220 PrintArg(const char* ptr)1221 : type(Type::ConstCharPtr)1222 {1223 u.constCharPtr = ptr;1224 }1225 1226 PrintArg(const void* ptr)1227 : type(Type::ConstVoidPtr)1228 {1229 u.constVoidPtr = ptr;1230 }1231 1232 PrintArg(int value)1233 : type(Type::IntptrValue)1234 {1235 u.intptrValue = value;1236 }1237 1238 PrintArg(unsigned value)1239 : type(Type::UintptrValue)1240 {1241 u.intptrValue = value;1242 }1243 1244 PrintArg(intptr_t value)1245 : type(Type::IntptrValue)1246 {1247 u.intptrValue = value;1248 }1249 1250 PrintArg(uintptr_t value)1251 : type(Type::UintptrValue)1252 {1253 u.uintptrValue = value;1254 }1255 1256 Type type;1257 union {1258 RegisterID gpRegisterID;1259 FPRegisterID fpRegisterID;1260 const char* constCharPtr;1261 const void* constVoidPtr;1262 intptr_t intptrValue;1263 uintptr_t uintptrValue;1264 } u;1265 };1266 1267 typedef Vector<PrintArg> PrintArgsList;1268 1269 template<typename FirstArg, typename... Arguments>1270 static void appendPrintArg(PrintArgsList* argsList, FirstArg& firstArg, Arguments... otherArgs)1271 {1272 argsList->append(PrintArg(firstArg));1273 appendPrintArg(argsList, otherArgs...);1274 }1275 1276 static void appendPrintArg(PrintArgsList*) { }1277 1278 1279 template<typename... Arguments>1280 static void printInternal(MacroAssemblerType* masm, Arguments... args)1281 {1282 auto argsList = std::make_unique<PrintArgsList>();1283 appendPrintArg(argsList.get(), args...);1284 masm->probe(printCallback, argsList.release());1285 }1286 1287 static void printCallback(ProbeContext* context)1288 {1289 typedef PrintArg Arg;1290 PrintArgsList& argsList =1291 *reinterpret_cast<PrintArgsList*>(context->arg1);1292 for (size_t i = 0; i < argsList.size(); i++) {1293 auto& arg = argsList[i];1294 switch (arg.type) {1295 case Arg::Type::AllRegisters:1296 MacroAssemblerType::printCPU(context->cpu);1297 break;1298 case Arg::Type::RegisterID:1299 MacroAssemblerType::printRegister(context->cpu, arg.u.gpRegisterID);1300 break;1301 case Arg::Type::FPRegisterID:1302 MacroAssemblerType::printRegister(context->cpu, arg.u.fpRegisterID);1303 break;1304 case Arg::Type::ConstCharPtr:1305 dataLog(arg.u.constCharPtr);1306 break;1307 case Arg::Type::ConstVoidPtr:1308 dataLogF("%p", arg.u.constVoidPtr);1309 break;1310 case Arg::Type::IntptrValue:1311 dataLog(arg.u.intptrValue);1312 break;1313 case Arg::Type::UintptrValue:1314 dataLog(arg.u.uintptrValue);1315 break;1316 }1317 }1318 }1319 1320 #endif // ENABLE(MASM_PROBE)1321 1322 1098 }; // class AbstractMacroAssembler 1323 1099 -
trunk/Source/JavaScriptCore/assembler/MacroAssembler.h
r180279 r189130 1584 1584 urshift32(src, trustedImm32ForShift(amount), dest); 1585 1585 } 1586 1587 #if ENABLE(MASM_PROBE) 1588 // Let's you print from your JIT generated code. 1589 // See comments in MacroAssemblerPrinter.h for examples of how to use this. 1590 template<typename... Arguments> 1591 void print(Arguments... args); 1592 #endif 1586 1593 }; 1587 1594 -
trunk/Source/JavaScriptCore/assembler/MacroAssemblerARM.cpp
r187819 r189130 1 1 /* 2 * Copyright (C) 2013 , 2014Apple Inc.2 * Copyright (C) 2013-2015 Apple Inc. 3 3 * Copyright (C) 2009 University of Szeged 4 4 * All rights reserved. … … 98 98 #if ENABLE(MASM_PROBE) 99 99 100 #define INDENT printIndent(indentation)101 102 void MacroAssemblerARM::printCPURegisters(CPUState& cpu, int indentation)103 {104 #define PRINT_GPREGISTER(_type, _regName) { \105 int32_t value = reinterpret_cast<int32_t>(cpu._regName); \106 INDENT, dataLogF("%5s: 0x%08x %d\n", #_regName, value, value) ; \107 }108 FOR_EACH_CPU_GPREGISTER(PRINT_GPREGISTER)109 FOR_EACH_CPU_SPECIAL_REGISTER(PRINT_GPREGISTER)110 #undef PRINT_GPREGISTER111 112 #define PRINT_FPREGISTER(_type, _regName) { \113 uint64_t* u = reinterpret_cast<uint64_t*>(&cpu._regName); \114 double* d = reinterpret_cast<double*>(&cpu._regName); \115 INDENT, dataLogF("%5s: 0x%016llx %.13g\n", #_regName, *u, *d); \116 }117 FOR_EACH_CPU_FPREGISTER(PRINT_FPREGISTER)118 #undef PRINT_FPREGISTER119 }120 121 #undef INDENT122 123 void MacroAssemblerARM::printRegister(MacroAssemblerARM::CPUState& cpu, RegisterID regID)124 {125 const char* name = CPUState::registerName(regID);126 union {127 void* voidPtr;128 intptr_t intptrValue;129 } u;130 u.voidPtr = cpu.registerValue(regID);131 dataLogF("%s:<%p %ld>", name, u.voidPtr, u.intptrValue);132 }133 134 void MacroAssemblerARM::printRegister(MacroAssemblerARM::CPUState& cpu, FPRegisterID regID)135 {136 const char* name = CPUState::registerName(regID);137 union {138 double doubleValue;139 uint64_t uint64Value;140 } u;141 u.doubleValue = cpu.registerValue(regID);142 dataLogF("%s:<0x%016llx %.13g>", name, u.uint64Value, u.doubleValue);143 }144 145 100 extern "C" void ctiMasmProbeTrampoline(); 146 101 -
trunk/Source/JavaScriptCore/assembler/MacroAssemblerARM.h
r182098 r189130 1 1 /* 2 * Copyright (C) 2008, 2013 , 2014Apple Inc.2 * Copyright (C) 2008, 2013-2015 Apple Inc. 3 3 * Copyright (C) 2009, 2010 University of Szeged 4 4 * All rights reserved. … … 1434 1434 1435 1435 #if ENABLE(MASM_PROBE) 1436 // Methods required by the MASM_PROBE mechanism as defined in1437 // AbstractMacroAssembler.h.1438 static void printCPURegisters(CPUState&, int indentation = 0);1439 static void printRegister(CPUState&, RegisterID);1440 static void printRegister(CPUState&, FPRegisterID);1441 1436 void probe(ProbeFunction, void* arg1 = 0, void* arg2 = 0); 1442 1437 #endif // ENABLE(MASM_PROBE) -
trunk/Source/JavaScriptCore/assembler/MacroAssemblerARMv7.cpp
r176233 r189130 1 1 /* 2 * Copyright (C) 2013 , 2014Apple Inc. All rights reserved.2 * Copyright (C) 2013-2015 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 33 33 #if ENABLE(MASM_PROBE) 34 34 35 #define INDENT printIndent(indentation)36 37 void MacroAssemblerARMv7::printCPURegisters(CPUState& cpu, int indentation)38 {39 #define PRINT_GPREGISTER(_type, _regName) { \40 int32_t value = reinterpret_cast<int32_t>(cpu._regName); \41 INDENT, dataLogF("%5s: 0x%08x %d\n", #_regName, value, value) ; \42 }43 FOR_EACH_CPU_GPREGISTER(PRINT_GPREGISTER)44 FOR_EACH_CPU_SPECIAL_REGISTER(PRINT_GPREGISTER)45 #undef PRINT_GPREGISTER46 47 #define PRINT_FPREGISTER(_type, _regName) { \48 uint64_t* u = reinterpret_cast<uint64_t*>(&cpu._regName); \49 double* d = reinterpret_cast<double*>(&cpu._regName); \50 INDENT, dataLogF("%5s: 0x%016llx %.13g\n", #_regName, *u, *d); \51 }52 FOR_EACH_CPU_FPREGISTER(PRINT_FPREGISTER)53 #undef PRINT_FPREGISTER54 }55 56 #undef INDENT57 58 void MacroAssemblerARMv7::printRegister(MacroAssemblerARMv7::CPUState& cpu, RegisterID regID)59 {60 const char* name = CPUState::registerName(regID);61 union {62 void* voidPtr;63 intptr_t intptrValue;64 } u;65 u.voidPtr = cpu.registerValue(regID);66 dataLogF("%s:<%p %ld>", name, u.voidPtr, u.intptrValue);67 }68 69 void MacroAssemblerARMv7::printRegister(MacroAssemblerARMv7::CPUState& cpu, FPRegisterID regID)70 {71 const char* name = CPUState::registerName(regID);72 union {73 double doubleValue;74 uint64_t uint64Value;75 } u;76 u.doubleValue = cpu.registerValue(regID);77 dataLogF("%s:<0x%016llx %.13g>", name, u.uint64Value, u.doubleValue);78 }79 80 35 extern "C" void ctiMasmProbeTrampoline(); 81 36 -
trunk/Source/JavaScriptCore/assembler/MacroAssemblerARMv7.h
r182098 r189130 1 1 /* 2 * Copyright (C) 2009 , 2010, 2014Apple Inc. All rights reserved.2 * Copyright (C) 2009-2010, 2014-2015 Apple Inc. All rights reserved. 3 3 * Copyright (C) 2010 University of Szeged 4 4 * … … 1903 1903 1904 1904 #if ENABLE(MASM_PROBE) 1905 // Methods required by the MASM_PROBE mechanism as defined in1906 // AbstractMacroAssembler.h.1907 static void printCPURegisters(CPUState&, int indentation = 0);1908 static void printRegister(CPUState&, RegisterID);1909 static void printRegister(CPUState&, FPRegisterID);1910 1905 void probe(ProbeFunction, void* arg1 = 0, void* arg2 = 0); 1911 1906 #endif // ENABLE(MASM_PROBE) -
trunk/Source/JavaScriptCore/assembler/MacroAssemblerX86Common.cpp
r176233 r189130 1 1 /* 2 * Copyright (C) 2013 , 2014Apple Inc. All rights reserved.2 * Copyright (C) 2013-2015 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 32 32 33 33 #if ENABLE(MASM_PROBE) 34 35 #define INDENT printIndent(indentation)36 37 void MacroAssemblerX86Common::printCPURegisters(MacroAssemblerX86Common::CPUState& cpu, int indentation)38 {39 #if CPU(X86)40 #define PRINT_GPREGISTER(_type, _regName) { \41 int32_t value = reinterpret_cast<int32_t>(cpu._regName); \42 INDENT, dataLogF("%6s: 0x%08x %d\n", #_regName, value, value) ; \43 }44 #elif CPU(X86_64)45 #define PRINT_GPREGISTER(_type, _regName) { \46 int64_t value = reinterpret_cast<int64_t>(cpu._regName); \47 INDENT, dataLogF("%6s: 0x%016llx %lld\n", #_regName, value, value) ; \48 }49 #endif50 FOR_EACH_CPU_GPREGISTER(PRINT_GPREGISTER)51 FOR_EACH_CPU_SPECIAL_REGISTER(PRINT_GPREGISTER)52 #undef PRINT_GPREGISTER53 54 #define PRINT_FPREGISTER(_type, _regName) { \55 uint64_t* u = reinterpret_cast<uint64_t*>(&cpu._regName); \56 double* d = reinterpret_cast<double*>(&cpu._regName); \57 INDENT, dataLogF("%6s: 0x%016llx %.13g\n", #_regName, *u, *d); \58 }59 FOR_EACH_CPU_FPREGISTER(PRINT_FPREGISTER)60 #undef PRINT_FPREGISTER61 }62 63 #undef INDENT64 65 void MacroAssemblerX86Common::printRegister(MacroAssemblerX86Common::CPUState& cpu, RegisterID regID)66 {67 const char* name = CPUState::registerName(regID);68 union {69 void* voidPtr;70 intptr_t intptrValue;71 } u;72 u.voidPtr = cpu.registerValue(regID);73 dataLogF("%s:<%p %ld>", name, u.voidPtr, u.intptrValue);74 }75 76 void MacroAssemblerX86Common::printRegister(MacroAssemblerX86Common::CPUState& cpu, FPRegisterID regID)77 {78 const char* name = CPUState::registerName(regID);79 union {80 double doubleValue;81 uint64_t uint64Value;82 } u;83 u.doubleValue = cpu.registerValue(regID);84 dataLogF("%s:<0x%016llx %.13g>", name, u.uint64Value, u.doubleValue);85 }86 34 87 35 extern "C" void ctiMasmProbeTrampoline(); -
trunk/Source/JavaScriptCore/assembler/MacroAssemblerX86Common.h
r187819 r189130 1 1 /* 2 * Copyright (C) 2008, 2014 Apple Inc. All rights reserved.2 * Copyright (C) 2008, 2014-2015 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 1492 1492 1493 1493 #if ENABLE(MASM_PROBE) 1494 // Methods required by the MASM_PROBE mechanism as defined in1495 // AbstractMacroAssembler.h.1496 static void printCPURegisters(CPUState&, int indentation = 0);1497 static void printRegister(CPUState&, RegisterID);1498 static void printRegister(CPUState&, FPRegisterID);1499 1494 void probe(ProbeFunction, void* arg1 = 0, void* arg2 = 0); 1500 1495 #endif // ENABLE(MASM_PROBE)
Note:
See TracChangeset
for help on using the changeset viewer.