Source/JavaScriptCore: Make Executable::clearCode() actually clear all of the entrypo...
authorfpizlo@apple.com <fpizlo@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 8 May 2014 02:35:22 +0000 (02:35 +0000)
committerfpizlo@apple.com <fpizlo@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 8 May 2014 02:35:22 +0000 (02:35 +0000)
clean up some other FTL-related calling convention stuff.
<rdar://problem/16720172>

Rubber stamped by Mark Hahnenberg.

* dfg/DFGOperations.cpp:
* dfg/DFGOperations.h:
* dfg/DFGWorklist.cpp:
(JSC::DFG::Worklist::Worklist):
(JSC::DFG::Worklist::finishCreation):
(JSC::DFG::Worklist::create):
(JSC::DFG::ensureGlobalDFGWorklist):
(JSC::DFG::ensureGlobalFTLWorklist):
* dfg/DFGWorklist.h:
* heap/CodeBlockSet.cpp:
(JSC::CodeBlockSet::dump):
* heap/CodeBlockSet.h:
* runtime/Executable.cpp:
(JSC::ExecutableBase::clearCode):

Source/WTF: UNREACHABLE_FOR_PLATFORM() is meant to be a release crash.

Rubber stamped by Mark Hahnenberg..

* wtf/Assertions.h:
(UNREACHABLE_FOR_PLATFORM):

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

Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/dfg/DFGOperations.cpp
Source/JavaScriptCore/dfg/DFGOperations.h
Source/JavaScriptCore/dfg/DFGWorklist.cpp
Source/JavaScriptCore/dfg/DFGWorklist.h
Source/JavaScriptCore/heap/CodeBlockSet.cpp
Source/JavaScriptCore/heap/CodeBlockSet.h
Source/JavaScriptCore/runtime/Executable.cpp
Source/WTF/ChangeLog
Source/WTF/wtf/Assertions.h

index 176f6ba..f7c3916 100644 (file)
@@ -1,3 +1,26 @@
+2014-05-07  Filip Pizlo  <fpizlo@apple.com>
+
+        Make Executable::clearCode() actually clear all of the entrypoints, and
+        clean up some other FTL-related calling convention stuff.
+        <rdar://problem/16720172>
+
+        Rubber stamped by Mark Hahnenberg.
+
+        * dfg/DFGOperations.cpp:
+        * dfg/DFGOperations.h:
+        * dfg/DFGWorklist.cpp:
+        (JSC::DFG::Worklist::Worklist):
+        (JSC::DFG::Worklist::finishCreation):
+        (JSC::DFG::Worklist::create):
+        (JSC::DFG::ensureGlobalDFGWorklist):
+        (JSC::DFG::ensureGlobalFTLWorklist):
+        * dfg/DFGWorklist.h:
+        * heap/CodeBlockSet.cpp:
+        (JSC::CodeBlockSet::dump):
+        * heap/CodeBlockSet.h:
+        * runtime/Executable.cpp:
+        (JSC::ExecutableBase::clearCode):
+
 2014-05-07  Andreas Kling  <akling@apple.com>
 
         [X86] Emit BT instruction for single-bit tests.
index a5c67ab..20ef8a7 100644 (file)
@@ -1286,46 +1286,6 @@ char* JIT_OPERATION triggerOSREntryNow(
         exec, codeBlock, jitCode->osrEntryBlock.get(), bytecodeIndex, streamIndex);
     return static_cast<char*>(address);
 }
-
-// FIXME: Make calls work well. Currently they're a pure regression.
-// https://bugs.webkit.org/show_bug.cgi?id=113621
-EncodedJSValue JIT_OPERATION operationFTLCall(ExecState* exec)
-{
-    ExecState* callerExec = exec->callerFrame();
-    
-    VM* vm = &callerExec->vm();
-    NativeCallFrameTracer tracer(vm, callerExec);
-    
-    JSValue callee = exec->calleeAsValue();
-    CallData callData;
-    CallType callType = getCallData(callee, callData);
-    if (callType == CallTypeNone) {
-        vm->throwException(callerExec, createNotAFunctionError(callerExec, callee));
-        return JSValue::encode(jsUndefined());
-    }
-    
-    return JSValue::encode(call(callerExec, callee, callType, callData, exec->thisValue(), exec));
-}
-
-// FIXME: Make calls work well. Currently they're a pure regression.
-// https://bugs.webkit.org/show_bug.cgi?id=113621
-EncodedJSValue JIT_OPERATION operationFTLConstruct(ExecState* exec)
-{
-    ExecState* callerExec = exec->callerFrame();
-    
-    VM* vm = &callerExec->vm();
-    NativeCallFrameTracer tracer(vm, callerExec);
-    
-    JSValue callee = exec->calleeAsValue();
-    ConstructData constructData;
-    ConstructType constructType = getConstructData(callee, constructData);
-    if (constructType == ConstructTypeNone) {
-        vm->throwException(callerExec, createNotAFunctionError(callerExec, callee));
-        return JSValue::encode(jsUndefined());
-    }
-    
-    return JSValue::encode(construct(callerExec, callee, constructType, constructData, exec));
-}
 #endif // ENABLE(FTL_JIT)
 
 } // extern "C"
