Ignore:
Timestamp:
Apr 10, 2017, 12:38:44 PM (8 years ago)
Author:
[email protected]
Message:

Move ProbeContext and ProbeFunction out of AbstractMacroAssembler.
https://bugs.webkit.org/show_bug.cgi?id=170681

Reviewed by Michael Saboff.

This is a refactoring step towards enabling custom probe printers the way printInternal() works for dataLog.

  • assembler/AbstractMacroAssembler.h:

(JSC::AbstractMacroAssembler::ProbeContext::gpr): Deleted.
(JSC::AbstractMacroAssembler::ProbeContext::fpr): Deleted.
(JSC::AbstractMacroAssembler::ProbeContext::gprName): Deleted.
(JSC::AbstractMacroAssembler::ProbeContext::fprName): Deleted.

  • assembler/MacroAssembler.cpp:

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

  • assembler/MacroAssembler.h:

(JSC::ProbeContext::gpr):
(JSC::ProbeContext::fpr):
(JSC::ProbeContext::gprName):
(JSC::ProbeContext::fprName):

  • assembler/MacroAssemblerARM.cpp:

(JSC::MacroAssemblerARM::probe):

  • assembler/MacroAssemblerARM64.cpp:

(JSC::arm64ProbeTrampoline):
(JSC::MacroAssemblerARM64::probe):

  • assembler/MacroAssemblerARMv7.cpp:

(JSC::MacroAssemblerARMv7::probe):

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

(JSC::MacroAssemblerX86Common::probe):

  • ftl/FTLLowerDFGToB3.cpp:

(JSC::FTL::DFG::LowerDFGToB3::abstractStructure):
(JSC::FTL::DFG::LowerDFGToB3::probe): Deleted.

  • Deleted because this became a useless place-holder after the transition to B3.
