Title: [228538] trunk
Revision
228538
Author
[email protected]
Date
2018-02-15 15:38:15 -0800 (Thu, 15 Feb 2018)

Log Message

Unreviewed, roll out r228366 since it did not progress anything.

JSTests:

* stress/gc-error-stack.js: Removed.
* stress/no-gc-error-stack.js: Removed.

Source/_javascript_Core:

* heap/Heap.cpp:
(JSC::Heap::finalizeUnconditionalFinalizers):
* runtime/ErrorInstance.cpp:
(JSC::ErrorInstance::visitChildren):
(JSC::ErrorInstance::finalizeUnconditionally): Deleted.
* runtime/ErrorInstance.h:
(JSC::ErrorInstance::stackTrace):
(JSC::ErrorInstance::subspaceFor): Deleted.
* runtime/Exception.cpp:
(JSC::Exception::visitChildren):
(JSC::Exception::finalizeUnconditionally): Deleted.
* runtime/Exception.h:
* runtime/StackFrame.cpp:
(JSC::StackFrame::visitChildren):
(JSC::StackFrame::isFinalizationCandidate): Deleted.
(JSC::StackFrame::finalizeUnconditionally): Deleted.
* runtime/StackFrame.h:
* runtime/VM.cpp:
(JSC::VM::VM):
* runtime/VM.h:

Modified Paths

Removed Paths

Diff

Modified: trunk/JSTests/ChangeLog (228537 => 228538)


--- trunk/JSTests/ChangeLog	2018-02-15 23:33:44 UTC (rev 228537)
+++ trunk/JSTests/ChangeLog	2018-02-15 23:38:15 UTC (rev 228538)
@@ -1,3 +1,10 @@
+2018-02-15  Filip Pizlo  <[email protected]>
+
+        Unreviewed, roll out r228366 since it did not progress anything.
+
+        * stress/gc-error-stack.js: Removed.
+        * stress/no-gc-error-stack.js: Removed.
+
 2018-02-15  Tomas Popela  <[email protected]>
 
         Many stress tests fail with JIT disabled

Deleted: trunk/JSTests/stress/gc-error-stack.js (228537 => 228538)


--- trunk/JSTests/stress/gc-error-stack.js	2018-02-15 23:33:44 UTC (rev 228537)
+++ trunk/JSTests/stress/gc-error-stack.js	2018-02-15 23:38:15 UTC (rev 228538)
@@ -1,18 +0,0 @@
-"use strict";
-
-var errors = [];
-
-for (let i = 0; i < 1000; ++i)
-    eval("(function foo" + i + "() { errors.push(new Error()); })();");
-
-gc();
-
-let didGCAtLeastOne = false;
-for (let error of errors) {
-    if (!error.stack.startsWith("foo"))
-        didGCAtLeastOne = true;
-}
-
-if (!didGCAtLeastOne)
-    throw new Error("Bad result: didGCAtLeastOne = " + didGCAtLeastOne);
-

Deleted: trunk/JSTests/stress/no-gc-error-stack.js (228537 => 228538)


--- trunk/JSTests/stress/no-gc-error-stack.js	2018-02-15 23:33:44 UTC (rev 228537)
+++ trunk/JSTests/stress/no-gc-error-stack.js	2018-02-15 23:38:15 UTC (rev 228538)
@@ -1,22 +0,0 @@
-//@ runDefault
-
-"use strict";
-
-var errors = [];
-
-for (let i = 0; i < 1000; ++i)
-    eval("(function foo" + i + "() { errors.push(new Error()); })();");
-
-for (let error of errors)
-    error.stack;
-
-gc();
-
-for (let error of errors) {
-    if (!error.stack.startsWith("foo")) {
-        print("ERROR: Stack does not begin with foo: " + error.stack);
-        throw new Error("fail");
-    }
-}
-
-

Modified: trunk/Source/_javascript_Core/ChangeLog (228537 => 228538)


