Title: [169188] branches/ftlopt
Revision
169188
Author
[email protected]
Date
2014-05-21 21:11:15 -0700 (Wed, 21 May 2014)

Log Message

[ftlopt] DFG::clobberize should be blind to the effects of GC
https://bugs.webkit.org/show_bug.cgi?id=133166


Source/_javascript_Core: 
Reviewed by Goeffrey Garen.
        
Move the computation of where GCs happen to DFG::doesGC().
        
Large (>5x) speed-up on programs that do loop-invariant string concatenations.

* CMakeLists.txt:
* _javascript_Core.vcxproj/_javascript_Core.vcxproj:
* _javascript_Core.xcodeproj/project.pbxproj:
* dfg/DFGAbstractHeap.h:
* dfg/DFGClobberize.h:
(JSC::DFG::clobberize):
(JSC::DFG::clobberizeForAllocation): Deleted.
* dfg/DFGDoesGC.cpp: Added.
(JSC::DFG::doesGC):
* dfg/DFGDoesGC.h: Added.
* dfg/DFGStoreBarrierElisionPhase.cpp:
(JSC::DFG::StoreBarrierElisionPhase::handleNode):
(JSC::DFG::StoreBarrierElisionPhase::couldCauseGC): Deleted.

LayoutTests: 
Reviewed by Geoffrey Garen.

* js/regress/hoist-make-rope-expected.txt: Added.
* js/regress/hoist-make-rope.html: Added.
* js/regress/script-tests/hoist-make-rope.js: Added.
(foo):

Modified Paths

Added Paths

Diff

Modified: branches/ftlopt/LayoutTests/ChangeLog (169187 => 169188)


--- branches/ftlopt/LayoutTests/ChangeLog	2014-05-22 03:52:34 UTC (rev 169187)
+++ branches/ftlopt/LayoutTests/ChangeLog	2014-05-22 04:11:15 UTC (rev 169188)
@@ -1,3 +1,15 @@
+2014-05-21  Filip Pizlo  <[email protected]>
+
+        [ftlopt] DFG::clobberize should be blind to the effects of GC
+        https://bugs.webkit.org/show_bug.cgi?id=133166
+
+        Reviewed by Geoffrey Garen.
+
+        * js/regress/hoist-make-rope-expected.txt: Added.
+        * js/regress/hoist-make-rope.html: Added.
+        * js/regress/script-tests/hoist-make-rope.js: Added.
+        (foo):
+
 2014-05-19  Filip Pizlo  <[email protected]>
 
         [ftlopt] DFG bytecode parser should turn GetById with nothing but a Getter stub as stuff+handleCall, and handleCall should be allowed to inline if it wants to

Added: branches/ftlopt/LayoutTests/js/regress/hoist-make-rope-expected.txt (0 => 169188)


--- branches/ftlopt/LayoutTests/js/regress/hoist-make-rope-expected.txt	                        (rev 0)
+++ branches/ftlopt/LayoutTests/js/regress/hoist-make-rope-expected.txt	2014-05-22 04:11:15 UTC (rev 169188)
@@ -0,0 +1,10 @@
+JSRegress/hoist-make-rope
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS no exception thrown
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: branches/ftlopt/LayoutTests/js/regress/hoist-make-rope.html (0 => 169188)


--- branches/ftlopt/LayoutTests/js/regress/hoist-make-rope.html	                        (rev 0)
+++ branches/ftlopt/LayoutTests/js/regress/hoist-make-rope.html	2014-05-22 04:11:15 UTC (rev 169188)
@@ -0,0 +1,12 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<script src=""
+</head>
+<body>
+<script src=""
+<script src=""
+<script src=""
+<script src=""
+</body>
+</html>

Added: branches/ftlopt/LayoutTests/js/regress/script-tests/hoist-make-rope.js (0 => 169188)


--- branches/ftlopt/LayoutTests/js/regress/script-tests/hoist-make-rope.js	                        (rev 0)
+++ branches/ftlopt/LayoutTests/js/regress/script-tests/hoist-make-rope.js	2014-05-22 04:11:15 UTC (rev 169188)
@@ -0,0 +1,14 @@
+function foo(a, b) {
+    var result;
+    for (var i = 0; i < 10000; ++i)
+        result = a + b;
+    return result;
+}
+
+noInline(foo);
+
+for (var i = 0; i < 500; ++i) {
+    var result = foo("hello ", "world!");
+    if (result != "hello world!")
+        throw "Error: bad result: " + result;
+}

