Changeset 189130 in webkit


Ignore:
Timestamp:
Aug 28, 2015, 3:58:48 PM (10 years ago)
Author:
mark.lam@apple.com
Message:

Refactor the JIT printer out of the AbstractMacroAssembler into MacroAssemblerPrinter.
https://bugs.webkit.org/show_bug.cgi?id=148595

Reviewed by Geoffrey Garen.

Why do this?

  1. MacroAssembler::print() code (except for the prototype) need no longer be parsed when compiling C++ files that don't need it.
  2. Adding support for more printable types to MacroAssemblerPrinter::PrintArg triggers recompilation of less files.
  3. The printing code is for most the part common between all target platforms and was previously duplicated by cut-and-paste to all the varieties of MacroAssemblers that support the MASM_PROBE mechanism. Now, there is only one copy in MacroAssemblerPrinter.
  • assembler/AbstractMacroAssembler.h:

(JSC::AbstractMacroAssembler::ProbeContext::print): Deleted.

  • Removed this function because it is no longer useful since we have this more flexible print() functionality.

(JSC::AbstractMacroAssembler::printIndent): Deleted.
(JSC::AbstractMacroAssembler::printCPU): Deleted.
(JSC::AbstractMacroAssembler::print): Deleted.
(JSC::AbstractMacroAssembler::PrintArg::PrintArg): Deleted.
(JSC::AbstractMacroAssembler::appendPrintArg): Deleted.
(JSC::AbstractMacroAssembler::printInternal): Deleted.
(JSC::AbstractMacroAssembler::printCallback): Deleted.

  • These got moved into MacroAssemblerPrinter.cpp.
  • assembler/MacroAssembler.h:
  • assembler/MacroAssemblerARM.cpp:

(JSC::MacroAssemblerARM::printCPURegisters): Deleted.
(JSC::MacroAssemblerARM::printRegister): Deleted.

  • assembler/MacroAssemblerARM.h:
  • assembler/MacroAssemblerARMv7.cpp:

(JSC::MacroAssemblerARMv7::printCPURegisters): Deleted.
(JSC::MacroAssemblerARMv7::printRegister): Deleted.

  • assembler/MacroAssemblerARMv7.h:
  • assembler/MacroAssemblerX86Common.cpp:

(JSC::MacroAssemblerX86Common::printCPURegisters): Deleted.
(JSC::MacroAssemblerX86Common::printRegister): Deleted.

  • assembler/MacroAssemblerX86Common.h:
  • Deleted a whole bunch of mostly duplicated code.
  • assembler/MacroAssemblerPrinter.cpp: Added.

(JSC::printIndent):
(JSC::printCPU):
(JSC::printCPURegisters):
(JSC::printRegister):
(JSC::MacroAssemblerPrinter::printCallback):

  • assembler/MacroAssemblerPrinter.h: Added.

(JSC::MacroAssemblerPrinter::print):
(JSC::MacroAssemblerPrinter::PrintArg::PrintArg):
(JSC::MacroAssemblerPrinter::appendPrintArg):
(JSC::MacroAssembler::print):

