Introduce a default RegisterSet constructor so that we can use { } notation.
authormark.lam@apple.com <mark.lam@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 7 Nov 2017 22:52:34 +0000 (22:52 +0000)
committermark.lam@apple.com <mark.lam@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 7 Nov 2017 22:52:34 +0000 (22:52 +0000)
https://bugs.webkit.org/show_bug.cgi?id=179389

Reviewed by Saam Barati.

I also replaced uses of "RegisterSet()" with "{ }" where the use of "RegisterSet()"
does not add any code documentation value.

* b3/air/AirAllocateRegistersAndStackByLinearScan.cpp:
* b3/air/AirCode.cpp:
(JSC::B3::Air::Code::setRegsInPriorityOrder):
* b3/air/AirPrintSpecial.cpp:
(JSC::B3::Air::PrintSpecial::extraEarlyClobberedRegs):
(JSC::B3::Air::PrintSpecial::extraClobberedRegs):
* b3/air/testair.cpp:
* bytecode/PolymorphicAccess.h:
(JSC::AccessGenerationState::preserveLiveRegistersToStackForCall):
(JSC::AccessGenerationState::restoreLiveRegistersFromStackForCall):
* dfg/DFGJITCode.cpp:
(JSC::DFG::JITCode::liveRegistersToPreserveAtExceptionHandlingCallSite):
* ftl/FTLJITCode.cpp:
(JSC::FTL::JITCode::liveRegistersToPreserveAtExceptionHandlingCallSite):
* jit/JITCode.cpp:
(JSC::JITCode::liveRegistersToPreserveAtExceptionHandlingCallSite):
* jit/RegisterSet.cpp:
(JSC::RegisterSet::reservedHardwareRegisters):
(JSC::RegisterSet::runtimeRegisters):
(JSC::RegisterSet::macroScratchRegisters):
* jit/RegisterSet.h:
(JSC::RegisterSet::RegisterSet):
* wasm/WasmB3IRGenerator.cpp:
(JSC::Wasm::B3IRGenerator::emitTierUpCheck):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@224550 268f45cc-cd09-0410-ab3c-d52691b4dbfc

12 files changed:
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/b3/air/AirAllocateRegistersAndStackByLinearScan.cpp
Source/JavaScriptCore/b3/air/AirCode.cpp
Source/JavaScriptCore/b3/air/AirPrintSpecial.cpp
Source/JavaScriptCore/b3/air/testair.cpp
Source/JavaScriptCore/bytecode/PolymorphicAccess.h
Source/JavaScriptCore/dfg/DFGJITCode.cpp
Source/JavaScriptCore/ftl/FTLJITCode.cpp
Source/JavaScriptCore/jit/JITCode.cpp
Source/JavaScriptCore/jit/RegisterSet.cpp
Source/JavaScriptCore/jit/RegisterSet.h
Source/JavaScriptCore/wasm/WasmB3IRGenerator.cpp

index ebd3d21..da6a0d2 100644 (file)
@@ -1,5 +1,40 @@
 2017-11-07  Mark Lam  <mark.lam@apple.com>
 
+        Introduce a default RegisterSet constructor so that we can use { } notation.
+        https://bugs.webkit.org/show_bug.cgi?id=179389
+
+        Reviewed by Saam Barati.
+
+        I also replaced uses of "RegisterSet()" with "{ }" where the use of "RegisterSet()"
+        does not add any code documentation value.
+
+        * b3/air/AirAllocateRegistersAndStackByLinearScan.cpp:
+        * b3/air/AirCode.cpp:
+        (JSC::B3::Air::Code::setRegsInPriorityOrder):
+        * b3/air/AirPrintSpecial.cpp:
+        (JSC::B3::Air::PrintSpecial::extraEarlyClobberedRegs):
+        (JSC::B3::Air::PrintSpecial::extraClobberedRegs):
+        * b3/air/testair.cpp:
+        * bytecode/PolymorphicAccess.h:
+        (JSC::AccessGenerationState::preserveLiveRegistersToStackForCall):
+        (JSC::AccessGenerationState::restoreLiveRegistersFromStackForCall):
+        * dfg/DFGJITCode.cpp:
+        (JSC::DFG::JITCode::liveRegistersToPreserveAtExceptionHandlingCallSite):
+        * ftl/FTLJITCode.cpp:
+        (JSC::FTL::JITCode::liveRegistersToPreserveAtExceptionHandlingCallSite):
+        * jit/JITCode.cpp:
+        (JSC::JITCode::liveRegistersToPreserveAtExceptionHandlingCallSite):
+        * jit/RegisterSet.cpp:
+        (JSC::RegisterSet::reservedHardwareRegisters):
+        (JSC::RegisterSet::runtimeRegisters):
+        (JSC::RegisterSet::macroScratchRegisters):
+        * jit/RegisterSet.h:
+        (JSC::RegisterSet::RegisterSet):
+        * wasm/WasmB3IRGenerator.cpp:
+        (JSC::Wasm::B3IRGenerator::emitTierUpCheck):
+
+2017-11-07  Mark Lam  <mark.lam@apple.com>
+
         AccessCase::generateImpl() should exclude the result register when restoring registers after a call.
         https://bugs.webkit.org/show_bug.cgi?id=179355
         <rdar://problem/35263053>
index 6045714..8c492da 100644 (file)
@@ -371,7 +371,7 @@ private:
         // http://dl.acm.org/citation.cfm?id=330250.
 
         m_active.clear();