--- trunk/Source/_javascript_Core/ChangeLog	2018-02-15 23:33:44 UTC (rev 228537)
+++ trunk/Source/_javascript_Core/ChangeLog	2018-02-15 23:38:15 UTC (rev 228538)
@@ -1,3 +1,28 @@
+2018-02-15  Filip Pizlo  <[email protected]>
+
+        Unreviewed, roll out r228366 since it did not progress anything.
+
+        * heap/Heap.cpp:
+        (JSC::Heap::finalizeUnconditionalFinalizers):
+        * runtime/ErrorInstance.cpp:
+        (JSC::ErrorInstance::visitChildren):
+        (JSC::ErrorInstance::finalizeUnconditionally): Deleted.
+        * runtime/ErrorInstance.h:
+        (JSC::ErrorInstance::stackTrace):
+        (JSC::ErrorInstance::subspaceFor): Deleted.
+        * runtime/Exception.cpp:
+        (JSC::Exception::visitChildren):
+        (JSC::Exception::finalizeUnconditionally): Deleted.
+        * runtime/Exception.h:
+        * runtime/StackFrame.cpp:
+        (JSC::StackFrame::visitChildren):
+        (JSC::StackFrame::isFinalizationCandidate): Deleted.
+        (JSC::StackFrame::finalizeUnconditionally): Deleted.
+        * runtime/StackFrame.h:
+        * runtime/VM.cpp:
+        (JSC::VM::VM):
+        * runtime/VM.h:
+
 2018-02-15  Yusuke Suzuki  <[email protected]>
 
         [JSC] Remove monotonicallyIncreasingTime and currentTime

Modified: trunk/Source/_javascript_Core/heap/Heap.cpp (228537 => 228538)


