Title: [255460] trunk/Source
Revision
255460
Author
ysuz...@apple.com
Date
2020-01-30 14:50:18 -0800 (Thu, 30 Jan 2020)

Log Message

[WTF] Remove PackedIntVector
https://bugs.webkit.org/show_bug.cgi?id=207018

Reviewed by Mark Lam.

Source/_javascript_Core:

* bytecode/BytecodeBasicBlock.h:

Source/WTF:

Simply removing PackedIntVector since (1) nobody uses it, (2) it is somewhat broken (like, size()), and (3) its implementation is not so efficient.
If we want to have this feature, we can recreate it.

* WTF.xcodeproj/project.pbxproj:
* wtf/CMakeLists.txt:
* wtf/PackedIntVector.h: Removed.

Modified Paths

Removed Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (255459 => 255460)


--- trunk/Source/_javascript_Core/ChangeLog	2020-01-30 22:32:43 UTC (rev 255459)
+++ trunk/Source/_javascript_Core/ChangeLog	2020-01-30 22:50:18 UTC (rev 255460)
@@ -1,5 +1,14 @@
 2020-01-30  Yusuke Suzuki  <ysuz...@apple.com>
 
+        [WTF] Remove PackedIntVector
+        https://bugs.webkit.org/show_bug.cgi?id=207018
+
+        Reviewed by Mark Lam.
+
+        * bytecode/BytecodeBasicBlock.h:
+
+2020-01-30  Yusuke Suzuki  <ysuz...@apple.com>
+
         [JSC] Remove unnecessary allocations in BytecodeBasicBlock
         https://bugs.webkit.org/show_bug.cgi?id=206986
 

Modified: trunk/Source/_javascript_Core/bytecode/BytecodeBasicBlock.h (255459 => 255460)


--- trunk/Source/_javascript_Core/bytecode/BytecodeBasicBlock.h	2020-01-30 22:32:43 UTC (rev 255459)
+++ trunk/Source/_javascript_Core/bytecode/BytecodeBasicBlock.h	2020-01-30 22:50:18 UTC (rev 255460)
@@ -29,7 +29,6 @@
 #include "Opcode.h"
 #include <limits.h>
 #include <wtf/FastBitVector.h>
