Title: [216078] trunk/Source/_javascript_Core
Revision
216078
Author
[email protected]
Date
2017-05-02 11:00:23 -0700 (Tue, 02 May 2017)

Log Message

JSC C API should expose GC marking constraints and weak references
https://bugs.webkit.org/show_bug.cgi?id=171554

Reviewed by Geoffrey Garen.
        
This exposes an API that lets you participate in the GC's fixpoint. You can ask the GC
what is marked and you can tell the GC to mark things. The constraint callback cannot
do a whole lot, but it can query marking state and it can dereference weak references.
        
Additionally, this exposes a very simple weak reference API in C.

* API/JSMarkingConstraintPrivate.cpp: Added.
(JSC::isMarked):
(JSC::mark):
(JSContextGroupRegisterMarkingConstraint):
* API/JSMarkingConstraintPrivate.h: Added.
* API/JSWeakPrivate.cpp: Added.
(OpaqueJSWeak::OpaqueJSWeak):
(JSWeakCreate):
(JSWeakRetain):
(JSWeakRelease):
(JSWeakGetObject):
* API/JSWeakPrivate.h: Added.
* API/tests/testapi.c:
(markingConstraint):
(testMarkingConstraints):
(main):
* _javascript_Core.xcodeproj/project.pbxproj:
* heap/SlotVisitor.h:
* heap/SlotVisitorInlines.h:
(JSC::SlotVisitor::appendHiddenUnbarriered):
(JSC::SlotVisitor::appendHidden):

Modified Paths

Added Paths

Diff

Added: trunk/Source/_javascript_Core/API/JSMarkingConstraintPrivate.cpp (0 => 216078)


