- Revision
- 261050
- Author
- [email protected]
- Date
- 2020-05-02 10:03:42 -0700 (Sat, 02 May 2020)
Log Message
Allow Bitmap to use up to a UCPURegister word size for internal bit storage.
https://bugs.webkit.org/show_bug.cgi?id=211328
<rdar://problem/62755865>
Reviewed by Yusuke Suzuki.
Source/_javascript_Core:
* assembler/CPU.h:
Source/WTF:
1. Moved the definition of CPURegister and UCPURegister down into WTF.
2. Updated Bitmap so that it will automatically choose the minimal required
word size for the number of bits it needs to store. This means the Bitmap
can automatically choose a WordType from uint8_t up to UCPURegister.
Previously, the WordType is always uint32_t by default.
This should improve perf with use of Bitmap on 64-bit platforms. The size
optimization is necessary to prevent bloat on 64-bit platforms which would have
resulted if we simply set the default to always be UCPURegister.
* WTF.xcodeproj/project.pbxproj:
* wtf/Bitmap.h:
* wtf/CMakeLists.txt:
* wtf/StdIntExtras.h: Added.
Modified Paths
Diff
Modified: trunk/Source/_javascript_Core/ChangeLog (261049 => 261050)
--- trunk/Source/_javascript_Core/ChangeLog 2020-05-02 15:27:13 UTC (rev 261049)
+++ trunk/Source/_javascript_Core/ChangeLog 2020-05-02 17:03:42 UTC (rev 261050)
@@ -1,3 +1,13 @@
+2020-05-01 Mark Lam <[email protected]>
+
+ Allow Bitmap to use up to a UCPURegister word size for internal bit storage.
+ https://bugs.webkit.org/show_bug.cgi?id=211328
+ <rdar://problem/62755865>
+
+ Reviewed by Yusuke Suzuki.
+
+ * assembler/CPU.h:
+
2020-05-01 Saam Barati <[email protected]>
Have a thread local cache for the Wasm LLInt bytecode buffer
Modified: trunk/Source/_javascript_Core/assembler/CPU.h (261049 => 261050)
--- trunk/Source/_javascript_Core/assembler/CPU.h 2020-05-02 15:27:13 UTC (rev 261049)
+++ trunk/Source/_javascript_Core/assembler/CPU.h 2020-05-02 17:03:42 UTC (rev 261050)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2008-2019 Apple Inc. All rights reserved.
+ * Copyright (C) 2008-2020 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,17 +27,10 @@
#include "Options.h"
#include <wtf/NumberOfCores.h>
+#include <wtf/StdIntExtras.h>
namespace JSC {
-#if USE(JSVALUE64)
-using CPURegister = int64_t;
-using UCPURegister = uint64_t;
-#else
-using CPURegister = int32_t;
-using UCPURegister = uint32_t;
-#endif
-
using UCPUStrictInt32 = UCPURegister;
constexpr bool isARMv7IDIVSupported()
Modified: trunk/Source/WTF/ChangeLog (261049 => 261050)
--- trunk/Source/WTF/ChangeLog 2020-05-02 15:27:13 UTC (rev 261049)
+++ trunk/Source/WTF/ChangeLog 2020-05-02 17:03:42 UTC (rev 261050)
@@ -1,3 +1,26 @@
+2020-05-01 Mark Lam <[email protected]>
+
+ Allow Bitmap to use up to a UCPURegister word size for internal bit storage.
+ https://bugs.webkit.org/show_bug.cgi?id=211328
+ <rdar://problem/62755865>
+
+ Reviewed by Yusuke Suzuki.
+
+ 1. Moved the definition of CPURegister and UCPURegister down into WTF.
+ 2. Updated Bitmap so that it will automatically choose the minimal required
+ word size for the number of bits it needs to store. This means the Bitmap
+ can automatically choose a WordType from uint8_t up to UCPURegister.
+ Previously, the WordType is always uint32_t by default.
+
+ This should improve perf with use of Bitmap on 64-bit platforms. The size
+ optimization is necessary to prevent bloat on 64-bit platforms which would have
+ resulted if we simply set the default to always be UCPURegister.
+
+ * WTF.xcodeproj/project.pbxproj:
+ * wtf/Bitmap.h:
+ * wtf/CMakeLists.txt:
+ * wtf/StdIntExtras.h: Added.
+
2020-05-01 Saam Barati <[email protected]>
Have a thread local cache for the Wasm LLInt bytecode buffer
Modified: trunk/Source/WTF/WTF.xcodeproj/project.pbxproj (261049 => 261050)
--- trunk/Source/WTF/WTF.xcodeproj/project.pbxproj 2020-05-02 15:27:13 UTC (rev 261049)
+++ trunk/Source/WTF/WTF.xcodeproj/project.pbxproj 2020-05-02 17:03:42 UTC (rev 261050)
@@ -751,6 +751,7 @@
FE8225301B2A1E5B00BA68FD /* NakedPtr.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NakedPtr.h; sourceTree = "<group>"; };
FE86A8741E59440200111BBF /* ForbidHeapAllocation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ForbidHeapAllocation.h; sourceTree = "<group>"; };
FE8925AF1D00DAEC0046907E /* Indenter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Indenter.h; sourceTree = "<group>"; };
+ FE97F6A8245CE5DD00C63FC6 /* StdIntExtras.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StdIntExtras.h; sourceTree = "<group>"; };
FEB6B035201BE0B600B958C1 /* PointerPreparations.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PointerPreparations.h; sourceTree = "<group>"; };
FEDACD3B1630F83F00C69634 /* StackStats.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StackStats.cpp; sourceTree = "<group>"; };
FEDACD3C1630F83F00C69634 /* StackStats.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StackStats.h; sourceTree = "<group>"; };
@@ -1234,6 +1235,7 @@
FEDACD3C1630F83F00C69634 /* StackStats.h */,
313EDEC9778E49C9BEA91CFC /* StackTrace.cpp */,
EF7D6CD59D8642A8A0DA86AD /* StackTrace.h */,
+ FE97F6A8245CE5DD00C63FC6 /* StdIntExtras.h */,
A8A47311151A825B004123FF /* StdLibExtras.h */,
FF0A436588954F3CB07DBECA /* StdList.h */,
391BD6BA4D164FD294F9A93D /* StdMap.h */,
Modified: trunk/Source/WTF/wtf/Bitmap.h (261049 => 261050)
--- trunk/Source/WTF/wtf/Bitmap.h 2020-05-02 15:27:13 UTC (rev 261049)
+++ trunk/Source/WTF/wtf/Bitmap.h 2020-05-02 17:03:42 UTC (rev 261050)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2010-2019 Apple Inc. All rights reserved.
+ * Copyright (C) 2010-2020 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
@@ -22,17 +22,21 @@
#include <array>
#include <wtf/Atomics.h>
#include <wtf/HashFunctions.h>
+#include <wtf/StdIntExtras.h>
#include <wtf/StdLibExtras.h>
-#include <stdint.h>
#include <string.h>
+#include <type_traits>
namespace WTF {
-template<size_t bitmapSize, typename WordType = uint32_t>
+template<size_t size>
+using BitmapWordType = std::conditional_t<(size <= 32 && sizeof(UCPURegister) > sizeof(uint32_t)), uint32_t, UCPURegister>;
+
+template<size_t bitmapSize, typename WordType = BitmapWordType<bitmapSize>>
class Bitmap final {
WTF_MAKE_FAST_ALLOCATED;
- static_assert(sizeof(WordType) <= sizeof(unsigned), "WordType must not be bigger than unsigned");
+ static_assert(sizeof(WordType) <= sizeof(UCPURegister), "WordType must not be bigger than the CPU atomic word size");
public:
constexpr Bitmap();
Modified: trunk/Source/WTF/wtf/CMakeLists.txt (261049 => 261050)
--- trunk/Source/WTF/wtf/CMakeLists.txt 2020-05-02 15:27:13 UTC (rev 261049)
+++ trunk/Source/WTF/wtf/CMakeLists.txt 2020-05-02 17:03:42 UTC (rev 261050)
@@ -238,6 +238,7 @@
StackShotProfiler.h
StackStats.h
StackTrace.h
+ StdIntExtras.h
StdLibExtras.h
StdList.h
StdMap.h