Changeset 215196 in webkit for trunk/Source/JavaScriptCore/assembler
- Timestamp:
- Apr 10, 2017, 12:38:44 PM (8 years ago)
- Location:
- trunk/Source/JavaScriptCore/assembler
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/assembler/AbstractMacroAssembler.h
r214384 r215196 44 44 #if ENABLE(ASSEMBLER) 45 45 46 #if ENABLE(MASM_PROBE) 47 struct ProbeContext; 48 typedef void (*ProbeFunction)(struct ProbeContext*); 49 #endif 50 46 51 class AllowMacroScratchRegisterUsage; 47 52 class DisallowMacroScratchRegisterUsage; … … 879 884 }; 880 885 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 897 886 // This function emits code to preserve the CPUState (e.g. registers), 898 887 // call a user supplied probe function, and restore the CPUState before -
trunk/Source/JavaScriptCore/assembler/MacroAssembler.cpp
r191816 r215196 1 1 /* 2 * Copyright (C) 2012 Apple Inc. All rights reserved.2 * Copyright (C) 2012-2017 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 36 36 37 37 #if ENABLE(MASM_PROBE) 38 static void stdFunctionCallback( MacroAssembler::ProbeContext* context)38 static void stdFunctionCallback(ProbeContext* context) 39 39 { 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); 41 41 (*func)(context); 42 42 } 43 43 44 void MacroAssembler::probe(std::function<void (MacroAssembler::ProbeContext*)> func)44 void MacroAssembler::probe(std::function<void(ProbeContext*)> func) 45 45 { 46 probe(stdFunctionCallback, new std::function<void (MacroAssembler::ProbeContext*)>(func), 0);46 probe(stdFunctionCallback, new std::function<void(ProbeContext*)>(func), 0); 47 47 } 48 48 #endif // ENABLE(MASM_PROBE) -
trunk/Source/JavaScriptCore/assembler/MacroAssembler.h
r214384 r215196 1823 1823 }; 1824 1824 1825 #if ENABLE(MASM_PROBE) 1826 struct 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 1825 1844 } // namespace JSC 1826 1845 -
trunk/Source/JavaScriptCore/assembler/MacroAssemblerARM.cpp
r191191 r215196 1 1 /* 2 * Copyright (C) 2013-201 5Apple Inc.2 * Copyright (C) 2013-2017 Apple Inc. 3 3 * Copyright (C) 2009 University of Szeged 4 4 * All rights reserved. … … 29 29 30 30 #if ENABLE(ASSEMBLER) && CPU(ARM_TRADITIONAL) 31 32 #include "MacroAssemblerARM.h" 31 #include "MacroAssembler.h" 33 32 34 33 #include <wtf/InlineASM.h> … … 104 103 #if COMPILER(GCC_OR_CLANG) 105 104 106 // The following are offsets for MacroAssemblerARM::ProbeContext fields accessed105 // The following are offsets for ProbeContext fields accessed 107 106 // by the ctiMasmProbeTrampoline stub. 108 107 … … 159 158 // These ASSERTs remind you that if you change the layout of ProbeContext, 160 159 // 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) 162 161 COMPILE_ASSERT(PROBE_OFFSETOF(probeFunction) == PROBE_PROBE_FUNCTION_OFFSET, ProbeContext_probeFunction_offset_matches_ctiMasmProbeTrampoline); 163 162 COMPILE_ASSERT(PROBE_OFFSETOF(arg1) == PROBE_ARG1_OFFSET, ProbeContext_arg1_offset_matches_ctiMasmProbeTrampoline); … … 200 199 COMPILE_ASSERT(PROBE_OFFSETOF(cpu.d14) == PROBE_CPU_D14_OFFSET, ProbeContext_cpu_d14_offset_matches_ctiMasmProbeTrampoline); 201 200 COMPILE_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);201 COMPILE_ASSERT(sizeof(ProbeContext) == PROBE_SIZE, ProbeContext_size_matches_ctiMasmProbeTrampoline); 203 202 #undef PROBE_OFFSETOF 204 203 … … 349 348 #endif // COMPILER(GCC_OR_CLANG) 350 349 351 void MacroAssemblerARM::probe( MacroAssemblerARM::ProbeFunction function, void* arg1, void* arg2)350 void MacroAssemblerARM::probe(ProbeFunction function, void* arg1, void* arg2) 352 351 { 353 352 push(RegisterID::sp); -
trunk/Source/JavaScriptCore/assembler/MacroAssemblerARM64.cpp
r191191 r215196 1 1 /* 2 * Copyright (C) 2013-201 5Apple Inc. All rights reserved.2 * Copyright (C) 2013-2017 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 27 27 28 28 #if ENABLE(ASSEMBLER) && CPU(ARM64) 29 #include "MacroAssembler ARM64.h"29 #include "MacroAssembler.h" 30 30 31 31 #include <wtf/InlineASM.h> … … 41 41 #if COMPILER(GCC_OR_CLANG) 42 42 43 // The following are offsets for MacroAssemblerARM64::ProbeContext fields accessed43 // The following are offsets for ProbeContext fields accessed 44 44 // by the ctiMasmProbeTrampoline stub. 45 45 #define PTR_SIZE 8 … … 129 129 // These ASSERTs remind you that if you change the layout of ProbeContext, 130 130 // 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) 132 132 COMPILE_ASSERT(PROBE_OFFSETOF(probeFunction) == PROBE_PROBE_FUNCTION_OFFSET, ProbeContext_probeFunction_offset_matches_ctiMasmProbeTrampoline); 133 133 COMPILE_ASSERT(PROBE_OFFSETOF(arg1) == PROBE_ARG1_OFFSET, ProbeContext_arg1_offset_matches_ctiMasmProbeTrampoline); … … 206 206 COMPILE_ASSERT(PROBE_OFFSETOF(cpu.q31) == PROBE_CPU_Q31_OFFSET, ProbeContext_cpu_q31_offset_matches_ctiMasmProbeTrampoline); 207 207 208 COMPILE_ASSERT(sizeof( MacroAssemblerARM64::ProbeContext) == PROBE_SIZE, ProbeContext_size_matches_ctiMasmProbeTrampoline);208 COMPILE_ASSERT(sizeof(ProbeContext) == PROBE_SIZE, ProbeContext_size_matches_ctiMasmProbeTrampoline); 209 209 210 210 #undef PROBE_OFFSETOF … … 455 455 #endif // COMPILER(GCC_OR_CLANG) 456 456 457 static void arm64ProbeTrampoline( MacroAssemblerARM64::ProbeContext* context)457 static void arm64ProbeTrampoline(ProbeContext* context) 458 458 { 459 459 void* origSP = context->cpu.sp; … … 472 472 } 473 473 474 void MacroAssemblerARM64::probe( MacroAssemblerARM64::ProbeFunction function, void* arg1, void* arg2)474 void MacroAssemblerARM64::probe(ProbeFunction function, void* arg1, void* arg2) 475 475 { 476 476 sub64(TrustedImm32(8 * 8), sp); -
trunk/Source/JavaScriptCore/assembler/MacroAssemblerARMv7.cpp
r201651 r215196 1 1 /* 2 * Copyright (C) 2013-201 5Apple Inc. All rights reserved.2 * Copyright (C) 2013-2017 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 27 27 28 28 #if ENABLE(ASSEMBLER) && CPU(ARM_THUMB2) 29 #include "MacroAssembler ARMv7.h"29 #include "MacroAssembler.h" 30 30 31 31 #include <wtf/InlineASM.h> … … 39 39 #if COMPILER(GCC_OR_CLANG) 40 40 41 // The following are offsets for MacroAssemblerARMv7::ProbeContext fields accessed41 // The following are offsets for ProbeContext fields accessed 42 42 // by the ctiMasmProbeTrampoline stub. 43 43 … … 109 109 // These ASSERTs remind you that if you change the layout of ProbeContext, 110 110 // 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) 112 112 COMPILE_ASSERT(PROBE_OFFSETOF(probeFunction) == PROBE_PROBE_FUNCTION_OFFSET, ProbeContext_probeFunction_offset_matches_ctiMasmProbeTrampoline); 113 113 COMPILE_ASSERT(PROBE_OFFSETOF(arg1) == PROBE_ARG1_OFFSET, ProbeContext_arg1_offset_matches_ctiMasmProbeTrampoline); … … 168 168 COMPILE_ASSERT(PROBE_OFFSETOF(cpu.d31) == PROBE_CPU_D31_OFFSET, ProbeContext_cpu_d31_offset_matches_ctiMasmProbeTrampoline); 169 169 170 COMPILE_ASSERT(sizeof( MacroAssemblerARMv7::ProbeContext) == PROBE_SIZE, ProbeContext_size_matches_ctiMasmProbeTrampoline);170 COMPILE_ASSERT(sizeof(ProbeContext) == PROBE_SIZE, ProbeContext_size_matches_ctiMasmProbeTrampoline); 171 171 172 172 #undef PROBE_OFFSETOF … … 325 325 #endif // COMPILER(GCC_OR_CLANG) 326 326 327 void MacroAssemblerARMv7::probe( MacroAssemblerARMv7::ProbeFunction function, void* arg1, void* arg2)327 void MacroAssemblerARMv7::probe(ProbeFunction function, void* arg1, void* arg2) 328 328 { 329 329 push(RegisterID::lr); -
trunk/Source/JavaScriptCore/assembler/MacroAssemblerPrinter.cpp
r192366 r215196 1 1 /* 2 * Copyright (C) 2015 Apple Inc. All rights reserved.2 * Copyright (C) 2015-2017 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 34 34 35 35 using CPUState = MacroAssembler::CPUState; 36 using ProbeContext = MacroAssembler::ProbeContext;37 36 using RegisterID = MacroAssembler::RegisterID; 38 37 using FPRegisterID = MacroAssembler::FPRegisterID; -
trunk/Source/JavaScriptCore/assembler/MacroAssemblerPrinter.h
r206525 r215196 1 1 /* 2 * Copyright (C) 2015 Apple Inc. All rights reserved.2 * Copyright (C) 2015-2017 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 159 159 class MacroAssemblerPrinter { 160 160 using CPUState = MacroAssembler::CPUState; 161 using ProbeContext = MacroAssembler::ProbeContext;162 161 using RegisterID = MacroAssembler::RegisterID; 163 162 using FPRegisterID = MacroAssembler::FPRegisterID; -
trunk/Source/JavaScriptCore/assembler/MacroAssemblerX86Common.cpp
r209313 r215196 1 1 /* 2 * Copyright (C) 2013-201 5Apple Inc. All rights reserved.2 * Copyright (C) 2013-2017 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 27 27 28 28 #if ENABLE(ASSEMBLER) && (CPU(X86) || CPU(X86_64)) 29 #include "MacroAssembler X86Common.h"29 #include "MacroAssembler.h" 30 30 31 31 #include <wtf/InlineASM.h> … … 39 39 #if COMPILER(GCC_OR_CLANG) 40 40 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. 43 42 44 43 #if CPU(X86) … … 106 105 // These ASSERTs remind you that if you change the layout of ProbeContext, 107 106 // 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) 109 108 COMPILE_ASSERT(PROBE_OFFSETOF(probeFunction) == PROBE_PROBE_FUNCTION_OFFSET, ProbeContext_probeFunction_offset_matches_ctiMasmProbeTrampoline); 110 109 COMPILE_ASSERT(PROBE_OFFSETOF(arg1) == PROBE_ARG1_OFFSET, ProbeContext_arg1_offset_matches_ctiMasmProbeTrampoline); … … 153 152 #endif // CPU(X86_64) 154 153 155 COMPILE_ASSERT(sizeof( MacroAssemblerX86Common::ProbeContext) == PROBE_SIZE, ProbeContext_size_matches_ctiMasmProbeTrampoline);154 COMPILE_ASSERT(sizeof(ProbeContext) == PROBE_SIZE, ProbeContext_size_matches_ctiMasmProbeTrampoline); 156 155 157 156 #undef PROBE_OFFSETOF … … 533 532 // the address of the instruction immediately following the probe. 534 533 535 void MacroAssemblerX86Common::probe( MacroAssemblerX86Common::ProbeFunction function, void* arg1, void* arg2)534 void MacroAssemblerX86Common::probe(ProbeFunction function, void* arg1, void* arg2) 536 535 { 537 536 push(RegisterID::esp);
Note:
See TracChangeset
for help on using the changeset viewer.