index b8ffe3f..2b1a569 100644 (file)
@@ -126,13 +126,6 @@ char* JIT_OPERATION operationFindSwitchImmTargetForDouble(ExecState*, EncodedJSV
 char* JIT_OPERATION operationSwitchString(ExecState*, size_t tableIndex, JSString*);
 void JIT_OPERATION operationNotifyWrite(ExecState*, VariableWatchpointSet*, EncodedJSValue);
 
-#if ENABLE(FTL_JIT)
-// FIXME: Make calls work well. Currently they're a pure regression.
-// https://bugs.webkit.org/show_bug.cgi?id=113621
-EncodedJSValue JIT_OPERATION operationFTLCall(ExecState*) WTF_INTERNAL;
-EncodedJSValue JIT_OPERATION operationFTLConstruct(ExecState*) WTF_INTERNAL;
-#endif // ENABLE(FTL_JIT)
-
 // These operations implement the implicitly called ToInt32 and ToBoolean conversions from ES5.
 // This conversion returns an int32_t within a size_t such that the value is zero extended to fill the register.
 size_t JIT_OPERATION dfgConvertJSValueToInt32(ExecState*, EncodedJSValue) WTF_INTERNAL;
index 81676fa..bf241df 100644 (file)
@@ -37,8 +37,9 @@
 
 namespace JSC { namespace DFG {
 
-Worklist::Worklist()
-    : m_numberOfActiveThreads(0)
+Worklist::Worklist(CString worklistName)
+    : m_threadName(toCString(worklistName, " Worker Thread"))
+    , m_numberOfActiveThreads(0)
 {
 }
 
@@ -60,16 +61,16 @@ void Worklist::finishCreation(unsigned numberOfThreads, int relativePriority)
     RELEASE_ASSERT(numberOfThreads);
     for (unsigned i = numberOfThreads; i--;) {
         std::unique_ptr<ThreadData> data = std::make_unique<ThreadData>(this);
-        data->m_identifier = createThread(threadFunction, data.get(), "JSC Compilation Thread");
+        data->m_identifier = createThread(threadFunction, data.get(), m_threadName.data());
         if (relativePriority)
             changeThreadPriority(data->m_identifier, relativePriority);
         m_threads.append(std::move(data));
     }
 }
 
-PassRefPtr<Worklist> Worklist::create(unsigned numberOfThreads, int relativePriority)
+PassRefPtr<Worklist> Worklist::create(CString worklistName, unsigned numberOfThreads, int relativePriority)
 {
-    RefPtr<Worklist> result = adoptRef(new Worklist());
+    RefPtr<Worklist> result = adoptRef(new Worklist(worklistName));
     result->finishCreation(numberOfThreads, relativePriority);
     return result;
 }
@@ -405,7 +406,7 @@ Worklist* ensureGlobalDFGWorklist()
 {
     static std::once_flag initializeGlobalWorklistOnceFlag;
     std::call_once(initializeGlobalWorklistOnceFlag, [] {
-        theGlobalDFGWorklist = Worklist::create(Options::numberOfDFGCompilerThreads(), Options::priorityDeltaOfDFGCompilerThreads()).leakRef();
+        theGlobalDFGWorklist = Worklist::create("DFG Worklist", Options::numberOfDFGCompilerThreads(), Options::priorityDeltaOfDFGCompilerThreads()).leakRef();
     });
     return theGlobalDFGWorklist;
 }
@@ -421,7 +422,7 @@ Worklist* ensureGlobalFTLWorklist()
 {
     static std::once_flag initializeGlobalWorklistOnceFlag;
     std::call_once(initializeGlobalWorklistOnceFlag, [] {
-        theGlobalFTLWorklist = Worklist::create(Options::numberOfFTLCompilerThreads(), Options::priorityDeltaOfFTLCompilerThreads()).leakRef();
+        theGlobalFTLWorklist = Worklist::create("FTL Worklist", Options::numberOfFTLCompilerThreads(), Options::priorityDeltaOfFTLCompilerThreads()).leakRef();
     });
     return theGlobalFTLWorklist;
 }
index 0a30451..3d0b5d6 100644 (file)
@@ -49,7 +49,7 @@ public:
 
     ~Worklist();
     
-    static PassRefPtr<Worklist> create(unsigned numberOfThreads, int relativePriority = 0);
+    static PassRefPtr<Worklist> create(CString worklistName, unsigned numberOfThreads, int relativePriority = 0);
     
     void enqueue(PassRefPtr<Plan>);
     
@@ -78,7 +78,7 @@ public:
     void dump(PrintStream&) const;
     
 private:
-    Worklist();
+    Worklist(CString worklistName);
     void finishCreation(unsigned numberOfThreads, int);
     
     void runThread(ThreadData*);
@@ -87,7 +87,9 @@ private:
     void removeAllReadyPlansForVM(VM&, Vector<RefPtr<Plan>, 8>&);
 
     void dump(const MutexLocker&, PrintStream&) const;
-
+    
+    CString m_threadName;
+    
     // Used to inform the thread about what work there is left to do.
     Deque<RefPtr<Plan>> m_queue;
     
index 9c5fab2..2a818f0 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2013 Apple Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -29,6 +29,7 @@
 #include "CodeBlock.h"
 #include "JSCInlines.h"
 #include "SlotVisitor.h"
+#include <wtf/CommaPrinter.h>
 
 namespace JSC {
 
@@ -157,5 +158,22 @@ void CodeBlockSet::rememberCurrentlyExecutingCodeBlocks(Heap* heap)
 #endif // ENABLE(GGC)
 }
 
+void CodeBlockSet::dump(PrintStream& out) const
+{
+    CommaPrinter comma;
+    out.print("{old = [");
+    for (CodeBlock* codeBlock : m_oldCodeBlocks)
+        out.print(comma, pointerDump(codeBlock));
+    out.print("], new = [");
+    comma = CommaPrinter();
+    for (CodeBlock* codeBlock : m_newCodeBlocks)
+        out.print(comma, pointerDump(codeBlock));
+    out.print("], currentlyExecuting = [");
+    comma = CommaPrinter();
+    for (CodeBlock* codeBlock : m_currentlyExecuting)
+        out.print(comma, pointerDump(codeBlock));
+    out.print("]}");
+}
+
 } // namespace JSC
 
index 9823b02..e00cefe 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2013 Apple Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -31,6 +31,7 @@
 #include <wtf/HashSet.h>
 #include <wtf/Noncopyable.h>
 #include <wtf/PassRefPtr.h>
+#include <wtf/PrintStream.h>
 #include <wtf/RefPtr.h>
 
 namespace JSC {
@@ -97,6 +98,8 @@ public:
                 return;
         }
     }