--- trunk/Source/_javascript_Core/API/JSMarkingConstraintPrivate.cpp	                        (rev 0)
+++ trunk/Source/_javascript_Core/API/JSMarkingConstraintPrivate.cpp	2017-05-02 18:00:23 UTC (rev 216078)
@@ -0,0 +1,93 @@
+/*
+ * Copyright (C) 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
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+
+#include "config.h"
+#include "JSMarkingConstraintPrivate.h"
+
+#include "APICast.h"
+#include "JSCInlines.h"
+#include "MarkingConstraint.h"
+#include "VisitingTimeout.h"
+
+using namespace JSC;
+
+namespace {
+
+Atomic<unsigned> constraintCounter;
+
+struct Marker : JSMarker {
+    SlotVisitor* visitor;
+};
+
+bool isMarked(JSMarkerRef, JSObjectRef objectRef)
+{
+    if (!objectRef)
+        return true; // Null is an immortal object.
+    
+    return Heap::isMarked(toJS(objectRef));
+}
+
+void mark(JSMarkerRef markerRef, JSObjectRef objectRef)
+{
+    if (!objectRef)
+        return;
+    
+    static_cast<Marker*>(markerRef)->visitor->appendHiddenUnbarriered(toJS(objectRef));
+}
+
+} // anonymous namespace
+
+void JSContextGroupAddMarkingConstraint(JSContextGroupRef group, JSMarkingConstraint constraintCallback, void *userData)
+{
+    VM& vm = *toJS(group);
+    JSLockHolder locker(vm);
+    
+    unsigned constraintIndex = constraintCounter.exchangeAdd(1);
+    
+    // This is a guess. The algorithm should be correct no matter what we pick. This means
+    // that we expect this constraint to mark things even during a stop-the-world full GC, but
+    // we don't expect it to be able to mark anything at the very start of a GC before anything
+    // else gets marked.
+    ConstraintVolatility volatility = ConstraintVolatility::GreyedByMarking;
+    
+    auto constraint = std::make_unique<MarkingConstraint>(
+        toCString("Amc", constraintIndex, "(", RawPointer(bitwise_cast<void*>(constraintCallback)), ")"),
+        toCString("API Marking Constraint #", constraintIndex, " (", RawPointer(bitwise_cast<void*>(constraintCallback)), ", ", RawPointer(userData), ")"),
+        [&vm, constraintCallback, userData]
+        (SlotVisitor& slotVisitor, const VisitingTimeout&) {
+            Marker marker;
+            marker.IsMarked = isMarked;
+            marker.Mark = mark;
+            marker.visitor = &slotVisitor;
+            
+            constraintCallback(&marker, userData);
+        },
+        volatility);
+    
+    vm.heap.addMarkingConstraint(WTFMove(constraint));
+}
+
+
+

Added: trunk/Source/_javascript_Core/API/JSMarkingConstraintPrivate.h (0 => 216078)


--- trunk/Source/_javascript_Core/API/JSMarkingConstraintPrivate.h	                        (rev 0)
+++ trunk/Source/_javascript_Core/API/JSMarkingConstraintPrivate.h	2017-05-02 18:00:23 UTC (rev 216078)
@@ -0,0 +1,54 @@
+/*
+ * Copyright (C) 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
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+
+#ifndef JSMarkingConstraintPrivate_h
+#define JSMarkingConstraintPrivate_h
+
+#include <_javascript_Core/JSContextRef.h>
+#include <stdbool.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct JSMarker;
+typedef struct JSMarker JSMarker;
+typedef JSMarker *JSMarkerRef;
+
+struct JSMarker {
+    bool (*IsMarked)(JSMarkerRef, JSObjectRef);
+    void (*Mark)(JSMarkerRef, JSObjectRef);
+};
+
+typedef void (*JSMarkingConstraint)(JSMarkerRef, void *userData);
+
+JS_EXPORT void JSContextGroupAddMarkingConstraint(JSContextGroupRef, JSMarkingConstraint, void *userData);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // JSMarkingConstraintPrivate_h
+

Added: trunk/Source/_javascript_Core/API/JSWeakPrivate.cpp (0 => 216078)


--- trunk/Source/_javascript_Core/API/JSWeakPrivate.cpp	                        (rev 0)
+++ trunk/Source/_javascript_Core/API/JSWeakPrivate.cpp	2017-05-02 18:00:23 UTC (rev 216078)
@@ -0,0 +1,70 @@
+/*
+ * Copyright (C) 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
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+
+#include "config.h"
+#include "JSWeakPrivate.h"
+
+#include "APICast.h"
+#include "JSCInlines.h"
+#include "Weak.h"
+#include <wtf/ThreadSafeRefCounted.h>
+
+using namespace JSC;
+
+struct OpaqueJSWeak : ThreadSafeRefCounted<OpaqueJSWeak> {
+    OpaqueJSWeak(JSObject* object)
+        : weak(object)
+    {
+    }
+    
+    Weak<JSObject> weak;
+};
+
+JSWeakRef JSWeakCreate(JSContextRef context, JSObjectRef objectRef)
+{
+    ExecState* exec = toJS(context);
+    JSLockHolder locker(exec);
+    return new OpaqueJSWeak(toJS(objectRef));
+}
+
+void JSWeakRetain(JSContextRef context, JSWeakRef weakRef)
+{
+    ExecState* exec = toJS(context);
+    JSLockHolder locker(exec);
+    weakRef->ref();
+}
+
+void JSWeakRelease(JSContextRef context, JSWeakRef weakRef)
+{
+    ExecState* exec = toJS(context);
+    JSLockHolder locker(exec);
+    weakRef->deref();
+}
+
+JSObjectRef JSWeakGetObject(JSWeakRef weakRef)
+{
+    return toRef(weakRef->weak.get());
+}
+

Added: trunk/Source/_javascript_Core/API/JSWeakPrivate.h (0 => 216078)


--- trunk/Source/_javascript_Core/API/JSWeakPrivate.h	                        (rev 0)
+++ trunk/Source/_javascript_Core/API/JSWeakPrivate.h	2017-05-02 18:00:23 UTC (rev 216078)
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 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
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+
+#ifndef JSWeakPrivate_h
+#define JSWeakPrivate_h
+
+#include <_javascript_Core/JSObjectRef.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef const struct OpaqueJSWeak* JSWeakRef;
+
+JS_EXPORT JSWeakRef JSWeakCreate(JSContextRef, JSObjectRef);
+
+JS_EXPORT void JSWeakRetain(JSContextRef, JSWeakRef);
+JS_EXPORT void JSWeakRelease(JSContextRef, JSWeakRef);
+
+JS_EXPORT JSObjectRef JSWeakGetObject(JSWeakRef);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // JSWeakPrivate_h
+

Modified: trunk/Source/_javascript_Core/API/tests/testapi.c (216077 => 216078)


--- trunk/Source/_javascript_Core/API/tests/testapi.c	2017-05-02 18:00:22 UTC (rev 216077)
+++ trunk/Source/_javascript_Core/API/tests/testapi.c	2017-05-02 18:00:23 UTC (rev 216078)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2006, 2015-2016 Apple Inc.  All rights reserved.
+ * Copyright (C) 2006-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
@@ -28,9 +28,11 @@
 #include "_javascript_Core.h"
 #include "JSBasePrivate.h"
 #include "JSContextRefPrivate.h"
+#include "JSMarkingConstraintPrivate.h"
 #include "JSObjectRefPrivate.h"
 #include "JSScriptRefPrivate.h"
 #include "JSStringRefPrivate.h"
+#include "JSWeakPrivate.h"
 #include <math.h>
 #define ASSERT_DISABLED 0
 #include <wtf/Assertions.h>
@@ -1115,6 +1117,63 @@
     val.name = "something";
 }
 
+void JSSynchronousGarbageCollectForDebugging(JSContextRef);
+
+static const unsigned numWeakRefs = 10000;
+
+static void markingConstraint(JSMarkerRef marker, void *userData)
+{
+    JSWeakRef *weakRefs;
+    unsigned i;
+    
+    weakRefs = userData;
+    
+    for (i = 0; i < numWeakRefs; i += 2) {
+        JSObjectRef object = JSWeakGetObject(weakRefs[i]);
+        marker->Mark(marker, object);
+        assertTrue(marker->IsMarked(marker, object), "A marked object is marked");
+    }
+}
+
+static void testMarkingConstraints(void)
+{
+    JSContextGroupRef group;
+    JSContextRef context;
+    JSWeakRef *weakRefs;
+    unsigned i;
+    unsigned deadCount;
+    
+    printf("Testing Marking Constraints.\n");
+    
+    group = JSContextGroupCreate();
+    context = JSGlobalContextCreateInGroup(group, NULL);
+
+    weakRefs = calloc(numWeakRefs, sizeof(JSWeakRef));
+
+    JSContextGroupAddMarkingConstraint(group, markingConstraint, weakRefs);
+    
+    for (i = numWeakRefs; i--;)
+        weakRefs[i] = JSWeakCreate(context, JSObjectMakeArray(context, 0, NULL, NULL));
+    
+    JSSynchronousGarbageCollectForDebugging(context);
+    
+    deadCount = 0;
+    for (i = 0; i < numWeakRefs; i += 2) {
+        assertTrue(JSWeakGetObject(weakRefs[i]), "Marked objects stayed alive");
+        if (!JSWeakGetObject(weakRefs[i + 1]))
+            deadCount++;
+    }
+    
+    assertTrue(deadCount != 0, "At least some objects died");
+    
+    for (i = numWeakRefs; i--;)
+        JSWeakRelease(context, weakRefs[i]);
+    
+    JSContextGroupRelease(group);
+
+    printf("PASS: Marking Constraints.\n");
+}
+
 int main(int argc, char* argv[])
 {
 #if OS(WINDOWS)
@@ -1144,6 +1203,8 @@
 
     ASSERT(Base_didFinalize);
 
+    testMarkingConstraints();
+
     JSClassDefinition globalObjectClassDefinition = kJSClassDefinitionEmpty;
     globalObjectClassDefinition.initialize = globalObject_initialize;
     globalObjectClassDefinition.staticValues = globalObject_staticValues;

Modified: trunk/Source/_javascript_Core/ChangeLog (216077 => 216078)


--- trunk/Source/_javascript_Core/ChangeLog	2017-05-02 18:00:22 UTC (rev 216077)
+++ trunk/Source/_javascript_Core/ChangeLog	2017-05-02 18:00:23 UTC (rev 216078)
@@ -1,3 +1,38 @@
+2017-05-02  Filip Pizlo  <[email protected]>
+
+        JSC C API should expose GC marking constraints and weak references
+        https://bugs.webkit.org/show_bug.cgi?id=171554
+
+        Reviewed by Geoffrey Garen.
+        
+        This exposes an API that lets you participate in the GC's fixpoint. You can ask the GC
+        what is marked and you can tell the GC to mark things. The constraint callback cannot
+        do a whole lot, but it can query marking state and it can dereference weak references.
+        
+        Additionally, this exposes a very simple weak reference API in C.
+
+        * API/JSMarkingConstraintPrivate.cpp: Added.
+        (JSC::isMarked):
+        (JSC::mark):
+        (JSContextGroupRegisterMarkingConstraint):
+        * API/JSMarkingConstraintPrivate.h: Added.
+        * API/JSWeakPrivate.cpp: Added.
+        (OpaqueJSWeak::OpaqueJSWeak):
+        (JSWeakCreate):
+        (JSWeakRetain):
+        (JSWeakRelease):
+        (JSWeakGetObject):
+        * API/JSWeakPrivate.h: Added.
+        * API/tests/testapi.c:
+        (markingConstraint):
+        (testMarkingConstraints):
+        (main):
+        * _javascript_Core.xcodeproj/project.pbxproj:
+        * heap/SlotVisitor.h:
+        * heap/SlotVisitorInlines.h:
+        (JSC::SlotVisitor::appendHiddenUnbarriered):
+        (JSC::SlotVisitor::appendHidden):
+
 2017-05-02  Mark Lam  <[email protected]>
 
         JSFixedArray::allocationSize() should not allow for allocation failure.

Modified: trunk/Source/_javascript_Core/_javascript_Core.xcodeproj/project.pbxproj (216077 => 216078)


--- trunk/Source/_javascript_Core/_javascript_Core.xcodeproj/project.pbxproj	2017-05-02 18:00:22 UTC (rev 216077)
+++ trunk/Source/_javascript_Core/_javascript_Core.xcodeproj/project.pbxproj	2017-05-02 18:00:23 UTC (rev 216078)
@@ -94,6 +94,10 @@
 		0F0776BF14FF002B00102332 /* JITCompilationEffort.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F0776BD14FF002800102332 /* JITCompilationEffort.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		0F0A75221B94BFA900110660 /* InferredType.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0F0A75201B94BFA900110660 /* InferredType.cpp */; };
 		0F0A75231B94BFA900110660 /* InferredType.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F0A75211B94BFA900110660 /* InferredType.h */; settings = {ATTRIBUTES = (Private, ); }; };