Modified: branches/ftlopt/Source/_javascript_Core/CMakeLists.txt (169187 => 169188)


--- branches/ftlopt/Source/_javascript_Core/CMakeLists.txt	2014-05-22 03:52:34 UTC (rev 169187)
+++ branches/ftlopt/Source/_javascript_Core/CMakeLists.txt	2014-05-22 04:11:15 UTC (rev 169188)
@@ -137,6 +137,7 @@
     dfg/DFGDesiredWeakReferences.cpp
     dfg/DFGDesiredWriteBarriers.cpp
     dfg/DFGDisassembler.cpp
+    dfg/DFGDoesGC.cpp
     dfg/DFGDominators.cpp
     dfg/DFGDriver.cpp
     dfg/DFGEdge.cpp

Modified: branches/ftlopt/Source/_javascript_Core/ChangeLog (169187 => 169188)


--- branches/ftlopt/Source/_javascript_Core/ChangeLog	2014-05-22 03:52:34 UTC (rev 169187)
+++ branches/ftlopt/Source/_javascript_Core/ChangeLog	2014-05-22 04:11:15 UTC (rev 169188)
@@ -1,5 +1,30 @@
 2014-05-21  Filip Pizlo  <[email protected]>
 
+        [ftlopt] DFG::clobberize should be blind to the effects of GC
+        https://bugs.webkit.org/show_bug.cgi?id=133166
+
+        Reviewed by Goeffrey Garen.
+        
+        Move the computation of where GCs happen to DFG::doesGC().
+        
+        Large (>5x) speed-up on programs that do loop-invariant string concatenations.
+
+        * CMakeLists.txt:
+        * _javascript_Core.vcxproj/_javascript_Core.vcxproj:
+        * _javascript_Core.xcodeproj/project.pbxproj:
+        * dfg/DFGAbstractHeap.h:
+        * dfg/DFGClobberize.h:
+        (JSC::DFG::clobberize):
+        (JSC::DFG::clobberizeForAllocation): Deleted.
+        * dfg/DFGDoesGC.cpp: Added.
+        (JSC::DFG::doesGC):
+        * dfg/DFGDoesGC.h: Added.
+        * dfg/DFGStoreBarrierElisionPhase.cpp:
+        (JSC::DFG::StoreBarrierElisionPhase::handleNode):
+        (JSC::DFG::StoreBarrierElisionPhase::couldCauseGC): Deleted.
+
+2014-05-21  Filip Pizlo  <[email protected]>
+
         Merge trunk r169184 to ftlopt.
 
     2014-05-21  Filip Pizlo  <[email protected]>

Modified: branches/ftlopt/Source/_javascript_Core/_javascript_Core.vcxproj/_javascript_Core.vcxproj (169187 => 169188)


--- branches/ftlopt/Source/_javascript_Core/_javascript_Core.vcxproj/_javascript_Core.vcxproj	2014-05-22 03:52:34 UTC (rev 169187)
+++ branches/ftlopt/Source/_javascript_Core/_javascript_Core.vcxproj/_javascript_Core.vcxproj	2014-05-22 04:11:15 UTC (rev 169188)
@@ -388,6 +388,7 @@
     <ClCompile Include="..\dfg\DFGDesiredWeakReferences.cpp" />
     <ClCompile Include="..\dfg\DFGDesiredWriteBarriers.cpp" />
     <ClCompile Include="..\dfg\DFGDisassembler.cpp" />
+    <ClCompile Include="..\dfg\DFGDoesGC.cpp" />
     <ClCompile Include="..\dfg\DFGDominators.cpp" />
     <ClCompile Include="..\dfg\DFGDriver.cpp" />
     <ClCompile Include="..\dfg\DFGEdge.cpp" />