--- trunk/Source/_javascript_Core/heap/Heap.cpp	2018-02-15 23:33:44 UTC (rev 228537)
+++ trunk/Source/_javascript_Core/heap/Heap.cpp	2018-02-15 23:38:15 UTC (rev 228538)
@@ -579,8 +579,6 @@
 
 void Heap::finalizeUnconditionalFinalizers()
 {
-    finalizeMarkedUnconditionalFinalizers<ErrorInstance>(vm()->errorInstancesWithFinalizers);
-    finalizeMarkedUnconditionalFinalizers<Exception>(vm()->exceptionsWithFinalizers);
     finalizeMarkedUnconditionalFinalizers<InferredType>(vm()->inferredTypesWithFinalizers);
     finalizeMarkedUnconditionalFinalizers<InferredValue>(vm()->inferredValuesWithFinalizers);
     vm()->forEachCodeBlockSpace(

Modified: trunk/Source/_javascript_Core/runtime/ErrorInstance.cpp (228537 => 228538)


--- trunk/Source/_javascript_Core/runtime/ErrorInstance.cpp	2018-02-15 23:33:44 UTC (rev 228537)
+++ trunk/Source/_javascript_Core/runtime/ErrorInstance.cpp	2018-02-15 23:38:15 UTC (rev 228538)
@@ -1,6 +1,6 @@
 /*
  *  Copyright (C) 1999-2000 Harri Porten ([email protected])
- *  Copyright (C) 2003-2018 Apple Inc. All rights reserved.
+ *  Copyright (C) 2003-2017 Apple Inc. All rights reserved.
  *
  *  This library is free software; you can redistribute it and/or
  *  modify it under the terms of the GNU Lesser General Public
@@ -23,7 +23,6 @@
 
 #include "CodeBlock.h"
 #include "InlineCallFrame.h"
-#include "IsoCellSetInlines.h"
 #include "JSScope.h"
 #include "JSCInlines.h"
 #include "ParseInt.h"
@@ -234,35 +233,15 @@
     ASSERT_GC_OBJECT_INHERITS(thisObject, info());
     Base::visitChildren(thisObject, visitor);
 
-    bool isFinalizationCandidate = false;
     {
         auto locker = holdLock(thisObject->cellLock());
         if (thisObject->m_stackTrace) {
-            for (StackFrame& frame : *thisObject->m_stackTrace) {
-                if (frame.isFinalizationCandidate()) {
-                    isFinalizationCandidate = true;
-                    break;
-                }
-            }
+            for (StackFrame& frame : *thisObject->m_stackTrace)
+                frame.visitChildren(visitor);
         }
     }
-    if (isFinalizationCandidate)
-        visitor.vm().errorInstancesWithFinalizers.add(thisObject);
 }
 
-void ErrorInstance::finalizeUnconditionally(VM& vm)
-{
-    {
-        auto locker = holdLock(cellLock());
-        if (m_stackTrace) {
-            for (StackFrame& frame : *m_stackTrace)
-                frame.finalizeUnconditionally(vm);
-        }
-    }
-    
-    vm.errorInstancesWithFinalizers.remove(this);
-}
-
 bool ErrorInstance::getOwnPropertySlot(JSObject* object, ExecState* exec, PropertyName propertyName, PropertySlot& slot)
 {
     VM& vm = exec->vm();

Modified: trunk/Source/_javascript_Core/runtime/ErrorInstance.h (228537 => 228538)


--- trunk/Source/_javascript_Core/runtime/ErrorInstance.h	2018-02-15 23:33:44 UTC (rev 228537)
+++ trunk/Source/_javascript_Core/runtime/ErrorInstance.h	2018-02-15 23:38:15 UTC (rev 228538)
@@ -1,6 +1,6 @@
 /*
  *  Copyright (C) 1999-2000 Harri Porten ([email protected])
- *  Copyright (C) 2008-2018 Apple Inc. All rights reserved.
+ *  Copyright (C) 2008-2017 Apple Inc. All rights reserved.
  *
  *  This library is free software; you can redistribute it and/or
  *  modify it under the terms of the GNU Lesser General Public
@@ -26,17 +26,8 @@
 
 namespace JSC {
 
-// FIXME: This should be final, but isn't because of bizarre (and mostly wrong) things done in
-// WebAssembly.
-// https://bugs.webkit.org/show_bug.cgi?id=182649
 class ErrorInstance : public JSDestructibleObject {
 public:
-    template<typename CellType>
-    static IsoSubspace* subspaceFor(VM& vm)
-    {
-        return &vm.errorInstanceSpace;
-    }
-
     typedef JSDestructibleObject Base;
     const static unsigned StructureFlags = Base::StructureFlags | OverridesGetOwnPropertySlot | OverridesGetPropertyNames;
 
@@ -77,8 +68,6 @@
     JS_EXPORT_PRIVATE String sanitizedToString(ExecState*);
     
     Vector<StackFrame>* stackTrace() { return m_stackTrace.get(); }
-    
-    void finalizeUnconditionally(VM&);
 
     bool materializeErrorInfoIfNeeded(VM&);
     bool materializeErrorInfoIfNeeded(VM&, PropertyName);

Modified: trunk/Source/_javascript_Core/runtime/Exception.cpp (228537 => 228538)


--- trunk/Source/_javascript_Core/runtime/Exception.cpp	2018-02-15 23:33:44 UTC (rev 228537)
+++ trunk/Source/_javascript_Core/runtime/Exception.cpp	2018-02-15 23:38:15 UTC (rev 228538)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2015-2018 Apple Inc. All rights reserved.
+ * Copyright (C) 2015-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
@@ -27,7 +27,6 @@
 #include "Exception.h"
 
 #include "Interpreter.h"
-#include "IsoCellSetInlines.h"
 #include "JSCInlines.h"
 
 namespace JSC {
@@ -58,26 +57,11 @@
     ASSERT_GC_OBJECT_INHERITS(thisObject, info());
     Base::visitChildren(thisObject, visitor);
 
-    bool isFinalizationCandidate = false;
     visitor.append(thisObject->m_value);
-    for (StackFrame& frame : thisObject->m_stack) {
-        if (frame.isFinalizationCandidate()) {
-            isFinalizationCandidate = true;
-            break;
-        }
-    }
-    if (isFinalizationCandidate)
-        visitor.vm().exceptionsWithFinalizers.add(thisObject);
+    for (StackFrame& frame : thisObject->m_stack)
+        frame.visitChildren(visitor);
 }
 
-void Exception::finalizeUnconditionally(VM& vm)
-{
-    for (StackFrame& frame : m_stack)
-        frame.finalizeUnconditionally(vm);
-    
-    vm.exceptionsWithFinalizers.remove(this);
-}
-
 Exception::Exception(VM& vm)
     : Base(vm, vm.exceptionStructure.get())
 {

Modified: trunk/Source/_javascript_Core/runtime/Exception.h (228537 => 228538)


--- trunk/Source/_javascript_Core/runtime/Exception.h	2018-02-15 23:33:44 UTC (rev 228537)
+++ trunk/Source/_javascript_Core/runtime/Exception.h	2018-02-15 23:38:15 UTC (rev 228538)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2015-2018 Apple Inc. All rights reserved.
+ * Copyright (C) 2015-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
@@ -31,14 +31,8 @@
 
 namespace JSC {
     
-class Exception final : public JSDestructibleObject {
+class Exception : public JSDestructibleObject {
 public:
-    template<typename CellType>
-    static IsoSubspace* subspaceFor(VM& vm)
-    {
-        return &vm.exceptionSpace;
-    }
-
     typedef JSDestructibleObject Base;
     static const unsigned StructureFlags = StructureIsImmortal | Base::StructureFlags;
 
@@ -66,8 +60,6 @@
     void setDidNotifyInspectorOfThrow() { m_didNotifyInspectorOfThrow = true; }
 
     ~Exception();
-    
-    void finalizeUnconditionally(VM&);
 
 private:
     Exception(VM&);

Modified: trunk/Source/_javascript_Core/runtime/StackFrame.cpp (228537 => 228538)


--- trunk/Source/_javascript_Core/runtime/StackFrame.cpp	2018-02-15 23:33:44 UTC (rev 228537)
+++ trunk/Source/_javascript_Core/runtime/StackFrame.cpp	2018-02-15 23:38:15 UTC (rev 228538)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2016-2018 Apple Inc. All rights reserved.
+ * Copyright (C) 2016-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
@@ -142,28 +142,13 @@
     return traceBuild.toString().impl();
 }
 
-bool StackFrame::isFinalizationCandidate()
+void StackFrame::visitChildren(SlotVisitor& visitor)
 {
-    if (m_callee && !Heap::isMarked(m_callee.get()))
-        return true;
-    if (m_codeBlock && !Heap::isMarked(m_codeBlock.get()))
-        return true;
-    return false;
+    if (m_callee)
+        visitor.append(m_callee);
+    if (m_codeBlock)
+        visitor.append(m_codeBlock);
 }
 
-void StackFrame::finalizeUnconditionally(VM&)
-{
-    // FIXME: We should do something smarter. For example, if this happens, we could stringify the
-    // whole stack trace. The main shortcoming is that that requires doing operations that are not
-    // currently legal during finalization. We could make this work by giving JSC a proper "second
-    // chance" finalizer infrastructure. Or maybe there's an even easier way.
-    // https://bugs.webkit.org/show_bug.cgi?id=182650
-    
-    if (m_callee && !Heap::isMarked(m_callee.get()))
-        m_callee.clear();
-    if (m_codeBlock && !Heap::isMarked(m_codeBlock.get()))
-        m_codeBlock.clear();
-}
-
 } // namespace JSC
 

Modified: trunk/Source/_javascript_Core/runtime/StackFrame.h (228537 => 228538)


--- trunk/Source/_javascript_Core/runtime/StackFrame.h	2018-02-15 23:33:44 UTC (rev 228537)
+++ trunk/Source/_javascript_Core/runtime/StackFrame.h	2018-02-15 23:38:15 UTC (rev 228538)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2016-2018 Apple Inc. All rights reserved.
+ * Copyright (C) 2016-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
@@ -56,8 +56,7 @@
         return m_bytecodeOffset;
     }
     
-    bool isFinalizationCandidate();
-    void finalizeUnconditionally(VM&);
+    void visitChildren(SlotVisitor&);
 
 private:
     WriteBarrier<JSCell> m_callee { };

Modified: trunk/Source/_javascript_Core/runtime/VM.cpp (228537 => 228538)


--- trunk/Source/_javascript_Core/runtime/VM.cpp	2018-02-15 23:33:44 UTC (rev 228537)
+++ trunk/Source/_javascript_Core/runtime/VM.cpp	2018-02-15 23:38:15 UTC (rev 228538)
@@ -260,8 +260,6 @@
     , boundFunctionSpace ISO_SUBSPACE_INIT(heap, cellHeapCellType.get(), JSBoundFunction)
     , customGetterSetterFunctionSpace ISO_SUBSPACE_INIT(heap, cellHeapCellType.get(), JSCustomGetterSetterFunction)
     , directEvalExecutableSpace ISO_SUBSPACE_INIT(heap, destructibleCellHeapCellType.get(), DirectEvalExecutable)
-    , errorInstanceSpace ISO_SUBSPACE_INIT(heap, destructibleObjectHeapCellType.get(), ErrorInstance)
-    , exceptionSpace ISO_SUBSPACE_INIT(heap, destructibleObjectHeapCellType.get(), Exception)
     , executableToCodeBlockEdgeSpace ISO_SUBSPACE_INIT(heap, cellHeapCellType.get(), ExecutableToCodeBlockEdge)
     , functionExecutableSpace ISO_SUBSPACE_INIT(heap, destructibleCellHeapCellType.get(), FunctionExecutable)
     , functionSpace ISO_SUBSPACE_INIT(heap, cellHeapCellType.get(), JSFunction)
@@ -282,8 +280,6 @@
     , webAssemblyFunctionSpace ISO_SUBSPACE_INIT(heap, cellHeapCellType.get(), WebAssemblyFunction)
     , webAssemblyWrapperFunctionSpace ISO_SUBSPACE_INIT(heap, cellHeapCellType.get(), WebAssemblyWrapperFunction)
 #endif
-    , errorInstancesWithFinalizers(errorInstanceSpace)
-    , exceptionsWithFinalizers(exceptionSpace)
     , executableToCodeBlockEdgesWithConstraints(executableToCodeBlockEdgeSpace)
     , executableToCodeBlockEdgesWithFinalizers(executableToCodeBlockEdgeSpace)
     , inferredTypesWithFinalizers(inferredTypeSpace)

Modified: trunk/Source/_javascript_Core/runtime/VM.h (228537 => 228538)


--- trunk/Source/_javascript_Core/runtime/VM.h	2018-02-15 23:33:44 UTC (rev 228537)
+++ trunk/Source/_javascript_Core/runtime/VM.h	2018-02-15 23:38:15 UTC (rev 228538)
@@ -342,8 +342,6 @@
     IsoSubspace boundFunctionSpace;
     IsoSubspace customGetterSetterFunctionSpace;
     IsoSubspace directEvalExecutableSpace;
-    IsoSubspace errorInstanceSpace;
-    IsoSubspace exceptionSpace;
     IsoSubspace executableToCodeBlockEdgeSpace;
     IsoSubspace functionExecutableSpace;
     IsoSubspace functionSpace;
@@ -365,8 +363,6 @@
     IsoSubspace webAssemblyWrapperFunctionSpace;
 #endif
     
-    IsoCellSet errorInstancesWithFinalizers;
-    IsoCellSet exceptionsWithFinalizers;
     IsoCellSet executableToCodeBlockEdgesWithConstraints;
     IsoCellSet executableToCodeBlockEdgesWithFinalizers;
     IsoCellSet inferredTypesWithFinalizers;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to