Ignore:
Timestamp:
Aug 18, 2017, 10:54:50 AM (8 years ago)
Author:
[email protected]
Message:

Rename ProbeContext and ProbeFunction to Probe::State and Probe::Function.
https://bugs.webkit.org/show_bug.cgi?id=175725
<rdar://problem/33965477>

Rubber-stamped by JF Bastien.

This is purely a refactoring patch (in preparation for the introduction of a
Probe::Context data structure in https://bugs.webkit.org/show_bug.cgi?id=175688
later). This patch does not change any semantics / behavior.

  • assembler/AbstractMacroAssembler.h:
  • assembler/MacroAssembler.cpp:

(JSC::stdFunctionCallback):
(JSC::MacroAssembler::probe):

  • assembler/MacroAssembler.h:

(JSC::ProbeContext::gpr): Deleted.
(JSC::ProbeContext::spr): Deleted.
(JSC::ProbeContext::fpr): Deleted.
(JSC::ProbeContext::gprName): Deleted.
(JSC::ProbeContext::sprName): Deleted.
(JSC::ProbeContext::fprName): Deleted.
(JSC::ProbeContext::pc): Deleted.
(JSC::ProbeContext::fp): Deleted.
(JSC::ProbeContext::sp): Deleted.

  • assembler/MacroAssemblerARM.cpp:

(JSC::MacroAssembler::probe):

  • assembler/MacroAssemblerARM.h:

(JSC::MacroAssemblerARM::trustedImm32FromPtr):

  • assembler/MacroAssemblerARM64.cpp:

(JSC::arm64ProbeError):
(JSC::MacroAssembler::probe):

  • assembler/MacroAssemblerARMv7.cpp:

(JSC::MacroAssembler::probe):

  • assembler/MacroAssemblerARMv7.h:

(JSC::MacroAssemblerARMv7::trustedImm32FromPtr):

  • assembler/MacroAssemblerPrinter.cpp:

(JSC::Printer::printCallback):

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

(JSC::MacroAssembler::probe):

  • assembler/Printer.h:

(JSC::Printer::Context::Context):

  • assembler/testmasm.cpp:

(JSC::testProbeReadsArgumentRegisters):
(JSC::testProbeWritesArgumentRegisters):
(JSC::testProbePreservesGPRS):
(JSC::testProbeModifiesStackPointer):
(JSC::testProbeModifiesStackPointerToInsideProbeStateOnStack):
(JSC::testProbeModifiesStackPointerToNBytesBelowSP):
(JSC::testProbeModifiesProgramCounter):
(JSC::fillStack):
(JSC::testProbeModifiesStackWithCallback):
(JSC::run):
(JSC::testProbeModifiesStackPointerToInsideProbeContextOnStack): Deleted.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/assembler/testmasm.cpp

    r220823 r220921  
    185185#endif
    186186
    187         jit.probe([&] (ProbeContext* context) {
     187        jit.probe([&] (Probe::State* context) {
    188188            auto& cpu = context->cpu;
    189189            probeWasCalled = true;
     
    227227
    228228        // Write expected values.
    229         jit.probe([&] (ProbeContext* context) {
     229        jit.probe([&] (Probe::State* context) {
    230230            auto& cpu = context->cpu;
    231231            probeCallCount++;
     
    240240
    241241        // Validate that expected values were written.
    242         jit.probe([&] (ProbeContext* context) {
     242        jit.probe([&] (Probe::State* context) {
    243243            auto& cpu = context->cpu;
    244244            probeCallCount++;
     
    283283
    284284        // Write expected values into the registers (except for sp, fp, and pc).
    285         jit.probe([&] (ProbeContext* context) {
     285        jit.probe([&] (Probe::State* context) {
    286286            auto& cpu = context->cpu;
    287287            probeCallCount++;
     
    299299
    300300        // Invoke the probe to call a lot of functions and trash register values.
    301         jit.probe([&] (ProbeContext*) {
     301        jit.probe([&] (Probe::State*) {
    302302            probeCallCount++;
    303303            CHECK_EQ(testFunctionToTrashGPRs(0, 1, 2, 3, 4, 5, 6, 7, 8, 9), 10);
     
    306306
    307307        // Validate that the registers have the expected values.
    308         jit.probe([&] (ProbeContext* context) {
     308        jit.probe([&] (Probe::State* context) {
    309309            auto& cpu = context->cpu;
    310310            probeCallCount++;
     
    323323
    324324        // Restore the original state.
    325         jit.probe([&] (ProbeContext* context) {
     325        jit.probe([&] (Probe::State* context) {
    326326            auto& cpu = context->cpu;
    327327            probeCallCount++;
     
    336336
    337337        // Validate that the original state was restored.
    338         jit.probe([&] (ProbeContext* context) {
     338        jit.probe([&] (Probe::State* context) {
    339339            auto& cpu = context->cpu;
    340340            probeCallCount++;
     
    354354}
    355355
    356 void testProbeModifiesStackPointer(WTF::Function<void*(ProbeContext*)> computeModifiedStack)
     356void testProbeModifiesStackPointer(WTF::Function<void*(Probe::State*)> computeModifiedStack)
    357357{
    358358    unsigned probeCallCount = 0;
     
    378378        // Preserve original stack pointer and modify the sp, and
    379379        // write expected values into other registers (except for fp, and pc).
    380         jit.probe([&] (ProbeContext* context) {
     380        jit.probe([&] (Probe::State* context) {
    381381            auto& cpu = context->cpu;
    382382            probeCallCount++;
     
    402402
    403403        // Validate that the registers have the expected values.
    404         jit.probe([&] (ProbeContext* context) {
     404        jit.probe([&] (Probe::State* context) {
    405405            auto& cpu = context->cpu;
    406406            probeCallCount++;
     
    421421
    422422        // Restore the original state.
    423         jit.probe([&] (ProbeContext* context) {
     423        jit.probe([&] (Probe::State* context) {
    424424            auto& cpu = context->cpu;
    425425            probeCallCount++;
     
    436436
    437437        // Validate that the original state was restored.
    438         jit.probe([&] (ProbeContext* context) {
     438        jit.probe([&] (Probe::State* context) {
    439439            auto& cpu = context->cpu;
    440440            probeCallCount++;
     
    456456}
    457457
    458 void testProbeModifiesStackPointerToInsideProbeContextOnStack()
     458void testProbeModifiesStackPointerToInsideProbeStateOnStack()
    459459{
    460460    size_t increment = sizeof(uintptr_t);
     
    463463    increment = 2 * sizeof(uintptr_t);
    464464#endif
    465     for (size_t offset = 0; offset < sizeof(ProbeContext); offset += increment) {
    466         testProbeModifiesStackPointer([=] (ProbeContext* context) -> void* {
     465    for (size_t offset = 0; offset < sizeof(Probe::State); offset += increment) {
     466        testProbeModifiesStackPointer([=] (Probe::State* context) -> void* {
    467467            return reinterpret_cast<uint8_t*>(context) + offset;
    468468        });
     
    478478#endif
    479479    for (size_t offset = 0; offset < 1 * KB; offset += increment) {
    480         testProbeModifiesStackPointer([=] (ProbeContext* context) -> void* {
     480        testProbeModifiesStackPointer([=] (Probe::State* context) -> void* {
    481481            return reinterpret_cast<uint8_t*>(context->cpu.sp()) - offset;
    482482        });
     
    494494    MacroAssemblerCodeRef continuation = compile([&] (CCallHelpers& jit) {
    495495        // Validate that we reached the continuation.
    496         jit.probe([&] (ProbeContext*) {
     496        jit.probe([&] (Probe::State*) {
    497497            probeCallCount++;
    498498            continuationWasReached = true;
     
    507507
    508508        // Write expected values into the registers.
    509         jit.probe([&] (ProbeContext* context) {
     509        jit.probe([&] (Probe::State* context) {
    510510            probeCallCount++;
    511511            context->pc() = continuation.code().executableAddress();
     
    526526};
    527527
    528 static void fillStack(ProbeContext* context)
     528static void fillStack(Probe::State* context)
    529529{
    530530    auto& cpu = context->cpu;
     
    540540    CHECK_EQ(cpu.sp(), newSP);
    541541
    542     // Verify that the probe has put the ProbeContext out of harm's way.
     542    // Verify that the probe has put the Probe::State out of harm's way.
    543543    CHECK_EQ((reinterpret_cast<void*>(context + 1) <= cpu.sp()), true);
    544544
     
    590590
    591591        // Write expected values into the registers.
    592         jit.probe([&] (ProbeContext* context) {
     592        jit.probe([&] (Probe::State* context) {
    593593            auto& cpu = context->cpu;
    594594            probeCallCount++;
     
    615615            context->initializeStackArg = &data;
    616616
    617             // Ensure that we'll be writing over the regions of the stack where the ProbeContext is.
     617            // Ensure that we'll be writing over the regions of the stack where the Probe::State is.
    618618            originalSP = cpu.sp();
    619619            newSP = reinterpret_cast<uintptr_t*>(context) - numberOfExtraEntriesToWrite;
     
    622622
    623623        // Validate that the registers and stack have the expected values.
    624         jit.probe([&] (ProbeContext* context) {
     624        jit.probe([&] (Probe::State* context) {
    625625            auto& cpu = context->cpu;
    626626            probeCallCount++;
     
    649649
    650650        // Restore the original state.
    651         jit.probe([&] (ProbeContext* context) {
     651        jit.probe([&] (Probe::State* context) {
    652652            auto& cpu = context->cpu;
    653653            probeCallCount++;
     
    701701    RUN(testProbeWritesArgumentRegisters());
    702702    RUN(testProbePreservesGPRS());
    703     RUN(testProbeModifiesStackPointerToInsideProbeContextOnStack());
     703    RUN(testProbeModifiesStackPointerToInsideProbeStateOnStack());
    704704    RUN(testProbeModifiesStackPointerToNBytesBelowSP());
    705705    RUN(testProbeModifiesProgramCounter());
Note: See TracChangeset for help on using the changeset viewer.