+		0F0B286B1EB8E6CF000EB5D2 /* JSWeakPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F0B286A1EB8E6CD000EB5D2 /* JSWeakPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; };
+		0F0B286C1EB8E6D3000EB5D2 /* JSWeakPrivate.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0F0B28691EB8E6CD000EB5D2 /* JSWeakPrivate.cpp */; };
+		0F0B286D1EB8E6D5000EB5D2 /* JSMarkingConstraintPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F0B28681EB8E6CD000EB5D2 /* JSMarkingConstraintPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; };
+		0F0B286E1EB8E6DA000EB5D2 /* JSMarkingConstraintPrivate.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0F0B28671EB8E6CD000EB5D2 /* JSMarkingConstraintPrivate.cpp */; };
 		0F0B839C14BCF46300885B4F /* LLIntThunks.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0F0B839714BCF45A00885B4F /* LLIntThunks.cpp */; };
 		0F0B839D14BCF46600885B4F /* LLIntThunks.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F0B839814BCF45A00885B4F /* LLIntThunks.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		0F0B83A714BCF50700885B4F /* CodeType.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F0B83A514BCF50400885B4F /* CodeType.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -2653,6 +2657,10 @@
 		0F0776BD14FF002800102332 /* JITCompilationEffort.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JITCompilationEffort.h; sourceTree = "<group>"; };
 		0F0A75201B94BFA900110660 /* InferredType.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InferredType.cpp; sourceTree = "<group>"; };
 		0F0A75211B94BFA900110660 /* InferredType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InferredType.h; sourceTree = "<group>"; };
+		0F0B28671EB8E6CD000EB5D2 /* JSMarkingConstraintPrivate.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSMarkingConstraintPrivate.cpp; sourceTree = "<group>"; };
+		0F0B28681EB8E6CD000EB5D2 /* JSMarkingConstraintPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSMarkingConstraintPrivate.h; sourceTree = "<group>"; };
+		0F0B28691EB8E6CD000EB5D2 /* JSWeakPrivate.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSWeakPrivate.cpp; sourceTree = "<group>"; };
+		0F0B286A1EB8E6CD000EB5D2 /* JSWeakPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSWeakPrivate.h; sourceTree = "<group>"; };
 		0F0B839714BCF45A00885B4F /* LLIntThunks.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LLIntThunks.cpp; path = llint/LLIntThunks.cpp; sourceTree = "<group>"; };
 		0F0B839814BCF45A00885B4F /* LLIntThunks.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = LLIntThunks.h; path = llint/LLIntThunks.h; sourceTree = "<group>"; };
 		0F0B83A514BCF50400885B4F /* CodeType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CodeType.h; sourceTree = "<group>"; };
@@ -6130,6 +6138,8 @@
 				C25D709A16DE99F400FCA6BC /* JSManagedValue.h */,
 				C25D709916DE99F400FCA6BC /* JSManagedValue.mm */,
 				2A4BB7F218A41179008A0FCD /* JSManagedValueInternal.h */,