@@ -943,6 +944,7 @@
     <ClInclude Include="..\dfg\DFGDesiredWeakReferences.h" />
     <ClInclude Include="..\dfg\DFGDesiredWriteBarriers.h" />
     <ClInclude Include="..\dfg\DFGDisassembler.h" />
+    <ClInclude Include="..\dfg\DFGDoesGC.h" />
     <ClInclude Include="..\dfg\DFGDominators.h" />
     <ClInclude Include="..\dfg\DFGDoubleFormatState.h" />
     <ClInclude Include="..\dfg\DFGDriver.h" />

Modified: branches/ftlopt/Source/_javascript_Core/_javascript_Core.xcodeproj/project.pbxproj (169187 => 169188)


--- branches/ftlopt/Source/_javascript_Core/_javascript_Core.xcodeproj/project.pbxproj	2014-05-22 03:52:34 UTC (rev 169187)
+++ branches/ftlopt/Source/_javascript_Core/_javascript_Core.xcodeproj/project.pbxproj	2014-05-22 04:11:15 UTC (rev 169188)
@@ -289,6 +289,8 @@
 		0F56A1D515001CF4002992B1 /* ExecutionCounter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0F56A1D415001CF2002992B1 /* ExecutionCounter.cpp */; };
 		0F572D4F16879FDD00E57FBD /* ThunkGenerator.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F572D4D16879FDB00E57FBD /* ThunkGenerator.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		0F5780A218FE1E98001E72D9 /* PureNaN.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F5780A118FE1E98001E72D9 /* PureNaN.h */; settings = {ATTRIBUTES = (Private, ); }; };
+		0F5A1273192D9FDF008764A3 /* DFGDoesGC.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0F5A1271192D9FDF008764A3 /* DFGDoesGC.cpp */; };
+		0F5A1274192D9FDF008764A3 /* DFGDoesGC.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F5A1272192D9FDF008764A3 /* DFGDoesGC.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		0F5A52D017ADD717008ECB2D /* CopyToken.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F5A52CF17ADD717008ECB2D /* CopyToken.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		0F5A6283188C98D40072C9DF /* FTLValueRange.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0F5A6281188C98D40072C9DF /* FTLValueRange.cpp */; };
 		0F5A6284188C98D40072C9DF /* FTLValueRange.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F5A6282188C98D40072C9DF /* FTLValueRange.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -2096,6 +2098,8 @@
 		0F56A1D415001CF2002992B1 /* ExecutionCounter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ExecutionCounter.cpp; sourceTree = "<group>"; };
 		0F572D4D16879FDB00E57FBD /* ThunkGenerator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ThunkGenerator.h; sourceTree = "<group>"; };
 		0F5780A118FE1E98001E72D9 /* PureNaN.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PureNaN.h; sourceTree = "<group>"; };
+		0F5A1271192D9FDF008764A3 /* DFGDoesGC.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DFGDoesGC.cpp; path = dfg/DFGDoesGC.cpp; sourceTree = "<group>"; };
+		0F5A1272192D9FDF008764A3 /* DFGDoesGC.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DFGDoesGC.h; path = dfg/DFGDoesGC.h; sourceTree = "<group>"; };
 		0F5A52CF17ADD717008ECB2D /* CopyToken.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CopyToken.h; sourceTree = "<group>"; };
 		0F5A6281188C98D40072C9DF /* FTLValueRange.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = FTLValueRange.cpp; path = ftl/FTLValueRange.cpp; sourceTree = "<group>"; };
 		0F5A6282188C98D40072C9DF /* FTLValueRange.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = FTLValueRange.h; path = ftl/FTLValueRange.h; sourceTree = "<group>"; };
@@ -4674,6 +4678,8 @@
 				C2981FDB17BAFF4400A3BC98 /* DFGDesiredWriteBarriers.h */,
 				0FF427611591A1C9004CB9FF /* DFGDisassembler.cpp */,
 				0FF427621591A1C9004CB9FF /* DFGDisassembler.h */,
+				0F5A1271192D9FDF008764A3 /* DFGDoesGC.cpp */,
+				0F5A1272192D9FDF008764A3 /* DFGDoesGC.h */,
 				0FD81ACF154FB4EB00983E72 /* DFGDominators.cpp */,
 				0FD81AD0154FB4EB00983E72 /* DFGDominators.h */,
 				0F1E3A441534CBAD000F9456 /* DFGDoubleFormatState.h */,
