Diff
Modified: trunk/Source/_javascript_Core/ChangeLog (157575 => 157576)
--- trunk/Source/_javascript_Core/ChangeLog 2013-10-17 15:17:23 UTC (rev 157575)
+++ trunk/Source/_javascript_Core/ChangeLog 2013-10-17 15:47:22 UTC (rev 157576)
@@ -84,6 +84,30 @@
2013-10-16 Filip Pizlo <fpi...@apple.com>
+ Introduce WTF::Bag and start using it for InlineCallFrameSet
+ https://bugs.webkit.org/show_bug.cgi?id=122941
+
+ Reviewed by Geoffrey Garen.
+
+ Use Bag for InlineCallFrameSet. If this works out then I'll make other
+ SegmentedVectors into Bags as well.
+
+ * bytecode/InlineCallFrameSet.cpp:
+ (JSC::InlineCallFrameSet::add):
+ * bytecode/InlineCallFrameSet.h:
+ (JSC::InlineCallFrameSet::begin):
+ (JSC::InlineCallFrameSet::end):
+ * dfg/DFGArgumentsSimplificationPhase.cpp:
+ (JSC::DFG::ArgumentsSimplificationPhase::run):
+ * dfg/DFGJITCompiler.cpp:
+ (JSC::DFG::JITCompiler::link):
+ * dfg/DFGStackLayoutPhase.cpp:
+ (JSC::DFG::StackLayoutPhase::run):
+ * dfg/DFGVirtualRegisterAllocationPhase.cpp:
+ (JSC::DFG::VirtualRegisterAllocationPhase::run):
+
+2013-10-16 Filip Pizlo <fpi...@apple.com>
+
libllvmForJSC shouldn't call exit(1) on report_fatal_error()
https://bugs.webkit.org/show_bug.cgi?id=122905
<rdar://problem/15237856>
Modified: trunk/Source/_javascript_Core/bytecode/InlineCallFrameSet.cpp (157575 => 157576)
--- trunk/Source/_javascript_Core/bytecode/InlineCallFrameSet.cpp 2013-10-17 15:17:23 UTC (rev 157575)
+++ trunk/Source/_javascript_Core/bytecode/InlineCallFrameSet.cpp 2013-10-17 15:47:22 UTC (rev 157576)
@@ -33,14 +33,8 @@
InlineCallFrame* InlineCallFrameSet::add()
{
- m_frames.append(InlineCallFrame());
- return &m_frames.last();
+ return m_frames.add();
}
-void InlineCallFrameSet::shrinkToFit()
-{
- m_frames.shrinkToFit();
-}
-
} // namespace JSC
Modified: trunk/Source/_javascript_Core/bytecode/InlineCallFrameSet.h (157575 => 157576)
--- trunk/Source/_javascript_Core/bytecode/InlineCallFrameSet.h 2013-10-17 15:17:23 UTC (rev 157575)
+++ trunk/Source/_javascript_Core/bytecode/InlineCallFrameSet.h 2013-10-17 15:47:22 UTC (rev 157576)
@@ -27,8 +27,8 @@
#define InlineCallFrameSet_h
#include "CodeOrigin.h"
+#include <wtf/Bag.h>
#include <wtf/Noncopyable.h>
-#include <wtf/SegmentedVector.h>
namespace JSC {
@@ -42,15 +42,12 @@
InlineCallFrame* add();
- // The only users of these methods just want to iterate all inline call frames.
- // There is no requirement for random access.
- unsigned size() const { return m_frames.size(); }
- InlineCallFrame* at(unsigned i) { return &m_frames[i]; }
+ typedef Bag<InlineCallFrame>::iterator iterator;
+ iterator begin() { return m_frames.begin(); }
+ iterator end() { return m_frames.end(); }
- void shrinkToFit();
-
private:
- SegmentedVector<InlineCallFrame, 4> m_frames;
+ Bag<InlineCallFrame> m_frames;
};
} // namespace JSC
Modified: trunk/Source/_javascript_Core/dfg/DFGArgumentsSimplificationPhase.cpp (157575 => 157576)
--- trunk/Source/_javascript_Core/dfg/DFGArgumentsSimplificationPhase.cpp 2013-10-17 15:17:23 UTC (rev 157575)
+++ trunk/Source/_javascript_Core/dfg/DFGArgumentsSimplificationPhase.cpp 2013-10-17 15:47:22 UTC (rev 157576)
@@ -122,8 +122,8 @@
bool changed = false;
// Record which arguments are known to escape no matter what.
- for (unsigned i = m_graph.m_inlineCallFrames->size(); i--;)
- pruneObviousArgumentCreations(m_graph.m_inlineCallFrames->at(i));
+ for (InlineCallFrameSet::iterator iter = m_graph.m_inlineCallFrames->begin(); !!iter; ++iter)
+ pruneObviousArgumentCreations(*iter);
pruneObviousArgumentCreations(0); // the machine call frame.
// Create data for variable access datas that we will want to analyze.
Modified: trunk/Source/_javascript_Core/dfg/DFGJITCompiler.cpp (157575 => 157576)
--- trunk/Source/_javascript_Core/dfg/DFGJITCompiler.cpp 2013-10-17 15:17:23 UTC (rev 157575)
+++ trunk/Source/_javascript_Core/dfg/DFGJITCompiler.cpp 2013-10-17 15:47:22 UTC (rev 157576)
@@ -158,10 +158,8 @@
dataLogF("JIT code for %p start at [%p, %p). Size = %zu.\n", m_codeBlock, linkBuffer.debugAddress(), static_cast<char*>(linkBuffer.debugAddress()) + linkBuffer.debugSize(), linkBuffer.debugSize());
#endif
- if (!m_graph.m_inlineCallFrames->isEmpty()) {
- m_graph.m_inlineCallFrames->shrinkToFit();
+ if (!m_graph.m_inlineCallFrames->isEmpty())
m_jitCode->common.inlineCallFrames = m_graph.m_inlineCallFrames.release();
- }
m_jitCode->common.machineCaptureStart = m_graph.m_machineCaptureStart;
m_jitCode->common.slowArguments = std::move(m_graph.m_slowArguments);
Modified: trunk/Source/_javascript_Core/dfg/DFGStackLayoutPhase.cpp (157575 => 157576)
--- trunk/Source/_javascript_Core/dfg/DFGStackLayoutPhase.cpp 2013-10-17 15:17:23 UTC (rev 157575)
+++ trunk/Source/_javascript_Core/dfg/DFGStackLayoutPhase.cpp 2013-10-17 15:47:22 UTC (rev 157576)
@@ -102,8 +102,8 @@
}
if (codeBlock()->uncheckedActivationRegister().isValid())
usedLocals.set(codeBlock()->activationRegister().toLocal());
- for (unsigned i = m_graph.m_inlineCallFrames->size(); i--;) {
- InlineCallFrame* inlineCallFrame = m_graph.m_inlineCallFrames->at(i);
+ for (InlineCallFrameSet::iterator iter = m_graph.m_inlineCallFrames->begin(); !!iter; ++iter) {
+ InlineCallFrame* inlineCallFrame = *iter;
if (!inlineCallFrame->executable->usesArguments())
continue;
@@ -166,8 +166,8 @@
virtualRegisterForLocal(allocation[codeBlock()->activationRegister().toLocal()]));
}
- for (unsigned i = m_graph.m_inlineCallFrames->size(); i--;) {
- InlineCallFrame* inlineCallFrame = m_graph.m_inlineCallFrames->at(i);
+ for (InlineCallFrameSet::iterator iter = m_graph.m_inlineCallFrames->begin(); !!iter; ++iter) {
+ InlineCallFrame* inlineCallFrame = *iter;
if (!inlineCallFrame->executable->usesArguments())
continue;
inlineCallFrame->argumentsRegister = virtualRegisterForLocal(
Modified: trunk/Source/_javascript_Core/dfg/DFGVirtualRegisterAllocationPhase.cpp (157575 => 157576)
--- trunk/Source/_javascript_Core/dfg/DFGVirtualRegisterAllocationPhase.cpp 2013-10-17 15:17:23 UTC (rev 157575)
+++ trunk/Source/_javascript_Core/dfg/DFGVirtualRegisterAllocationPhase.cpp 2013-10-17 15:47:22 UTC (rev 157576)
@@ -125,9 +125,8 @@
// that could be used by this code block even if it exits; it may be more
// than what this code block needs if it never exits.
unsigned calleeRegisters = scoreBoard.highWatermark() + m_graph.m_parameterSlots;
- size_t inlineCallFrameCount = m_graph.m_inlineCallFrames->size();
- for (size_t i = 0; i < inlineCallFrameCount; i++) {
- InlineCallFrame* inlineCallFrame = m_graph.m_inlineCallFrames->at(i);
+ for (InlineCallFrameSet::iterator iter = m_graph.m_inlineCallFrames->begin(); !!iter; ++iter) {
+ InlineCallFrame* inlineCallFrame = *iter;
CodeBlock* codeBlock = baselineCodeBlockForInlineCallFrame(inlineCallFrame);
unsigned requiredCalleeRegisters = VirtualRegister(inlineCallFrame->stackOffset).toLocal() + codeBlock->m_numCalleeRegisters;
if (requiredCalleeRegisters > calleeRegisters)
Modified: trunk/Source/WTF/ChangeLog (157575 => 157576)
--- trunk/Source/WTF/ChangeLog 2013-10-17 15:17:23 UTC (rev 157575)
+++ trunk/Source/WTF/ChangeLog 2013-10-17 15:47:22 UTC (rev 157576)
@@ -1,3 +1,30 @@
+2013-10-16 Filip Pizlo <fpi...@apple.com>
+
+ Introduce WTF::Bag and start using it for InlineCallFrameSet
+ https://bugs.webkit.org/show_bug.cgi?id=122941
+
+ Reviewed by Geoffrey Garen.
+
+ Introduce WTF::Bag, which is basically an allocation pool. No POD restrictions. Does one
+ malloc per entry. No need to shrink afterwards.
+
+ * GNUmakefile.list.am:
+ * WTF.vcxproj/WTF.vcxproj:
+ * WTF.xcodeproj/project.pbxproj:
+ * wtf/Bag.h: Added.
+ (WTF::Bag::Bag):
+ (WTF::Bag::~Bag):
+ (WTF::Bag::add):
+ (WTF::Bag::iterator::iterator):
+ (WTF::Bag::iterator::operator!):
+ (WTF::Bag::iterator::operator*):
+ (WTF::Bag::iterator::operator++):
+ (WTF::Bag::iterator::operator==):
+ (WTF::Bag::begin):
+ (WTF::Bag::end):
+ (WTF::Bag::isEmpty):
+ * wtf/CMakeLists.txt:
+
2013-10-17 Andreas Kling <akl...@apple.com>
Make it possible to assign a PassRef to a RefPtr.
Modified: trunk/Source/WTF/GNUmakefile.list.am (157575 => 157576)
--- trunk/Source/WTF/GNUmakefile.list.am 2013-10-17 15:17:23 UTC (rev 157575)
+++ trunk/Source/WTF/GNUmakefile.list.am 2013-10-17 15:47:22 UTC (rev 157576)
@@ -8,6 +8,7 @@
Source/WTF/wtf/Atomics.cpp \
Source/WTF/wtf/Atomics.h \
Source/WTF/wtf/AutodrainedPool.h \
+ Source/WTF/wtf/Bag.h \
Source/WTF/wtf/BitArray.h \
Source/WTF/wtf/BitVector.cpp \
Source/WTF/wtf/BitVector.h \
Modified: trunk/Source/WTF/WTF.vcxproj/WTF.vcxproj (157575 => 157576)
--- trunk/Source/WTF/WTF.vcxproj/WTF.vcxproj 2013-10-17 15:17:23 UTC (rev 157575)
+++ trunk/Source/WTF/WTF.vcxproj/WTF.vcxproj 2013-10-17 15:47:22 UTC (rev 157576)
@@ -122,6 +122,7 @@
<ClInclude Include="..\wtf\Atomics.h" />
<ClInclude Include="..\wtf\AutodrainedPool.h" />
<ClInclude Include="..\wtf\AVLTree.h" />
+ <ClInclude Include="..\wtf\Bag.h" />
<ClInclude Include="..\wtf\BitArray.h" />
<ClInclude Include="..\wtf\Bitmap.h" />
<ClInclude Include="..\wtf\BitVector.h" />
Modified: trunk/Source/WTF/WTF.xcodeproj/project.pbxproj (157575 => 157576)
--- trunk/Source/WTF/WTF.xcodeproj/project.pbxproj 2013-10-17 15:17:23 UTC (rev 157575)
+++ trunk/Source/WTF/WTF.xcodeproj/project.pbxproj 2013-10-17 15:47:22 UTC (rev 157576)
@@ -32,6 +32,7 @@
0F9D3361165DBA73005AD387 /* FilePrintStream.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F9D335C165DBA73005AD387 /* FilePrintStream.h */; };
0F9D3362165DBA73005AD387 /* PrintStream.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0F9D335D165DBA73005AD387 /* PrintStream.cpp */; };
0F9D3363165DBA73005AD387 /* PrintStream.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F9D335E165DBA73005AD387 /* PrintStream.h */; };
+ 0FB14E19180FA218009B6B4D /* Bag.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FB14E18180FA218009B6B4D /* Bag.h */; };
0FC4488316FE9FE100844BE9 /* ProcessID.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FC4488216FE9FE100844BE9 /* ProcessID.h */; };
0FC4EDE61696149600F65041 /* CommaPrinter.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FC4EDE51696149600F65041 /* CommaPrinter.h */; };
0FD81AC5154FB22E00983E72 /* FastBitVector.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FD81AC4154FB22E00983E72 /* FastBitVector.h */; settings = {ATTRIBUTES = (); }; };
@@ -287,6 +288,7 @@
0F9D335C165DBA73005AD387 /* FilePrintStream.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FilePrintStream.h; sourceTree = "<group>"; };
0F9D335D165DBA73005AD387 /* PrintStream.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PrintStream.cpp; sourceTree = "<group>"; };
0F9D335E165DBA73005AD387 /* PrintStream.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PrintStream.h; sourceTree = "<group>"; };
+ 0FB14E18180FA218009B6B4D /* Bag.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Bag.h; sourceTree = "<group>"; };
0FC4488216FE9FE100844BE9 /* ProcessID.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ProcessID.h; sourceTree = "<group>"; };
0FC4EDE51696149600F65041 /* CommaPrinter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CommaPrinter.h; sourceTree = "<group>"; };
0FD81AC4154FB22E00983E72 /* FastBitVector.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FastBitVector.h; sourceTree = "<group>"; };
@@ -605,6 +607,7 @@
1469419A16EAB10A0024E146 /* AutodrainedPool.h */,
1469419B16EAB10A0024E146 /* AutodrainedPoolMac.mm */,
A8A4725E151A825A004123FF /* AVLTree.h */,
+ 0FB14E18180FA218009B6B4D /* Bag.h */,
4F0321BB156AA8D1006EBAF6 /* BitArray.h */,
A8A4725F151A825A004123FF /* Bitmap.h */,
A8A47260151A825A004123FF /* BitVector.cpp */,
@@ -1004,6 +1007,7 @@
A8A4740C151A825B004123FF /* PassRefPtr.h in Headers */,
A876DBD8151816E500DADB95 /* Platform.h in Headers */,
A8A4740F151A825B004123FF /* PossiblyNull.h in Headers */,
+ 0FB14E19180FA218009B6B4D /* Bag.h in Headers */,
0F9D3363165DBA73005AD387 /* PrintStream.h in Headers */,
0FC4488316FE9FE100844BE9 /* ProcessID.h in Headers */,
143F61201565F0F900DB514A /* RAMSize.h in Headers */,
Added: trunk/Source/WTF/wtf/Bag.h (0 => 157576)
--- trunk/Source/WTF/wtf/Bag.h (rev 0)
+++ trunk/Source/WTF/wtf/Bag.h 2013-10-17 15:47:22 UTC (rev 157576)
@@ -0,0 +1,109 @@
+/*
+ * Copyright (C) 2013 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. AND ITS CONTRIBUTORS ``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 ITS 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 Bag_h
+#define Bag_h
+
+namespace WTF {
+
+template<typename T>
+class Bag {
+private:
+ struct Node {
+ T m_item;
+ Node* m_next;
+ };
+
+public:
+ Bag()
+ : m_head(0)
+ {
+ }
+
+ ~Bag()
+ {
+ while (m_head) {
+ Node* current = m_head;
+ m_head = current->m_next;
+ delete current;
+ }
+ }
+
+ T* add()
+ {
+ Node* newNode = new Node;
+ newNode->m_next = m_head;
+ m_head = newNode;
+ return &newNode->m_item;
+ }
+
+ class iterator {
+ public:
+ iterator()
+ : m_node(0)
+ {
+ }
+
+ // This is sort of cheating; it's equivalent to iter == end().
+ bool operator!() const { return !m_node; }
+
+ T* operator*() const { return &m_node->m_item; }
+
+ iterator& operator++()
+ {
+ m_node = m_node->m_next;
+ return *this;
+ }
+
+ bool operator==(const iterator& other) const
+ {
+ return m_node == other.m_node;
+ }
+ private:
+ template<typename U> friend class WTF::Bag;
+ Node* m_node;
+ };
+
+ iterator begin()
+ {
+ iterator result;
+ result.m_node = m_head;
+ return result;
+ }
+
+ iterator end() { return iterator(); }
+
+ bool isEmpty() const { return !m_head; }
+
+private:
+ Node* m_head;
+};
+
+} // namespace WTF
+
+using WTF::Bag;
+
+#endif // Bag_h
+
Modified: trunk/Source/WTF/wtf/CMakeLists.txt (157575 => 157576)
--- trunk/Source/WTF/wtf/CMakeLists.txt 2013-10-17 15:17:23 UTC (rev 157575)
+++ trunk/Source/WTF/wtf/CMakeLists.txt 2013-10-17 15:47:22 UTC (rev 157576)
@@ -3,6 +3,7 @@
AVLTree.h
Assertions.h
Atomics.h
+ Bag.h
BitArray.h
BitVector.h
Bitmap.h