-#include <wtf/PackedIntVector.h>
 #include <wtf/Vector.h>
 
 namespace JSC {

Modified: trunk/Source/WTF/ChangeLog (255459 => 255460)


--- trunk/Source/WTF/ChangeLog	2020-01-30 22:32:43 UTC (rev 255459)
+++ trunk/Source/WTF/ChangeLog	2020-01-30 22:50:18 UTC (rev 255460)
@@ -1,3 +1,17 @@
+2020-01-30  Yusuke Suzuki  <ysuz...@apple.com>
+
+        [WTF] Remove PackedIntVector
+        https://bugs.webkit.org/show_bug.cgi?id=207018
+
+        Reviewed by Mark Lam.
+
+        Simply removing PackedIntVector since (1) nobody uses it, (2) it is somewhat broken (like, size()), and (3) its implementation is not so efficient.
+        If we want to have this feature, we can recreate it.
+
+        * WTF.xcodeproj/project.pbxproj:
+        * wtf/CMakeLists.txt:
+        * wtf/PackedIntVector.h: Removed.
+
 2020-01-30  Jonathan Bedard  <jbed...@apple.com>
 
         PAL: Remove old iOS version macros

Modified: trunk/Source/WTF/WTF.xcodeproj/project.pbxproj (255459 => 255460)


--- trunk/Source/WTF/WTF.xcodeproj/project.pbxproj	2020-01-30 22:32:43 UTC (rev 255459)
+++ trunk/Source/WTF/WTF.xcodeproj/project.pbxproj	2020-01-30 22:50:18 UTC (rev 255460)
@@ -590,7 +590,6 @@
 		A8A472D7151A825B004123FF /* OSAllocator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OSAllocator.h; sourceTree = "<group>"; };
 		A8A472DA151A825B004123FF /* OSRandomSource.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = OSRandomSource.cpp; sourceTree = "<group>"; };
 		A8A472DB151A825B004123FF /* OSRandomSource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OSRandomSource.h; sourceTree = "<group>"; };
-		A8A472DF151A825B004123FF /* PackedIntVector.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PackedIntVector.h; sourceTree = "<group>"; };
 		A8A472E0151A825B004123FF /* PageAllocation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PageAllocation.h; sourceTree = "<group>"; };
 		A8A472E3151A825B004123FF /* PageBlock.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PageBlock.cpp; sourceTree = "<group>"; };
 		A8A472E4151A825B004123FF /* PageBlock.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PageBlock.h; sourceTree = "<group>"; };
@@ -1114,7 +1113,6 @@
 				A8A472DA151A825B004123FF /* OSRandomSource.cpp */,
 				A8A472DB151A825B004123FF /* OSRandomSource.h */,
 				E34CD0D022810A020020D299 /* Packed.h */,
-				A8A472DF151A825B004123FF /* PackedIntVector.h */,
 				E36895CB23A445CD008DD4C8 /* PackedRef.h */,
 				E36895CC23A445EE008DD4C8 /* PackedRefPtr.h */,
 				A8A472E0151A825B004123FF /* PageAllocation.h */,

Modified: trunk/Source/WTF/wtf/CMakeLists.txt (255459 => 255460)


--- trunk/Source/WTF/wtf/CMakeLists.txt	2020-01-30 22:32:43 UTC (rev 255459)
+++ trunk/Source/WTF/wtf/CMakeLists.txt	2020-01-30 22:50:18 UTC (rev 255460)
@@ -159,7 +159,6 @@
     Packed.h
     PackedRef.h
     PackedRefPtr.h
-    PackedIntVector.h
     PageAllocation.h
     PageBlock.h
     PageReservation.h

Deleted: trunk/Source/WTF/wtf/PackedIntVector.h (255459 => 255460)


--- trunk/Source/WTF/wtf/PackedIntVector.h	2020-01-30 22:32:43 UTC (rev 255459)
+++ trunk/Source/WTF/wtf/PackedIntVector.h	2020-01-30 22:50:18 UTC (rev 255460)
@@ -1,124 +0,0 @@
-/*
- * Copyright (C) 2011 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. 
- */
-
-#pragma once
-
-#include <wtf/BitVector.h>
-
-namespace WTF {
-
-// This class allows you to create an array of integers, where those
-// integers have only a handful of bits each. It is not meant to be
-// efficient in time, but only in space. (Though making it efficient
-// in time for power-of-2 values of bitCount would not be difficult.)
-// Note that this does not work as expected for signed types, if you
-// are relying on the sign being preserved.
-
-template<typename T, unsigned bitCount>
-class PackedIntVector final {
-    WTF_MAKE_FAST_ALLOCATED;
-public:
-    static_assert(bitCount, "bitCount must not be zero!");
-    static_assert(bitCount < sizeof(void*) * 8, "bitCount must not exceed the address space limit!");
-
-    PackedIntVector()
-    {
-    }
-    
-    PackedIntVector(const PackedIntVector& other)
-        : m_bits(other.m_bits)
-    {
-    }
-    
-    PackedIntVector& operator=(const PackedIntVector& other)
-    {
-        m_bits = other.m_bits;
-        return *this;
-    }
-    
-    size_t size() const
-    {
-        return m_bits.size() / bitCount;
-    }
-    
-    void ensureSize(size_t numInts)
-    {
-        m_bits.ensureSize(numInts * bitCount);
-    }
-    
-    void resize(size_t numInts)
-    {
-        m_bits.resize(numInts * bitCount);
-    }
-    
-    void clearAll()
-    {
-        m_bits.clearAll();
-    }
-    
-    T get(size_t index) const
-    {
-        uintptr_t result = 0;
-        for (unsigned subIndex = 0; subIndex < bitCount; ++subIndex) {
-            result <<= 1;
-            result |= (m_bits.quickGet(index * bitCount + subIndex) ? 1 : 0);
-        }
-        return static_cast<T>(result);
-    }
-    
-    void set(size_t index, T value)
-    {
-        // Do arithmetic using uintptr_t, because (1) we know what it is
-        // (T might be an enum) and (2) it's the largest integer type that
-        // is likely to perform decently well.
-        uintptr_t myValue = static_cast<uintptr_t>(value);
-        
-        // Preliminary sanity check that the value is not out of range.
-        ASSERT((myValue & mask()) == myValue);
-        
-        for (unsigned subIndex = bitCount; subIndex-- > 0;) {
-            m_bits.quickSet(index * bitCount + subIndex, !!(myValue & 1));
-            myValue >>= 1;
-        }
-        
-        // Final sanity check that we stored what the user thought we
-        // stored.
-        ASSERT(get(index) == value);
-    }
-private:
-    // This returns the mask, and is careful to not step on the wrap-around
-    // semantics of the shift amount (1 << 32 is 1 since 32 wraps to 0). There
-    // is the separate question of why you would ever use this to store 32-bit
-    // or 64-bit values, but it's probably better to have this work as expected
-    // in such situations regardless.
-    static uintptr_t mask() { return (static_cast<uintptr_t>(2) << (bitCount - 1)) - 1; }
-               
-    // Stores integers bit by bit in big endian.
-    BitVector m_bits;
-};
-
-} // namespace WTF
-
-using WTF::PackedIntVector;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to