Location:
trunk/Source/JavaScriptCore
Files:
2 added
13 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/CMakeLists.txt

    r189124 r189130  
    6464    assembler/MacroAssemblerARM.cpp
    6565    assembler/MacroAssemblerARMv7.cpp
     66    assembler/MacroAssemblerPrinter.cpp
    6667    assembler/MacroAssemblerX86Common.cpp
    6768
  • trunk/Source/JavaScriptCore/ChangeLog

    r189126 r189130  
     12015-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
    1642015-08-28  Filip Pizlo  <fpizlo@apple.com>
    265
  • trunk/Source/JavaScriptCore/JavaScriptCore.vcxproj/JavaScriptCore.vcxproj

    r189124 r189130  
    306306    <ClCompile Include="..\assembler\LinkBuffer.cpp" />
    307307    <ClCompile Include="..\assembler\MacroAssembler.cpp" />
     308    <ClCompile Include="..\assembler\MacroAssemblerPrinter.cpp" />
    308309    <ClCompile Include="..\assembler\MacroAssemblerX86Common.cpp" />
    309310    <ClCompile Include="..\bindings\ScriptFunctionCall.cpp" />
     
    987988    <ClInclude Include="..\assembler\LinkBuffer.h" />
    988989    <ClInclude Include="..\assembler\MacroAssembler.h" />
     990    <ClInclude Include="..\assembler\MacroAssemblerPrinter.h" />
    989991    <ClInclude Include="..\assembler\MacroAssemblerX86.h" />
    990992    <ClInclude Include="..\assembler\MacroAssemblerX86Common.h" />
  • trunk/Source/JavaScriptCore/JavaScriptCore.vcxproj/JavaScriptCore.vcxproj.filters

    r189124 r189130  
    133133      <Filter>assembler</Filter>
    134134    </ClCompile>
     135    <ClCompile Include="..\assembler\MacroAssemblerPrinter.cpp">
     136      <Filter>assembler</Filter>
     137    </ClCompile>
    135138    <ClCompile Include="..\assembler\MacroAssemblerX86Common.cpp">
    136139      <Filter>assembler</Filter>
     
    19791982    </ClInclude>
    19801983    <ClInclude Include="..\assembler\MacroAssembler.h">
     1984      <Filter>assembler</Filter>
     1985    </ClInclude>
     1986    <ClInclude Include="..\assembler\MacroAssemblerPrinter.h">
    19811987      <Filter>assembler</Filter>
    19821988    </ClInclude>
  • trunk/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj

    r189124 r189130  
    17521752                FE5932A7183C5A2600A1ECCC /* VMEntryScope.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FE5932A5183C5A2600A1ECCC /* VMEntryScope.cpp */; };
    17531753                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 */; };
    17541756                FE7BA60F1A1A7CEC00F1F7B4 /* HeapVerifier.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FE7BA60D1A1A7CEC00F1F7B4 /* HeapVerifier.cpp */; };
    17551757                FE7BA6101A1A7CEC00F1F7B4 /* HeapVerifier.h in Headers */ = {isa = PBXBuildFile; fileRef = FE7BA60E1A1A7CEC00F1F7B4 /* HeapVerifier.h */; settings = {ATTRIBUTES = (Private, ); }; };
     
    36443646                FE5932A5183C5A2600A1ECCC /* VMEntryScope.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = VMEntryScope.cpp; sourceTree = "<group>"; };
    36453647                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>"; };
    36463650                FE7BA60D1A1A7CEC00F1F7B4 /* HeapVerifier.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HeapVerifier.cpp; sourceTree = "<group>"; };
    36473651                FE7BA60E1A1A7CEC00F1F7B4 /* HeapVerifier.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HeapVerifier.h; sourceTree = "<group>"; };
     
    54705474                                863B23DF0FC60E6200703AA4 /* MacroAssemblerCodeRef.h */,
    54715475                                86C568DE11A213EE0007F7F0 /* MacroAssemblerMIPS.h */,
     5476                                FE68C6351B90DDD90042BCB3 /* MacroAssemblerPrinter.cpp */,
     5477                                FE68C6361B90DDD90042BCB3 /* MacroAssemblerPrinter.h */,
    54725478                                86AE64A6135E5E1C00963012 /* MacroAssemblerSH4.h */,
    54735479                                860161E00F3A83C100F84710 /* MacroAssemblerX86.h */,
     
    61406146                                A704D90717A0BAA8006BA554 /* DFGMergeMode.h in Headers */,
    61416147                                0FB17663196B8F9E0091052A /* DFGPureValue.h in Headers */,
     6148                                FE68C6371B90DE040042BCB3 /* MacroAssemblerPrinter.h in Headers */,
    61426149                                0F2BDC451522801B00CD8910 /* DFGMinifiedGraph.h in Headers */,
    61436150                                0F2E892D16D02BAF009E4FD2 /* DFGMinifiedID.h in Headers */,
     
    79687975                                FE5932A7183C5A2600A1ECCC /* VMEntryScope.cpp in Sources */,
    79697976                                FED94F2E171E3E2300BE77A4 /* Watchdog.cpp in Sources */,
     7977                                FE68C6381B90DE0B0042BCB3 /* MacroAssemblerPrinter.cpp in Sources */,
    79707978                                7B98D1361B60CD5F0023B1A4 /* JSWASMModule.cpp in Sources */,
    79717979                                0F919D2515853CE0004A4E7D /* Watchpoint.cpp in Sources */,
  • trunk/Source/JavaScriptCore/assembler/AbstractMacroAssembler.h

    r181993 r189130  
    909909        void* arg2;
    910910        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    };
    1003912
    1004913    // This function emits code to preserve the CPUState (e.g. registers),
     
    11871096private:
    11881097
    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 
    13221098}; // class AbstractMacroAssembler
    13231099
  • trunk/Source/JavaScriptCore/assembler/MacroAssembler.h

    r180279 r189130  
    15841584        urshift32(src, trustedImm32ForShift(amount), dest);
    15851585    }
     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
    15861593};
    15871594
  • trunk/Source/JavaScriptCore/assembler/MacroAssemblerARM.cpp

    r187819 r189130  
    11/*
    2  * Copyright (C) 2013, 2014 Apple Inc.
     2 * Copyright (C) 2013-2015 Apple Inc.
    33 * Copyright (C) 2009 University of Szeged
    44 * All rights reserved.
     
    9898#if ENABLE(MASM_PROBE)
    9999
    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_GPREGISTER
    111 
    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_FPREGISTER
    119 }
    120 
    121 #undef INDENT
    122 
    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 
    145100extern "C" void ctiMasmProbeTrampoline();
    146101
  • trunk/Source/JavaScriptCore/assembler/MacroAssemblerARM.h

    r182098 r189130  
    11/*
    2  * Copyright (C) 2008, 2013, 2014 Apple Inc.
     2 * Copyright (C) 2008, 2013-2015 Apple Inc.
    33 * Copyright (C) 2009, 2010 University of Szeged
    44 * All rights reserved.
     
    14341434
    14351435#if ENABLE(MASM_PROBE)
    1436     // Methods required by the MASM_PROBE mechanism as defined in
    1437     // AbstractMacroAssembler.h.
    1438     static void printCPURegisters(CPUState&, int indentation = 0);
    1439     static void printRegister(CPUState&, RegisterID);
    1440     static void printRegister(CPUState&, FPRegisterID);
    14411436    void probe(ProbeFunction, void* arg1 = 0, void* arg2 = 0);
    14421437#endif // ENABLE(MASM_PROBE)
  • trunk/Source/JavaScriptCore/assembler/MacroAssemblerARMv7.cpp

    r176233 r189130  
    11/*
    2  * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
     2 * Copyright (C) 2013-2015 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    3333#if ENABLE(MASM_PROBE)
    3434
    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_GPREGISTER
    46 
    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_FPREGISTER
    54 }
    55 
    56 #undef INDENT
    57 
    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 
    8035extern "C" void ctiMasmProbeTrampoline();
    8136
  • trunk/Source/JavaScriptCore/assembler/MacroAssemblerARMv7.h

    r182098 r189130  
    11/*
    2  * Copyright (C) 2009, 2010, 2014 Apple Inc. All rights reserved.
     2 * Copyright (C) 2009-2010, 2014-2015 Apple Inc. All rights reserved.
    33 * Copyright (C) 2010 University of Szeged
    44 *
     
    19031903
    19041904#if ENABLE(MASM_PROBE)
    1905     // Methods required by the MASM_PROBE mechanism as defined in
    1906     // AbstractMacroAssembler.h.
    1907     static void printCPURegisters(CPUState&, int indentation = 0);
    1908     static void printRegister(CPUState&, RegisterID);
    1909     static void printRegister(CPUState&, FPRegisterID);
    19101905    void probe(ProbeFunction, void* arg1 = 0, void* arg2 = 0);
    19111906#endif // ENABLE(MASM_PROBE)
  • trunk/Source/JavaScriptCore/assembler/MacroAssemblerX86Common.cpp

    r176233 r189130  
    11/*
    2  * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
     2 * Copyright (C) 2013-2015 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    3232
    3333#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 #endif
    50     FOR_EACH_CPU_GPREGISTER(PRINT_GPREGISTER)
    51     FOR_EACH_CPU_SPECIAL_REGISTER(PRINT_GPREGISTER)
    52     #undef PRINT_GPREGISTER
    53 
    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_FPREGISTER
    61 }
    62 
    63 #undef INDENT
    64 
    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 }
    8634
    8735extern "C" void ctiMasmProbeTrampoline();
  • trunk/Source/JavaScriptCore/assembler/MacroAssemblerX86Common.h

    r187819 r189130  
    11/*
    2  * Copyright (C) 2008, 2014 Apple Inc. All rights reserved.
     2 * Copyright (C) 2008, 2014-2015 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    14921492
    14931493#if ENABLE(MASM_PROBE)
    1494     // Methods required by the MASM_PROBE mechanism as defined in
    1495     // AbstractMacroAssembler.h.
    1496     static void printCPURegisters(CPUState&, int indentation = 0);
    1497     static void printRegister(CPUState&, RegisterID);
    1498     static void printRegister(CPUState&, FPRegisterID);
    14991494    void probe(ProbeFunction, void* arg1 = 0, void* arg2 = 0);
    15001495#endif // ENABLE(MASM_PROBE)
Note: See TracChangeset for help on using the changeset viewer.