Changeset 231118 in webkit
- Timestamp:
- Apr 27, 2018 5:01:14 PM (6 years ago)
- Location:
- trunk/Source/JavaScriptCore
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r231116 r231118 1 2018-04-27 Yusuke Suzuki <utatane.tea@gmail.com> 2 3 [JSC][ARM64][Linux] Add collectCPUFeatures using auxiliary vector 4 https://bugs.webkit.org/show_bug.cgi?id=185055 5 6 Reviewed by JF Bastien. 7 8 This patch is paving the way to emitting jscvt instruction if possible. 9 To do that, we need to determine jscvt instruction is supported in the 10 given CPU. 11 12 We add a function collectCPUFeatures, which is responsible to collect 13 CPU features if necessary. In Linux, we can use auxiliary vector to get 14 the information without parsing /proc/cpuinfo. 15 16 Currently, nobody calls this function. It is later called when we emit 17 jscvt instruction. To make it possible, we also need to add disassembler 18 support too. 19 20 * assembler/AbstractMacroAssembler.h: 21 * assembler/MacroAssemblerARM64.cpp: 22 (JSC::MacroAssemblerARM64::collectCPUFeatures): 23 * assembler/MacroAssemblerARM64.h: 24 * assembler/MacroAssemblerX86Common.h: 25 1 26 2018-04-26 Filip Pizlo <fpizlo@apple.com> 2 27 -
trunk/Source/JavaScriptCore/assembler/AbstractMacroAssembler.h
r231027 r231118 83 83 template<PtrTag tag> using CodeRef = MacroAssemblerCodeRef<tag>; 84 84 85 enum class CPUIDCheckState { 86 NotChecked, 87 Clear, 88 Set 89 }; 90 85 91 class Jump; 86 92 -
trunk/Source/JavaScriptCore/assembler/MacroAssemblerARM64.cpp
r230040 r231118 31 31 #include "ProbeContext.h" 32 32 #include <wtf/InlineASM.h> 33 34 #if OS(LINUX) 35 #include <asm/hwcap.h> 36 #include <sys/auxv.h> 37 #endif 33 38 34 39 namespace JSC { … … 527 532 #endif // ENABLE(MASM_PROBE) 528 533 534 void MacroAssemblerARM64::collectCPUFeatures() 535 { 536 static std::once_flag onceKey; 537 std::call_once(onceKey, [] { 538 #if OS(LINUX) 539 // A register for describing ARM64 CPU features are only accessible in kernel mode. 540 // Thus, some kernel support is necessary to collect CPU features. In Linux, the 541 // kernel passes CPU feature flags in AT_HWCAP auxiliary vector which is passed 542 // when the process starts. While this may pose a bit conservative information 543 // (for example, the Linux kernel may add a flag for a feature after the feature 544 // is shipped and implemented in some CPUs. In that case, even if the CPU has 545 // that feature, the kernel does not tell it to users.), it is a stable approach. 546 // https://www.kernel.org/doc/Documentation/arm64/elf_hwcaps.txt 547 unsigned long hwcaps = getauxval(AT_HWCAP); 548 549 #if !defined(HWCAP_JSCVT) 550 #define HWCAP_JSCVT (1 << 13) 551 #endif 552 553 s_jscvtCheckState = (hwcaps & HWCAP_JSCVT) ? CPUIDCheckState::Set : CPUIDCheckState::Clear; 554 #else 555 s_jscvtCheckState = CPUIDCheckState::Clear; 556 #endif 557 }); 558 } 559 560 MacroAssemblerARM64::CPUIDCheckState MacroAssemblerARM64::s_jscvtCheckState = CPUIDCheckState::NotChecked; 561 529 562 } // namespace JSC 530 563 -
trunk/Source/JavaScriptCore/assembler/MacroAssemblerARM64.h
r230748 r231118 4461 4461 } 4462 4462 4463 JS_EXPORT_PRIVATE static void collectCPUFeatures(); 4464 4465 JS_EXPORT_PRIVATE static CPUIDCheckState s_jscvtCheckState; 4466 4463 4467 CachedTempRegister m_dataMemoryTempRegister; 4464 4468 CachedTempRegister m_cachedMemoryTempRegister; -
trunk/Source/JavaScriptCore/assembler/MacroAssemblerX86Common.h
r230748 r231118 4189 4189 JS_EXPORT_PRIVATE static void collectCPUFeatures(); 4190 4190 4191 enum class CPUIDCheckState {4192 NotChecked,4193 Clear,4194 Set4195 };4196 4191 JS_EXPORT_PRIVATE static CPUIDCheckState s_sse2CheckState; 4197 4192 JS_EXPORT_PRIVATE static CPUIDCheckState s_sse4_1CheckState;
Note: See TracChangeset
for help on using the changeset viewer.