Title: [217833] trunk/Source/_javascript_Core
Revision
217833
Author
[email protected]
Date
2017-06-06 09:16:13 -0700 (Tue, 06 Jun 2017)

Log Message

Unreviewed, rolling out r217812.

This change caused test failures on arm64.

Reverted changeset:

"OMG tier up checks should be a patchpoint"
https://bugs.webkit.org/show_bug.cgi?id=172944
http://trac.webkit.org/changeset/217812

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (217832 => 217833)


--- trunk/Source/_javascript_Core/ChangeLog	2017-06-06 15:19:59 UTC (rev 217832)
+++ trunk/Source/_javascript_Core/ChangeLog	2017-06-06 16:16:13 UTC (rev 217833)
@@ -1,3 +1,15 @@
+2017-06-06  Ryan Haddad  <[email protected]>
+
+        Unreviewed, rolling out r217812.
+
+        This change caused test failures on arm64.
+
+        Reverted changeset:
+
+        "OMG tier up checks should be a patchpoint"
+        https://bugs.webkit.org/show_bug.cgi?id=172944
+        http://trac.webkit.org/changeset/217812
+
 2017-06-06  Carlos Garcia Campos  <[email protected]>
 
         [WPE] Enable remote inspector

Modified: trunk/Source/_javascript_Core/wasm/WasmB3IRGenerator.cpp (217832 => 217833)


--- trunk/Source/_javascript_Core/wasm/WasmB3IRGenerator.cpp	2017-06-06 15:19:59 UTC (rev 217832)
+++ trunk/Source/_javascript_Core/wasm/WasmB3IRGenerator.cpp	2017-06-06 16:16:13 UTC (rev 217833)
@@ -51,7 +51,6 @@
 #include "JSWebAssemblyInstance.h"
 #include "JSWebAssemblyModule.h"
 #include "JSWebAssemblyRuntimeError.h"
-#include "ScratchRegisterAllocator.h"
 #include "VirtualRegister.h"
 #include "WasmCallingConvention.h"
 #include "WasmContext.h"
@@ -231,7 +230,7 @@
 private:
     void emitExceptionCheck(CCallHelpers&, ExceptionType);
 
-    void emitTierUpCheck(uint32_t decrementCount, Origin);
+    BasicBlock* emitTierUpCheck(BasicBlock* entry, uint32_t decrementCount, Origin);
 
     ExpressionType emitCheckAndPreparePointer(ExpressionType pointer, uint32_t offset, uint32_t sizeOfOp);
     B3::Kind memoryKind(B3::Opcode memoryOp);
@@ -429,7 +428,7 @@
         });
     }
 
-    emitTierUpCheck(TierUpCount::functionEntryDecrement(), Origin());
+    m_currentBlock = emitTierUpCheck(m_currentBlock, TierUpCount::functionEntryDecrement(), Origin());
 }
 
 void B3IRGenerator::restoreWebAssemblyGlobalState(const MemoryInformation& memory, Value* instance, Procedure& proc, BasicBlock* block)
@@ -875,63 +874,48 @@
     return constant(toB3Type(type), value);
 }
 
-void B3IRGenerator::emitTierUpCheck(uint32_t decrementCount, Origin origin)
+BasicBlock* B3IRGenerator::emitTierUpCheck(BasicBlock* entry, uint32_t decrementCount, Origin origin)
 {
     if (!m_tierUp)
-        return;
+        return entry;
 
+    // FIXME: Make this a patchpoint.
+    BasicBlock* continuation = m_proc.addBlock();
+
     ASSERT(m_tierUp);
     Value* countDownLocation = constant(pointerType(), reinterpret_cast<uint64_t>(m_tierUp), origin);
-    Value* oldCountDown = m_currentBlock->appendNew<MemoryValue>(m_proc, Load, Int32, origin, countDownLocation);
-    Value* newCountDown = m_currentBlock->appendNew<Value>(m_proc, Sub, origin, oldCountDown, constant(Int32, decrementCount, origin));
-    m_currentBlock->appendNew<MemoryValue>(m_proc, Store, origin, newCountDown, countDownLocation);
+    Value* oldCountDown = entry->appendNew<MemoryValue>(m_proc, Load, Int32, origin, countDownLocation);
+    Value* newCountDown = entry->appendNew<Value>(m_proc, Sub, origin, oldCountDown, constant(Int32, decrementCount, origin));
+    entry->appendNew<MemoryValue>(m_proc, Store, origin, newCountDown, countDownLocation);
 
-    PatchpointValue* patch = m_currentBlock->appendNew<PatchpointValue>(m_proc, B3::Void, origin);
-    Effects effects = Effects::none();
-    // FIXME: we should have a more precise heap range for the tier up count.
-    effects.reads = B3::HeapRange::top();
-    effects.writes = B3::HeapRange::top();
-    patch->effects = effects;
+    Value* underFlowed = entry->appendNew<Value>(m_proc, Above, origin, newCountDown, oldCountDown);
 
-    patch->append(newCountDown, ValueRep::SomeRegister);
-    patch->append(oldCountDown, ValueRep::SomeRegister);
-    patch->setGenerator([=] (CCallHelpers& jit, const StackmapGenerationParams& params) {
-        MacroAssembler::Jump tierUp = jit.branch32(MacroAssembler::Above, params[0].gpr(), params[1].gpr());
-        MacroAssembler::Label tierUpResume = jit.label();
+    {
+        BasicBlock* tierUp = m_proc.addBlock();
+        entry->appendNew<Value>(m_proc, B3::Branch, origin, underFlowed);
+        entry->setSuccessors(FrequentedBlock(tierUp, FrequencyClass::Rare), FrequentedBlock(continuation));
 
-        params.addLatePath([=] (CCallHelpers& jit) {
-            tierUp.link(&jit);
+        tierUp->appendNew<CCallValue>(m_proc, B3::Void, origin, Effects::forCall(),
+            constant(pointerType(), reinterpret_cast<uint64_t>(runOMGPlanForIndex), origin),
+            materializeWasmContext(tierUp),
+            constant(Int32, m_functionIndex, origin));
 
-            const unsigned extraPaddingBytes = 0;
-            RegisterSet registersToSpill = RegisterSet();
-            registersToSpill.add(GPRInfo::argumentGPR1);
-            unsigned numberOfStackBytesUsedForRegisterPreservation = ScratchRegisterAllocator::preserveRegistersToStackForCall(jit, registersToSpill, extraPaddingBytes);
+        tierUp->appendNewControlValue(m_proc, Jump, origin, continuation);
+    }
 
-            jit.move(MacroAssembler::TrustedImm32(m_functionIndex), GPRInfo::argumentGPR1);
-            MacroAssembler::Call call = jit.nearCall();
-
-            ScratchRegisterAllocator::restoreRegistersFromStackForCall(jit, registersToSpill, RegisterSet(), numberOfStackBytesUsedForRegisterPreservation, extraPaddingBytes);
-            jit.jump(tierUpResume);
-
-            jit.addLinkTask([=] (LinkBuffer& linkBuffer) {
-                MacroAssembler::repatchNearCall(linkBuffer.locationOfNearCall(call), CodeLocationLabel(Thunks::singleton().stub(triggerOMGTierUpThunkGenerator).code()));
-
-            });
-        });
-    });
+    return continuation;
 }
 
 B3IRGenerator::ControlData B3IRGenerator::addLoop(Type signature)
 {
-    BasicBlock* body = m_proc.addBlock();
+    BasicBlock* branchTarget = m_proc.addBlock();
     BasicBlock* continuation = m_proc.addBlock();
+    BasicBlock* body = emitTierUpCheck(branchTarget, TierUpCount::loopDecrement(), origin());
 
     m_currentBlock->appendNewControlValue(m_proc, Jump, origin(), body);
 
     m_currentBlock = body;
-    emitTierUpCheck(TierUpCount::loopDecrement(), origin());
-
-    return ControlData(m_proc, origin(), signature, BlockType::Loop, continuation, body);
+    return ControlData(m_proc, origin(), signature, BlockType::Loop, continuation, branchTarget);
 }
 
 B3IRGenerator::ControlData B3IRGenerator::addTopLevel(Type signature)