-        m_activeRegs = RegisterSet();
+        m_activeRegs = { };
         
         size_t clobberIndex = 0;
         for (Tmp& tmp : m_tmps) {
index cf2273c..3099ba8 100644 (file)
@@ -89,7 +89,7 @@ Code::~Code()
 void Code::setRegsInPriorityOrder(Bank bank, const Vector<Reg>& regs)
 {
     regsInPriorityOrderImpl(bank) = regs;
-    m_mutableRegs = RegisterSet();
+    m_mutableRegs = { };
     forEachBank(
         [&] (Bank bank) {
             for (Reg reg : regsInPriorityOrder(bank))
index c9989b4..1c7c6b6 100644 (file)
@@ -91,12 +91,12 @@ CCallHelpers::Jump PrintSpecial::generate(Inst& inst, CCallHelpers& jit, Generat
 
 RegisterSet PrintSpecial::extraEarlyClobberedRegs(Inst&)
 {
-    return RegisterSet();
+    return { };
 }
 
 RegisterSet PrintSpecial::extraClobberedRegs(Inst&)
 {
-    return RegisterSet();
+    return { };
 }
 
 void PrintSpecial::dumpImpl(PrintStream& out) const
index 8bf7678..24bdc2c 100644 (file)
@@ -1876,7 +1876,7 @@ void testArgumentRegPinned2()
 
     B3::BasicBlock* b3Root = proc.addBlock();
     B3::PatchpointValue* patchpoint = b3Root->appendNew<B3::PatchpointValue>(proc, B3::Void, B3::Origin());
-    patchpoint->clobber(RegisterSet()); 
+    patchpoint->clobber({ }); 
     patchpoint->setGenerator(
         [=] (CCallHelpers& jit, const B3::StackmapGenerationParams&) {
             jit.move(CCallHelpers::TrustedImm32(42), pinned);
index 9fe481f..1ec24d3 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2014-2016 Apple Inc. All rights reserved.
+ * Copyright (C) 2014-2017 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -233,10 +233,10 @@ struct AccessGenerationState {
 
     const RegisterSet& calculateLiveRegistersForCallAndExceptionHandling();
 
-    SpillState preserveLiveRegistersToStackForCall(const RegisterSet& extra = RegisterSet());
+    SpillState preserveLiveRegistersToStackForCall(const RegisterSet& extra = { });
 
     void restoreLiveRegistersFromStackForCallWithThrownException(const SpillState&);
-    void restoreLiveRegistersFromStackForCall(const SpillState&, const RegisterSet& dontRestore = RegisterSet());
+    void restoreLiveRegistersFromStackForCall(const SpillState&, const RegisterSet& dontRestore = { });
 
     const RegisterSet& liveRegistersForCall();
 
index 67c33f0..96c201f 100644 (file)
@@ -117,7 +117,7 @@ RegisterSet JITCode::liveRegistersToPreserveAtExceptionHandlingCallSite(CodeBloc
         }
     }
 
-    return RegisterSet();
+    return { };
 }
 
 #if ENABLE(FTL_JIT)
index 1cdb509..fc835f4 100644 (file)
@@ -143,7 +143,7 @@ RegisterSet JITCode::liveRegistersToPreserveAtExceptionHandlingCallSite(CodeBloc
             return ValueRep::usedRegisters(exit.m_valueReps);
         }
     }
-    return RegisterSet();
+    return { };
 }
 
 std::optional<CodeOrigin> JITCode::findPC(CodeBlock* codeBlock, void* pc)
index 0001d32..3fc05fe 100644 (file)
@@ -222,7 +222,7 @@ JITCode::CodePtr NativeJITCode::addressForCall(ArityCheckMode)
 #if ENABLE(JIT)
 RegisterSet JITCode::liveRegistersToPreserveAtExceptionHandlingCallSite(CodeBlock*, CallSiteIndex)
 {
-    return RegisterSet();
+    return { };
 }
 #endif
 
index 34b733f..139ea9e 100644 (file)
@@ -54,7 +54,7 @@ RegisterSet RegisterSet::reservedHardwareRegisters()
 #elif CPU(ARM_THUMB2) || CPU(ARM_TRADITIONAL)
     return RegisterSet(ARMRegisters::lr, ARMRegisters::pc);
 #else
-    return RegisterSet();
+    return { };
 #endif
 }
 
@@ -63,7 +63,7 @@ RegisterSet RegisterSet::runtimeRegisters()
 #if USE(JSVALUE64)
     return RegisterSet(GPRInfo::tagTypeNumberRegister, GPRInfo::tagMaskRegister);
 #else
-    return RegisterSet();
+    return { };
 #endif
 }
 
@@ -101,7 +101,7 @@ RegisterSet RegisterSet::macroScratchRegisters()
     result.set(MacroAssembler::cmpTempRegister);
     return result;
 #else
-    return RegisterSet();
+    return { };
 #endif
 }
 
index 20b4eaa..61ef9be 100644 (file)
@@ -40,6 +40,8 @@ class RegisterAtOffsetList;
 
 class RegisterSet {
 public:
+    RegisterSet() { }
+
     template<typename... Regs>
     explicit RegisterSet(Regs... regs)
     {
index feac154..dbc8b88 100644 (file)
@@ -919,7 +919,7 @@ void B3IRGenerator::emitTierUpCheck(uint32_t decrementCount, Origin origin)
             tierUp.link(&jit);
 
             const unsigned extraPaddingBytes = 0;
-            RegisterSet registersToSpill = RegisterSet();
+            RegisterSet registersToSpill = { };
             registersToSpill.add(GPRInfo::argumentGPR1);
             unsigned numberOfStackBytesUsedForRegisterPreservation = ScratchRegisterAllocator::preserveRegistersToStackForCall(jit, registersToSpill, extraPaddingBytes);