+				0F0B28671EB8E6CD000EB5D2 /* JSMarkingConstraintPrivate.cpp */,
+				0F0B28681EB8E6CD000EB5D2 /* JSMarkingConstraintPrivate.h */,
 				1482B7E20A43076000517CFC /* JSObjectRef.cpp */,
 				1482B7E10A43076000517CFC /* JSObjectRef.h */,
 				A79EDB0811531CD60019E912 /* JSObjectRefPrivate.h */,
@@ -6156,6 +6166,8 @@
 				A7482E37116A697B003B0712 /* JSWeakObjectMapRefInternal.h */,
 				A7482B7A1166CDEA003B0712 /* JSWeakObjectMapRefPrivate.cpp */,
 				A7482B791166CDEA003B0712 /* JSWeakObjectMapRefPrivate.h */,
+				0F0B28691EB8E6CD000EB5D2 /* JSWeakPrivate.cpp */,
+				0F0B286A1EB8E6CD000EB5D2 /* JSWeakPrivate.h */,
 				86E3C60C167BAB87006D760A /* JSWrapperMap.h */,
 				86E3C60B167BAB87006D760A /* JSWrapperMap.mm */,
 				86F3EEB9168CCF750077B92A /* ObjCCallbackFunction.h */,
@@ -8538,6 +8550,7 @@
 				0F2017821DCADD4200EA5950 /* DFGFlowMap.h in Headers */,
 				0F2C63AA1E4FA42E00C13839 /* RunningScope.h in Headers */,
 				0F9D339717FFC4E60073C2BC /* DFGFlushedAt.h in Headers */,