@@ -4694,6 +4700,8 @@
 				0F9D339517FFC4E60073C2BC /* DFGFlushedAt.h */,
 				A7D89CE817A0B8CC00773AD8 /* DFGFlushFormat.cpp */,
 				A7D89CE917A0B8CC00773AD8 /* DFGFlushFormat.h */,
+				2A88067619107D5500CB0BBB /* DFGFunctionWhitelist.cpp */,
+				2A88067719107D5500CB0BBB /* DFGFunctionWhitelist.h */,
 				86EC9DB61328DF82002B2AD7 /* DFGGenerationInfo.h */,
 				86EC9DB71328DF82002B2AD7 /* DFGGraph.cpp */,
 				86EC9DB81328DF82002B2AD7 /* DFGGraph.h */,
@@ -4834,8 +4842,6 @@
 				0FC97F3C18202119002C9B26 /* DFGWatchpointCollectionPhase.h */,
 				0FDB2CE5174830A2007B3C1B /* DFGWorklist.cpp */,
 				0FDB2CE6174830A2007B3C1B /* DFGWorklist.h */,
-				2A88067619107D5500CB0BBB /* DFGFunctionWhitelist.cpp */,
-				2A88067719107D5500CB0BBB /* DFGFunctionWhitelist.h */,
 			);
 			name = dfg;
 			sourceTree = "<group>";
@@ -5960,6 +5966,7 @@
 				0F2B66F217B6B5AB00A7AE3F /* JSGenericTypedArrayViewConstructor.h in Headers */,
 				0F2B66F317B6B5AB00A7AE3F /* JSGenericTypedArrayViewConstructorInlines.h in Headers */,
 				0F2B66F417B6B5AB00A7AE3F /* JSGenericTypedArrayViewInlines.h in Headers */,
+				0F5A1274192D9FDF008764A3 /* DFGDoesGC.h in Headers */,
 				0F2B66F517B6B5AB00A7AE3F /* JSGenericTypedArrayViewPrototype.h in Headers */,
 				0F2B66F617B6B5AB00A7AE3F /* JSGenericTypedArrayViewPrototypeInlines.h in Headers */,
 				BC18C4210E16F5CD00B34460 /* JSGlobalObject.h in Headers */,
@@ -7049,6 +7056,7 @@
 				0F235BE117178E1C00690C7F /* FTLThunks.cpp in Sources */,
 				0F6B1CC51862C47800845D97 /* FTLUnwindInfo.cpp in Sources */,
 				0F235BE317178E1C00690C7F /* FTLValueFormat.cpp in Sources */,
+				0F5A1273192D9FDF008764A3 /* DFGDoesGC.cpp in Sources */,
 				A53CE08718BC1A5600BEDF76 /* JSConsole.cpp in Sources */,
 				0F5A6283188C98D40072C9DF /* FTLValueRange.cpp in Sources */,
 				147F39CB107EC37600427A48 /* FunctionConstructor.cpp in Sources */,

Modified: branches/ftlopt/Source/_javascript_Core/dfg/DFGAbstractHeap.h (169187 => 169188)


--- branches/ftlopt/Source/_javascript_Core/dfg/DFGAbstractHeap.h	2014-05-22 03:52:34 UTC (rev 169187)
+++ branches/ftlopt/Source/_javascript_Core/dfg/DFGAbstractHeap.h	2014-05-22 04:11:15 UTC (rev 169188)
@@ -70,8 +70,7 @@
     macro(ArrayStorageProperties) \
     macro(Variables) \
     macro(TypedArrayProperties) \
-    macro(GCState) \
-    macro(BarrierState) \
+    macro(HeapObjectCount) /* Used to reflect the fact that some allocations reveal object identity */\
     macro(RegExpState) \
     macro(InternalState) \
     macro(Absolute) \

Modified: branches/ftlopt/Source/_javascript_Core/dfg/DFGClobberize.h (169187 => 169188)


