Ignore:
Timestamp:
Nov 14, 2014, 12:24:55 PM (11 years ago)
Author:
[email protected]
Message:

Reduce amount of cut-and-paste needed for probe mechanism implementations.
<https://webkit.org/b/138671>

Reviewed by Geoffrey Garen.

The existing code requires that each MacroAssembler implementation provide
their own copy of all of the probe implementations even when most of it is
identical. This patch hoists the common parts into AbstractMacroAssembler
(with some minor renaming). Each target specific MacroAssembler now only
need to implement a few target specific methods that are expected by and
documented in AbstractMacroAssembler.h in the ENABLE(MASM_PROBE) section.

In this patch, I also simplified the X86 and X86_64 ports to use the same
port implementation. The ARMv7 probe implementation should not conditionally
exclude the higher FP registers (since the JIT doesn't). Fixed the ARMv7
probe code to include the higher FP registers always.

This is all done in preparation to add printing functionality in JITted code
for debugging.

  • assembler/AbstractMacroAssembler.h:

(JSC::AbstractMacroAssembler::Label::Label):
(JSC::AbstractMacroAssembler::ConvertibleLoadLabel::ConvertibleLoadLabel):
(JSC::AbstractMacroAssembler::DataLabelPtr::DataLabelPtr):
(JSC::AbstractMacroAssembler::DataLabel32::DataLabel32):
(JSC::AbstractMacroAssembler::DataLabelCompact::DataLabelCompact):
(JSC::AbstractMacroAssembler::Jump::link):
(JSC::AbstractMacroAssembler::Jump::linkTo):
(JSC::AbstractMacroAssembler::JumpList::link):
(JSC::AbstractMacroAssembler::JumpList::linkTo):
(JSC::AbstractMacroAssembler::ProbeContext::print):
(JSC::AbstractMacroAssembler::printIndent):
(JSC::AbstractMacroAssembler::printCPU):
(JSC::AbstractMacroAssembler::CachedTempRegister::CachedTempRegister):

  • Except for the 3 printing methods (which are for the probe), the rest are touched simply because we need to add the MacroAssemblerType to the template args. The MacroAssemblerType is used by the abstract probe code to call the few probe methods that need to have CPU specific implementations.
  • assembler/MacroAssemblerARM.cpp:

(JSC::MacroAssemblerARM::printCPURegisters):

  • This was refactored from ProbeContext::dumpCPURegisters() which no longer exists.

(JSC::MacroAssemblerARM::ProbeContext::dumpCPURegisters): Deleted.
(JSC::MacroAssemblerARM::ProbeContext::dump): Deleted.

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

(JSC::MacroAssemblerARMv7::printCPURegisters):

  • This was refactored from ProbeContext::dumpCPURegisters() which no longer exists.

(JSC::MacroAssemblerARMv7::ProbeContext::dumpCPURegisters): Deleted.
(JSC::MacroAssemblerARMv7::ProbeContext::dump): Deleted.

  • assembler/MacroAssemblerARMv7.h:
  • assembler/MacroAssemblerMIPS.h:
  • assembler/MacroAssemblerSH4.h:
  • assembler/MacroAssemblerX86.h:

(JSC::MacroAssemblerX86::trustedImm32FromPtr): Deleted.
(JSC::MacroAssemblerX86::probe): Deleted.

  • assembler/MacroAssemblerX86Common.cpp:

(JSC::MacroAssemblerX86Common::printCPURegisters):

  • This was refactored from ProbeContext::dumpCPURegisters() which no longer exists.

(JSC::MacroAssemblerX86Common::probe):

  • This implementation of probe() is based on the one originally in MacroAssemblerX86_64.h. It is generic and should work for both 32-bit and 64-bit.

(JSC::MacroAssemblerX86Common::ProbeContext::dumpCPURegisters): Deleted.
(JSC::MacroAssemblerX86Common::ProbeContext::dump): Deleted.

  • assembler/MacroAssemblerX86Common.h:
  • assembler/MacroAssemblerX86_64.h:

(JSC::MacroAssemblerX86_64::trustedImm64FromPtr): Deleted.
(JSC::MacroAssemblerX86_64::probe): Deleted.

  • jit/JITStubsARMv7.h:
File:
1 edited

Legend:

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

    r176031 r176134  
    11/*
    2  * Copyright (C) 2013 Apple Inc.
     2 * Copyright (C) 2013, 2014 Apple Inc.
    33 * Copyright (C) 2009 University of Szeged
    44 * All rights reserved.
     
    3131
    3232#include "MacroAssemblerARM.h"
    33 
    34 #if ENABLE(MASM_PROBE)
    35 #include <wtf/StdLibExtras.h>
    36 #endif
    3733
    3834#if OS(LINUX)
     
    10298#if ENABLE(MASM_PROBE)
    10399
    104 void MacroAssemblerARM::ProbeContext::dumpCPURegisters(const char* indentation)
     100#define INDENT printIndent(indentation)
     101
     102void MacroAssemblerARM::printCPURegisters(CPUState& cpu, int indentation)
    105103{
    106104    #define DUMP_GPREGISTER(_type, _regName) { \
    107105        int32_t value = reinterpret_cast<int32_t>(cpu._regName); \
    108         dataLogF("%s    %5s: 0x%08x   %d\n", indentation, #_regName, value, value) ; \
     106        INDENT, dataLogF("%5s: 0x%08x  %d\n", #_regName, value, value) ; \
    109107    }
    110108    FOR_EACH_CPU_GPREGISTER(DUMP_GPREGISTER)
     
    113111
    114112    #define DUMP_FPREGISTER(_type, _regName) { \
    115         uint32_t* u = reinterpret_cast<uint32_t*>(&cpu._regName); \
     113        uint64_t* u = reinterpret_cast<uint64_t*>(&cpu._regName); \
    116114        double* d = reinterpret_cast<double*>(&cpu._regName); \
    117         dataLogF("%s    %5s: 0x %08x %08x   %12g\n", \
    118             indentation, #_regName, u[1], u[0], d[0]); \
     115        INDENT, dataLogF("%5s: 0x%016llx  %.13g\n", #_regName, *u, *d); \
    119116    }
    120117    FOR_EACH_CPU_FPREGISTER(DUMP_FPREGISTER)
     
    122119}
    123120
    124 void MacroAssemblerARM::ProbeContext::dump(const char* indentation)
    125 {
    126     if (!indentation)
    127         indentation = "";
    128 
    129     dataLogF("%sProbeContext %p {\n", indentation, this);
    130     dataLogF("%s  probeFunction: %p\n", indentation, probeFunction);
    131     dataLogF("%s  arg1: %p %llu\n", indentation, arg1, reinterpret_cast<int64_t>(arg1));
    132     dataLogF("%s  arg2: %p %llu\n", indentation, arg2, reinterpret_cast<int64_t>(arg2));
    133     dataLogF("%s  cpu: {\n", indentation);
    134 
    135     dumpCPURegisters(indentation);
    136 
    137     dataLogF("%s  }\n", indentation);
    138     dataLogF("%s}\n", indentation);
    139 }
    140 
     121#undef INDENT
    141122
    142123extern "C" void ctiMasmProbeTrampoline();
    143124
    144125// For details on "What code is emitted for the probe?" and "What values are in
    145 // the saved registers?", see comment for MacroAssemblerX86::probe() in
    146 // MacroAssemblerX86_64.h.
     126// the saved registers?", see comment for MacroAssemblerX86Common::probe() in
     127// MacroAssemblerX86Common.cpp.
    147128
    148129void MacroAssemblerARM::probe(MacroAssemblerARM::ProbeFunction function, void* arg1, void* arg2)
Note: See TracChangeset for help on using the changeset viewer.