+				0F0B286B1EB8E6CF000EB5D2 /* JSWeakPrivate.h in Headers */,
 				A7D89CF817A0B8CC00773AD8 /* DFGFlushFormat.h in Headers */,
 				0F2DD8151AB3D8BE00BBB8E8 /* DFGForAllKills.h in Headers */,
 				0F69CC89193AC60A0045759E /* DFGFrozenValue.h in Headers */,
@@ -9533,6 +9546,7 @@
 				AD2FCC1E1DB59CB200B3E736 /* WebAssemblyRuntimeErrorConstructor.lut.h in Headers */,
 				AD2FCBFB1DB58DAD00B3E736 /* WebAssemblyRuntimeErrorPrototype.h in Headers */,
 				AD2FCC1F1DB59CB200B3E736 /* WebAssemblyRuntimeErrorPrototype.lut.h in Headers */,
+				0F0B286D1EB8E6D5000EB5D2 /* JSMarkingConstraintPrivate.h in Headers */,
 				AD2FCBFD1DB58DAD00B3E736 /* WebAssemblyTableConstructor.h in Headers */,
 				AD2FCC201DB59CB200B3E736 /* WebAssemblyTableConstructor.lut.h in Headers */,
 				AD2FCBFF1DB58DAD00B3E736 /* WebAssemblyTablePrototype.h in Headers */,