Location:
trunk/Source/JavaScriptCore/assembler
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/assembler/AbstractMacroAssembler.h

    r214384 r215196  
    4444#if ENABLE(ASSEMBLER)
    4545
     46#if ENABLE(MASM_PROBE)
     47struct ProbeContext;
     48typedef void (*ProbeFunction)(struct ProbeContext*);
     49#endif
     50   
    4651class AllowMacroScratchRegisterUsage;
    4752class DisallowMacroScratchRegisterUsage;
     
    879884    };
    880885
    881     struct ProbeContext;
    882     typedef void (*ProbeFunction)(struct ProbeContext*);
    883 
    884     struct ProbeContext {
    885         ProbeFunction probeFunction;
    886         void* arg1;
    887         void* arg2;
    888         CPUState cpu;
    889 
    890         // Convenience methods:
    891         void*& gpr(RegisterID regID) { return cpu.gpr(regID); }
    892         double& fpr(FPRegisterID regID) { return cpu.fpr(regID); }
    893         const char* gprName(RegisterID regID) { return cpu.gprName(regID); }
    894         const char* fprName(FPRegisterID regID) { return cpu.fprName(regID); }
    895     };
    896 
    897886    // This function emits code to preserve the CPUState (e.g. registers),
    898887    // call a user supplied probe function, and restore the CPUState before
  • trunk/Source/JavaScriptCore/assembler/MacroAssembler.cpp

    r191816 r215196  
    11/*
    2  * Copyright (C) 2012 Apple Inc. All rights reserved.
     2 * Copyright (C) 2012-2017 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    3636
    3737#if ENABLE(MASM_PROBE)
    38 static void stdFunctionCallback(MacroAssembler::ProbeContext* context)
     38static void stdFunctionCallback(ProbeContext* context)
    3939{
    40     auto func = static_cast<const std::function<void (MacroAssembler::ProbeContext*)>*>(context->arg1);
     40    auto func = static_cast<const std::function<void(ProbeContext*)>*>(context->arg1);
    4141    (*func)(context);
    4242}
    4343   
    44 void MacroAssembler::probe(std::function<void (MacroAssembler::ProbeContext*)> func)
     44void MacroAssembler::probe(std::function<void(ProbeContext*)> func)
    4545{
    46     probe(stdFunctionCallback, new std::function<void (MacroAssembler::ProbeContext*)>(func), 0);
     46    probe(stdFunctionCallback, new std::function<void(ProbeContext*)>(func), 0);
    4747}
    4848#endif // ENABLE(MASM_PROBE)
  • trunk/Source/JavaScriptCore/assembler/MacroAssembler.h

    r214384 r215196  
    18231823};
    18241824
     1825#if ENABLE(MASM_PROBE)
     1826struct ProbeContext {
     1827    using CPUState = MacroAssembler::CPUState;
     1828    using RegisterID = MacroAssembler::RegisterID;
     1829    using FPRegisterID = MacroAssembler::FPRegisterID;
     1830
     1831    ProbeFunction probeFunction;
     1832    void* arg1;
     1833    void* arg2;
     1834    CPUState cpu;
     1835
     1836    // Convenience methods:
     1837    void*& gpr(RegisterID regID) { return cpu.gpr(regID); }
     1838    double& fpr(FPRegisterID regID) { return cpu.fpr(regID); }
     1839    const char* gprName(RegisterID regID) { return cpu.gprName(regID); }
     1840    const char* fprName(FPRegisterID regID) { return cpu.fprName(regID); }
     1841};
     1842#endif // ENABLE(MASM_PROBE)
     1843   
    18251844} // namespace JSC
    18261845
  • trunk/Source/JavaScriptCore/assembler/MacroAssemblerARM.cpp

    r191191 r215196  
    11/*
    2  * Copyright (C) 2013-2015 Apple Inc.
     2 * Copyright (C) 2013-2017 Apple Inc.
    33 * Copyright (C) 2009 University of Szeged
    44 * All rights reserved.
     
    2929
    3030#if ENABLE(ASSEMBLER) && CPU(ARM_TRADITIONAL)
    31 
    32 #include "MacroAssemblerARM.h"
     31#include "MacroAssembler.h"
    3332
    3433#include <wtf/InlineASM.h>
     
    104103#if COMPILER(GCC_OR_CLANG)
    105104   
    106 // The following are offsets for MacroAssemblerARM::ProbeContext fields accessed
     105// The following are offsets for ProbeContext fields accessed
    107106// by the ctiMasmProbeTrampoline stub.
    108107
     
    159158// These ASSERTs remind you that if you change the layout of ProbeContext,
    160159// you need to change ctiMasmProbeTrampoline offsets above to match.
    161 #define PROBE_OFFSETOF(x) offsetof(struct MacroAssemblerARM::ProbeContext, x)
     160#define PROBE_OFFSETOF(x) offsetof(struct ProbeContext, x)
    162161COMPILE_ASSERT(PROBE_OFFSETOF(probeFunction) == PROBE_PROBE_FUNCTION_OFFSET, ProbeContext_probeFunction_offset_matches_ctiMasmProbeTrampoline);
    163162COMPILE_ASSERT(PROBE_OFFSETOF(arg1) == PROBE_ARG1_OFFSET, ProbeContext_arg1_offset_matches_ctiMasmProbeTrampoline);
     
    200199COMPILE_ASSERT(PROBE_OFFSETOF(cpu.d14) == PROBE_CPU_D14_OFFSET, ProbeContext_cpu_d14_offset_matches_ctiMasmProbeTrampoline);
    201200COMPILE_ASSERT(PROBE_OFFSETOF(cpu.d15) == PROBE_CPU_D15_OFFSET, ProbeContext_cpu_d15_offset_matches_ctiMasmProbeTrampoline);
    202 COMPILE_ASSERT(sizeof(MacroAssemblerARM::ProbeContext) == PROBE_SIZE, ProbeContext_size_matches_ctiMasmProbeTrampoline);
     201COMPILE_ASSERT(sizeof(ProbeContext) == PROBE_SIZE, ProbeContext_size_matches_ctiMasmProbeTrampoline);
    203202#undef PROBE_OFFSETOF
    204203
     
    349348#endif // COMPILER(GCC_OR_CLANG)
    350349
    351 void MacroAssemblerARM::probe(MacroAssemblerARM::ProbeFunction function, void* arg1, void* arg2)
     350void MacroAssemblerARM::probe(ProbeFunction function, void* arg1, void* arg2)
    352351{
    353352    push(RegisterID::sp);
  • trunk/Source/JavaScriptCore/assembler/MacroAssemblerARM64.cpp

    r191191 r215196  
    11/*
    2  * Copyright (C) 2013-2015 Apple Inc. All rights reserved.
     2 * Copyright (C) 2013-2017 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    2727
    2828#if ENABLE(ASSEMBLER) && CPU(ARM64)
    29 #include "MacroAssemblerARM64.h"
     29#include "MacroAssembler.h"
    3030
    3131#include <wtf/InlineASM.h>
     
    4141#if COMPILER(GCC_OR_CLANG)
    4242
    43 // The following are offsets for MacroAssemblerARM64::ProbeContext fields accessed
     43// The following are offsets for ProbeContext fields accessed
    4444// by the ctiMasmProbeTrampoline stub.
    4545#define PTR_SIZE 8
     
    129129// These ASSERTs remind you that if you change the layout of ProbeContext,
    130130// you need to change ctiMasmProbeTrampoline offsets above to match.
    131 #define PROBE_OFFSETOF(x) offsetof(struct MacroAssemblerARM64::ProbeContext, x)
     131#define PROBE_OFFSETOF(x) offsetof(struct ProbeContext, x)
    132132COMPILE_ASSERT(PROBE_OFFSETOF(probeFunction) == PROBE_PROBE_FUNCTION_OFFSET, ProbeContext_probeFunction_offset_matches_ctiMasmProbeTrampoline);
    133133COMPILE_ASSERT(PROBE_OFFSETOF(arg1) == PROBE_ARG1_OFFSET, ProbeContext_arg1_offset_matches_ctiMasmProbeTrampoline);
     
    206206COMPILE_ASSERT(PROBE_OFFSETOF(cpu.q31) == PROBE_CPU_Q31_OFFSET, ProbeContext_cpu_q31_offset_matches_ctiMasmProbeTrampoline);
    207207
    208 COMPILE_ASSERT(sizeof(MacroAssemblerARM64::ProbeContext) == PROBE_SIZE, ProbeContext_size_matches_ctiMasmProbeTrampoline);
     208COMPILE_ASSERT(sizeof(ProbeContext) == PROBE_SIZE, ProbeContext_size_matches_ctiMasmProbeTrampoline);
    209209
    210210#undef PROBE_OFFSETOF
     
    455455#endif // COMPILER(GCC_OR_CLANG)
    456456
    457 static void arm64ProbeTrampoline(MacroAssemblerARM64::ProbeContext* context)
     457static void arm64ProbeTrampoline(ProbeContext* context)
    458458{
    459459    void* origSP = context->cpu.sp;
     
    472472}
    473473
    474 void MacroAssemblerARM64::probe(MacroAssemblerARM64::ProbeFunction function, void* arg1, void* arg2)
     474void MacroAssemblerARM64::probe(ProbeFunction function, void* arg1, void* arg2)
    475475{
    476476    sub64(TrustedImm32(8 * 8), sp);
  • trunk/Source/JavaScriptCore/assembler/MacroAssemblerARMv7.cpp

    r201651 r215196  
    11/*
    2  * Copyright (C) 2013-2015 Apple Inc. All rights reserved.
     2 * Copyright (C) 2013-2017 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    2727
    2828#if ENABLE(ASSEMBLER) && CPU(ARM_THUMB2)
    29 #include "MacroAssemblerARMv7.h"
     29#include "MacroAssembler.h"
    3030
    3131#include <wtf/InlineASM.h>
     
    3939#if COMPILER(GCC_OR_CLANG)
    4040
    41 // The following are offsets for MacroAssemblerARMv7::ProbeContext fields accessed
     41// The following are offsets for ProbeContext fields accessed
    4242// by the ctiMasmProbeTrampoline stub.
    4343
     
    109109// These ASSERTs remind you that if you change the layout of ProbeContext,
    110110// you need to change ctiMasmProbeTrampoline offsets above to match.
    111 #define PROBE_OFFSETOF(x) offsetof(struct MacroAssemblerARMv7::ProbeContext, x)
     111#define PROBE_OFFSETOF(x) offsetof(struct ProbeContext, x)
    112112COMPILE_ASSERT(PROBE_OFFSETOF(probeFunction) == PROBE_PROBE_FUNCTION_OFFSET, ProbeContext_probeFunction_offset_matches_ctiMasmProbeTrampoline);
    113113COMPILE_ASSERT(PROBE_OFFSETOF(arg1) == PROBE_ARG1_OFFSET, ProbeContext_arg1_offset_matches_ctiMasmProbeTrampoline);
     
    168168COMPILE_ASSERT(PROBE_OFFSETOF(cpu.d31) == PROBE_CPU_D31_OFFSET, ProbeContext_cpu_d31_offset_matches_ctiMasmProbeTrampoline);
    169169
    170 COMPILE_ASSERT(sizeof(MacroAssemblerARMv7::ProbeContext) == PROBE_SIZE, ProbeContext_size_matches_ctiMasmProbeTrampoline);
     170COMPILE_ASSERT(sizeof(ProbeContext) == PROBE_SIZE, ProbeContext_size_matches_ctiMasmProbeTrampoline);
    171171
    172172#undef PROBE_OFFSETOF
     
    325325#endif // COMPILER(GCC_OR_CLANG)
    326326
    327 void MacroAssemblerARMv7::probe(MacroAssemblerARMv7::ProbeFunction function, void* arg1, void* arg2)
     327void MacroAssemblerARMv7::probe(ProbeFunction function, void* arg1, void* arg2)
    328328{
    329329    push(RegisterID::lr);
  • trunk/Source/JavaScriptCore/assembler/MacroAssemblerPrinter.cpp

    r192366 r215196  
    11/*
    2  * Copyright (C) 2015 Apple Inc. All rights reserved.
     2 * Copyright (C) 2015-2017 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    3434
    3535using CPUState = MacroAssembler::CPUState;
    36 using ProbeContext = MacroAssembler::ProbeContext;
    3736using RegisterID = MacroAssembler::RegisterID;
    3837using FPRegisterID = MacroAssembler::FPRegisterID;
  • trunk/Source/JavaScriptCore/assembler/MacroAssemblerPrinter.h

    r206525 r215196  
    11/*
    2  * Copyright (C) 2015 Apple Inc. All rights reserved.
     2 * Copyright (C) 2015-2017 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    159159class MacroAssemblerPrinter {
    160160    using CPUState = MacroAssembler::CPUState;
    161     using ProbeContext = MacroAssembler::ProbeContext;
    162161    using RegisterID = MacroAssembler::RegisterID;
    163162    using FPRegisterID = MacroAssembler::FPRegisterID;
  • trunk/Source/JavaScriptCore/assembler/MacroAssemblerX86Common.cpp

    r209313 r215196  
    11/*
    2  * Copyright (C) 2013-2015 Apple Inc. All rights reserved.
     2 * Copyright (C) 2013-2017 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    2727
    2828#if ENABLE(ASSEMBLER) && (CPU(X86) || CPU(X86_64))
    29 #include "MacroAssemblerX86Common.h"
     29#include "MacroAssembler.h"
    3030
    3131#include <wtf/InlineASM.h>
     
    3939#if COMPILER(GCC_OR_CLANG)
    4040
    41 // The following are offsets for MacroAssemblerX86Common::ProbeContext fields accessed
    42 // by the ctiMasmProbeTrampoline stub.
     41// The following are offsets for ProbeContext fields accessed by the ctiMasmProbeTrampoline stub.
    4342
    4443#if CPU(X86)
     
    106105// These ASSERTs remind you that if you change the layout of ProbeContext,
    107106// you need to change ctiMasmProbeTrampoline offsets above to match.
    108 #define PROBE_OFFSETOF(x) offsetof(struct MacroAssemblerX86Common::ProbeContext, x)
     107#define PROBE_OFFSETOF(x) offsetof(struct ProbeContext, x)
    109108COMPILE_ASSERT(PROBE_OFFSETOF(probeFunction) == PROBE_PROBE_FUNCTION_OFFSET, ProbeContext_probeFunction_offset_matches_ctiMasmProbeTrampoline);
    110109COMPILE_ASSERT(PROBE_OFFSETOF(arg1) == PROBE_ARG1_OFFSET, ProbeContext_arg1_offset_matches_ctiMasmProbeTrampoline);
     
    153152#endif // CPU(X86_64)
    154153
    155 COMPILE_ASSERT(sizeof(MacroAssemblerX86Common::ProbeContext) == PROBE_SIZE, ProbeContext_size_matches_ctiMasmProbeTrampoline);
     154COMPILE_ASSERT(sizeof(ProbeContext) == PROBE_SIZE, ProbeContext_size_matches_ctiMasmProbeTrampoline);
    156155
    157156#undef PROBE_OFFSETOF
     
    533532// the address of the instruction immediately following the probe.
    534533
    535 void MacroAssemblerX86Common::probe(MacroAssemblerX86Common::ProbeFunction function, void* arg1, void* arg2)
     534void MacroAssemblerX86Common::probe(ProbeFunction function, void* arg1, void* arg2)
    536535{
    537536    push(RegisterID::esp);
Note: See TracChangeset for help on using the changeset viewer.