Modified: trunk/Source/_javascript_Core/wasm/WasmThunks.cpp (217832 => 217833)


--- trunk/Source/_javascript_Core/wasm/WasmThunks.cpp	2017-06-06 15:19:59 UTC (rev 217832)
+++ trunk/Source/_javascript_Core/wasm/WasmThunks.cpp	2017-06-06 16:16:13 UTC (rev 217833)
@@ -35,10 +35,8 @@
 #include "JSWebAssemblyInstance.h"
 #include "JSWebAssemblyRuntimeError.h"
 #include "LinkBuffer.h"
-#include "ScratchRegisterAllocator.h"
 #include "WasmContext.h"
 #include "WasmExceptionType.h"
-#include "WasmOMGPlan.h"
 
 namespace JSC { namespace Wasm {
 
@@ -105,27 +103,6 @@
     return FINALIZE_CODE(linkBuffer, ("Throw stack overflow from Wasm"));
 }
 
-MacroAssemblerCodeRef triggerOMGTierUpThunkGenerator(const AbstractLocker&)
-{
-    // We expect that the user has already put the function index into GPRInfo::argumentGPR1
-    CCallHelpers jit;
-
-    const unsigned extraPaddingBytes = 0;
-    RegisterSet registersToSpill = RegisterSet::allRegisters();
-    registersToSpill.exclude(RegisterSet::registersToNotSaveForCCall());
-    unsigned numberOfStackBytesUsedForRegisterPreservation = ScratchRegisterAllocator::preserveRegistersToStackForCall(jit, registersToSpill, extraPaddingBytes);
-
-    jit.loadWasmContext(GPRInfo::argumentGPR0);
-    jit.move(MacroAssembler::TrustedImmPtr(reinterpret_cast<void*>(runOMGPlanForIndex)), GPRInfo::argumentGPR2);
-    jit.call(GPRInfo::argumentGPR2);
-
-    ScratchRegisterAllocator::restoreRegistersFromStackForCall(jit, registersToSpill, RegisterSet(), numberOfStackBytesUsedForRegisterPreservation, extraPaddingBytes);
-
-    jit.ret();
-    LinkBuffer linkBuffer(jit, GLOBAL_THUNK_ID);
-    return FINALIZE_CODE(linkBuffer, ("Trigger OMG tier up"));
-}
-
 static Thunks* thunks;
 void Thunks::initialize()
 {

Modified: trunk/Source/_javascript_Core/wasm/WasmThunks.h (217832 => 217833)


--- trunk/Source/_javascript_Core/wasm/WasmThunks.h	2017-06-06 15:19:59 UTC (rev 217832)
+++ trunk/Source/_javascript_Core/wasm/WasmThunks.h	2017-06-06 16:16:13 UTC (rev 217833)
@@ -33,7 +33,6 @@
 
 MacroAssemblerCodeRef throwExceptionFromWasmThunkGenerator(const AbstractLocker&);
 MacroAssemblerCodeRef throwStackOverflowFromWasmThunkGenerator(const AbstractLocker&);
-MacroAssemblerCodeRef triggerOMGTierUpThunkGenerator(const AbstractLocker&);
 
 typedef MacroAssemblerCodeRef (*ThunkGenerator)(const AbstractLocker&);
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to