@@ -10259,6 +10273,7 @@
 				0F2DD8111AB3D8BE00BBB8E8 /* DFGArgumentsEliminationPhase.cpp in Sources */,
 				0F2DD8131AB3D8BE00BBB8E8 /* DFGArgumentsUtilities.cpp in Sources */,
 				0F485321187750560083B687 /* DFGArithMode.cpp in Sources */,
+				0F0B286E1EB8E6DA000EB5D2 /* JSMarkingConstraintPrivate.cpp in Sources */,
 				0F63948415E48118006A597C /* DFGArrayMode.cpp in Sources */,
 				A7D9A29417A0BC7400EE2618 /* DFGAtTailAbstractState.cpp in Sources */,
 				0F666EC61835672B00D017F1 /* DFGAvailability.cpp in Sources */,
@@ -10957,6 +10972,7 @@
 				A7CA3AEB17DA5168006538AF /* WeakMapData.cpp in Sources */,
 				A7CA3AE517DA41AE006538AF /* WeakMapPrototype.cpp in Sources */,
 				14E84FA014EE1ACC00D6D5D4 /* WeakSet.cpp in Sources */,
+				0F0B286C1EB8E6D3000EB5D2 /* JSWeakPrivate.cpp in Sources */,
 				709FB8691AE335C60039D069 /* WeakSetConstructor.cpp in Sources */,
 				709FB86B1AE335C60039D069 /* WeakSetPrototype.cpp in Sources */,
 				AD2FCBEC1DB58DAD00B3E736 /* WebAssemblyCompileErrorConstructor.cpp in Sources */,

Modified: trunk/Source/_javascript_Core/heap/SlotVisitor.h (216077 => 216078)


--- trunk/Source/_javascript_Core/heap/SlotVisitor.h	2017-05-02 18:00:22 UTC (rev 216077)
+++ trunk/Source/_javascript_Core/heap/SlotVisitor.h	2017-05-02 18:00:23 UTC (rev 216078)
@@ -92,6 +92,9 @@
     template<typename T>
     void append(const Weak<T>& weak);
     
+    void appendHiddenUnbarriered(JSValue);
+    void appendHiddenUnbarriered(JSCell*);
+
     JS_EXPORT_PRIVATE void addOpaqueRoot(void*);
     
     JS_EXPORT_PRIVATE bool containsOpaqueRoot(void*) const;
@@ -174,8 +177,6 @@
     friend class ParallelModeEnabler;
     
     void appendJSCellOrAuxiliary(HeapCell*);
-    void appendHidden(JSValue);
-    void appendHidden(JSCell*);
 
     JS_EXPORT_PRIVATE void appendSlow(JSCell*, Dependency);
     JS_EXPORT_PRIVATE void appendHiddenSlow(JSCell*, Dependency);

Modified: trunk/Source/_javascript_Core/heap/SlotVisitorInlines.h (216077 => 216078)


--- trunk/Source/_javascript_Core/heap/SlotVisitorInlines.h	2017-05-02 18:00:22 UTC (rev 216077)
+++ trunk/Source/_javascript_Core/heap/SlotVisitorInlines.h	2017-05-02 18:00:23 UTC (rev 216078)
@@ -70,13 +70,13 @@
         appendUnbarriered(value.asCell());
 }
 
-ALWAYS_INLINE void SlotVisitor::appendHidden(JSValue value)
+ALWAYS_INLINE void SlotVisitor::appendHiddenUnbarriered(JSValue value)
 {
     if (value.isCell())
-        appendHidden(value.asCell());
+        appendHiddenUnbarriered(value.asCell());
 }
 
-ALWAYS_INLINE void SlotVisitor::appendHidden(JSCell* cell)
+ALWAYS_INLINE void SlotVisitor::appendHiddenUnbarriered(JSCell* cell)
 {
     // This needs to be written in a very specific way to ensure that it gets inlined
     // properly. In particular, it appears that using templates here breaks ALWAYS_INLINE.
@@ -114,7 +114,7 @@
 template<typename T>
 ALWAYS_INLINE void SlotVisitor::appendHidden(const WriteBarrierBase<T>& slot)
 {
-    appendHidden(slot.get());
+    appendHiddenUnbarriered(slot.get());
 }
 
 template<typename Iterator>
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to