+    
+    void dump(PrintStream&) const;
 
 private:
     void clearMarksForCodeBlocksInRememberedExecutables(const Vector<const JSCell*>&);
index 7b2a7ef..de388e1 100644 (file)
@@ -57,6 +57,8 @@ void ExecutableBase::clearCode()
     m_jitCodeForConstruct.clear();
     m_jitCodeForCallWithArityCheck = MacroAssemblerCodePtr();
     m_jitCodeForConstructWithArityCheck = MacroAssemblerCodePtr();
+    m_jitCodeForCallWithArityCheckAndPreserveRegs = MacroAssemblerCodePtr();
+    m_jitCodeForConstructWithArityCheckAndPreserveRegs = MacroAssemblerCodePtr();
 #endif
     m_numParametersForCall = NUM_PARAMETERS_NOT_COMPILED;
     m_numParametersForConstruct = NUM_PARAMETERS_NOT_COMPILED;
index 932dd81..942c6d0 100644 (file)
@@ -1,3 +1,12 @@
+2014-05-07  Filip Pizlo  <fpizlo@apple.com>
+
+        UNREACHABLE_FOR_PLATFORM() is meant to be a release crash.
+
+        Rubber stamped by Mark Hahnenberg..
+
+        * wtf/Assertions.h:
+        (UNREACHABLE_FOR_PLATFORM):
+
 2014-05-06  Alberto Garcia  <berto@igalia.com>
 
         There is no HW_AVAILCPU on FreeBSD, NetBSD, and OpenBSD
index ffa72ec..a9bfd12 100644 (file)
@@ -372,7 +372,7 @@ while (0)
 #pragma clang diagnostic ignored "-Wmissing-noreturn"
 static inline void UNREACHABLE_FOR_PLATFORM()
 {
-    ASSERT_NOT_REACHED();
+    CRASH();
 }
 #pragma clang diagnostic pop
 #else