--- branches/ftlopt/Source/_javascript_Core/dfg/DFGClobberize.h	2014-05-22 03:52:34 UTC (rev 169187)
+++ branches/ftlopt/Source/_javascript_Core/dfg/DFGClobberize.h	2014-05-22 04:11:15 UTC (rev 169188)
@@ -35,15 +35,6 @@
 namespace JSC { namespace DFG {
 
 template<typename ReadFunctor, typename WriteFunctor>
-void clobberizeForAllocation(ReadFunctor& read, WriteFunctor& write)
-{
-    read(GCState);
-    read(BarrierState);
-    write(GCState);
-    write(BarrierState);
-}
-
-template<typename ReadFunctor, typename WriteFunctor>
 void clobberize(Graph& graph, Node* node, ReadFunctor& read, WriteFunctor& write)
 {
     // Some notes:
@@ -131,6 +122,7 @@
     case DoubleRep:
     case ValueRep:
     case Int52Rep:
+    case MakeRope:
         return;
         
     case MovHint:
@@ -156,6 +148,8 @@
     case Breakpoint:
     case ProfileWillCall:
     case ProfileDidCall:
+    case StoreBarrier:
+    case StoreBarrierWithNullCheck:
         write(SideState);
         return;
         
@@ -172,7 +166,8 @@
 
     case CreateActivation:
     case CreateArguments:
-        clobberizeForAllocation(read, write);
+        read(HeapObjectCount);
+        write(HeapObjectCount);
         write(SideState);
         write(Watchpoint_fire);
         return;
@@ -184,7 +179,8 @@
     case ToThis:
     case CreateThis:
         read(MiscFields);
-        clobberizeForAllocation(read, write);
+        read(HeapObjectCount);
+        write(HeapObjectCount);
         return;
 
     case VarInjectionWatchpoint:
@@ -451,13 +447,11 @@
         
     case AllocatePropertyStorage:
         write(JSObject_butterfly);
-        clobberizeForAllocation(read, write);
         return;
         
     case ReallocatePropertyStorage:
         read(JSObject_butterfly);
         write(JSObject_butterfly);
-        clobberizeForAllocation(read, write);
         return;
         
     case GetButterfly:
@@ -472,7 +466,6 @@
         write(JSCell_structureID);
         write(JSCell_indexingType);
         write(JSObject_butterfly);
-        clobberizeForAllocation(read, write);
         return;
         
     case GetIndexedPropertyStorage:
@@ -505,10 +498,8 @@
         write(AbstractHeap(NamedProperties, node->multiPutByOffsetData().identifierNumber));
         if (node->multiPutByOffsetData().writesStructures())
             write(JSCell_structureID);
-        if (node->multiPutByOffsetData().reallocatesStorage()) {
+        if (node->multiPutByOffsetData().reallocatesStorage())
             write(JSObject_butterfly);
-            clobberizeForAllocation(read, write);
-        }
         return;
         
     case PutByOffset:
@@ -574,15 +565,16 @@
     case NewArrayBuffer:
     case NewRegexp:
     case NewStringObject:
-    case MakeRope:
     case NewFunctionNoCheck:
     case NewFunction:
     case NewFunctionExpression:
-        clobberizeForAllocation(read, write);
+        read(HeapObjectCount);
+        write(HeapObjectCount);
         return;
         
     case NewTypedArray:
-        clobberizeForAllocation(read, write);
+        read(HeapObjectCount);
+        write(HeapObjectCount);
         switch (node->child1().useKind()) {
         case Int32Use:
             return;
@@ -660,7 +652,8 @@
 
     case ThrowReferenceError:
         write(SideState);
-        clobberizeForAllocation(read, write);
+        read(HeapObjectCount);
+        write(HeapObjectCount);
         return;
         
     case CountExecution:
@@ -668,12 +661,6 @@
         read(InternalState);
         write(InternalState);
         return;
-
-    case StoreBarrier:
-    case StoreBarrierWithNullCheck:
-        read(BarrierState);
-        write(BarrierState);
-        return;
         
     case LastNodeType:
         RELEASE_ASSERT_NOT_REACHED();

Added: branches/ftlopt/Source/_javascript_Core/dfg/DFGDoesGC.cpp (0 => 169188)


--- branches/ftlopt/Source/_javascript_Core/dfg/DFGDoesGC.cpp	                        (rev 0)
+++ branches/ftlopt/Source/_javascript_Core/dfg/DFGDoesGC.cpp	2014-05-22 04:11:15 UTC (rev 169188)
@@ -0,0 +1,228 @@
+/*
+ * Copyright (C) 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
+ * 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 "DFGDoesGC.h"
+
+#include "DFGGraph.h"
+#include "DFGNode.h"
+#include "Operations.h"
+
+namespace JSC { namespace DFG {
+
+bool doesGC(Graph& graph, Node* node)
+{
+    if (graph.clobbersWorld(node))
+        return true;
+    
+    // Now consider nodes that don't clobber the world but that still may GC. This includes all
+    // nodes. By convention we put world-clobbering nodes in the block of "false" cases but we can
+    // put them anywhere.
+    switch (node->op()) {
+    case JSConstant:
+    case DoubleConstant:
+    case Int52Constant:
+    case WeakJSConstant:
+    case Identity:
+    case GetCallee:
+    case GetLocal:
+    case SetLocal:
+    case MovHint:
+    case ZombieHint:
+    case GetArgument:
+    case Phantom:
+    case HardPhantom:
+    case Upsilon:
+    case Phi:
+    case Flush:
+    case PhantomLocal:
+    case GetLocalUnlinked:
+    case SetArgument:
+    case BitAnd:
+    case BitOr:
+    case BitXor:
+    case BitLShift:
+    case BitRShift:
+    case BitURShift:
+    case ValueToInt32:
+    case UInt32ToNumber:
+    case DoubleAsInt32:
+    case ArithAdd:
+    case ArithSub:
+    case ArithNegate:
+    case ArithMul:
+    case ArithIMul:
+    case ArithDiv:
+    case ArithMod:
+    case ArithAbs:
+    case ArithMin:
+    case ArithMax:
+    case ArithSqrt:
+    case ArithFRound:
+    case ArithSin:
+    case ArithCos:
+    case ValueAdd:
+    case GetById:
+    case GetByIdFlush:
+    case PutById:
+    case PutByIdFlush:
+    case PutByIdDirect:
+    case CheckStructure:
+    case CheckExecutable:
+    case GetButterfly:
+    case CheckArray:
+    case GetScope:
+    case GetMyScope:
+    case SkipTopScope:
+    case SkipScope:
+    case GetClosureRegisters:
+    case GetClosureVar:
+    case PutClosureVar:
+    case GetGlobalVar:
+    case PutGlobalVar:
+    case VariableWatchpoint:
+    case VarInjectionWatchpoint:
+    case CheckFunction:
+    case AllocationProfileWatchpoint:
+    case RegExpExec:
+    case RegExpTest:
+    case CompareLess:
+    case CompareLessEq:
+    case CompareGreater:
+    case CompareGreaterEq:
+    case CompareEq:
+    case CompareEqConstant:
+    case CompareStrictEq:
+    case Call:
+    case Construct:
+    case Breakpoint:
+    case ProfileWillCall:
+    case ProfileDidCall:
+    case CheckHasInstance:
+    case InstanceOf:
+    case IsUndefined:
+    case IsBoolean:
+    case IsNumber:
+    case IsString:
+    case IsObject:
+    case IsFunction:
+    case TypeOf:
+    case LogicalNot:
+    case ToPrimitive:
+    case ToString:
+    case In:
+    case TearOffActivation:
+    case PhantomArguments:
+    case TearOffArguments:
+    case GetMyArgumentsLength:
+    case GetMyArgumentByVal:
+    case GetMyArgumentsLengthSafe:
+    case GetMyArgumentByValSafe:
+    case CheckArgumentsNotCreated:
+    case Jump:
+    case Branch:
+    case Switch:
+    case Return:
+    case Throw:
+    case CountExecution:
+    case ForceOSRExit:
+    case CheckWatchdogTimer:
+    case StringFromCharCode:
+    case Unreachable:
+    case ExtractOSREntryLocal:
+    case CheckTierUpInLoop:
+    case CheckTierUpAtReturn:
+    case CheckTierUpAndOSREnter:
+    case LoopHint:
+    case StoreBarrier:
+    case StoreBarrierWithNullCheck:
+    case InvalidationPoint:
+    case NotifyWrite:
+    case FunctionReentryWatchpoint:
+    case TypedArrayWatchpoint:
+    case CheckInBounds:
+    case ConstantStoragePointer:
+    case Check:
+    case MultiGetByOffset:
+    case ValueRep:
+    case DoubleRep:
+    case Int52Rep:
+    case GetGetter:
+    case GetSetter:
+    case GetByVal:
+    case GetIndexedPropertyStorage:
+    case GetArrayLength:
+    case ArrayPush:
+    case ArrayPop:
+    case StringCharAt:
+    case StringCharCodeAt:
+    case GetTypedArrayByteOffset:
+    case PutByValDirect:
+    case PutByVal:
+    case PutByValAlias:
+    case StructureTransitionWatchpoint:
+    case PutStructure:
+    case PhantomPutStructure:
+    case GetByOffset:
+    case GetGetterSetterByOffset:
+    case PutByOffset:
+        return false;
+
+    case CreateActivation:
+    case CreateArguments:
+    case ToThis:
+    case CreateThis:
+    case AllocatePropertyStorage:
+    case ReallocatePropertyStorage:
+    case Arrayify:
+    case ArrayifyToStructure:
+    case NewObject:
+    case NewArray:
+    case NewArrayWithSize:
+    case NewArrayBuffer:
+    case NewRegexp:
+    case NewStringObject:
+    case MakeRope:
+    case NewFunctionNoCheck:
+    case NewFunction:
+    case NewFunctionExpression:
+    case NewTypedArray:
+    case ThrowReferenceError:
+        return true;
+        
+    case MultiPutByOffset:
+        return node->multiPutByOffsetData().reallocatesStorage();
+
+    case LastNodeType:
+        RELEASE_ASSERT_NOT_REACHED();
+        return true;
+    }
+    
+    RELEASE_ASSERT_NOT_REACHED();
+    return true;
+}
+
+} } // namespace JSC::DFG
+

Added: branches/ftlopt/Source/_javascript_Core/dfg/DFGDoesGC.h (0 => 169188)


--- branches/ftlopt/Source/_javascript_Core/dfg/DFGDoesGC.h	                        (rev 0)
+++ branches/ftlopt/Source/_javascript_Core/dfg/DFGDoesGC.h	2014-05-22 04:11:15 UTC (rev 169188)
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 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
+ * 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 DFGDoesGC_h
+#define DFGDoesGC_h
+
+#if ENABLE(DFG_JIT)
+
+namespace JSC { namespace DFG {
+
+class Graph;
+struct Node;
+
+bool doesGC(Graph&, Node*);
+
+} } // namespace JSC::DFG
+
+#endif // ENABLE(DFG_JIT)
+
+#endif // DFGDoesGC_h
+

Modified: branches/ftlopt/Source/_javascript_Core/dfg/DFGStoreBarrierElisionPhase.cpp (169187 => 169188)


--- branches/ftlopt/Source/_javascript_Core/dfg/DFGStoreBarrierElisionPhase.cpp	2014-05-22 03:52:34 UTC (rev 169187)
+++ branches/ftlopt/Source/_javascript_Core/dfg/DFGStoreBarrierElisionPhase.cpp	2014-05-22 04:11:15 UTC (rev 169188)
@@ -30,6 +30,7 @@
 
 #include "DFGBasicBlock.h"
 #include "DFGClobberize.h"
+#include "DFGDoesGC.h"
 #include "DFGGraph.h"
 #include "DFGPhase.h"
 #include "JSCInlines.h"
@@ -58,11 +59,6 @@
     }
 
 private:
-    bool couldCauseGC(Node* node)
-    {
-        return writesOverlap(m_graph, node, GCState);
-    }
-
     bool allocatesFreshObject(Node* node)
     {
         switch (node->op()) {
@@ -104,7 +100,7 @@
 
     void handleNode(HashSet<Node*>& dontNeedBarriers, Node* node)
     {
-        if (couldCauseGC(node))
+        if (doesGC(m_graph, node))
             dontNeedBarriers.clear();
 
         if (allocatesFreshObject(node))
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to