Title: [253010] trunk/Source/_javascript_Core
Revision
253010
Author
tzaga...@apple.com
Date
2019-12-02 14:45:25 -0800 (Mon, 02 Dec 2019)

Log Message

[JSC] Remove BytecodeCacheVersion.h
https://bugs.webkit.org/show_bug.cgi?id=204760

Reviewed by Mark Lam.

Having that as a phony make target causes a lot of unnecessary rebuilds. That was a workaround
the fact that we only need a new cache version when we rebuild CachedTypes.cpp, but there was
no straightforward way to get the current timestamp as an integer at that point. Instead, we now
just use a constexpr function that hashes __TIMESTAMP__.

* CMakeLists.txt:
* DerivedSources-output.xcfilelist:
* DerivedSources.make:
* runtime/CachedTypes.cpp:
(JSC::jscBytecodeCacheVersion):
(JSC::GenericCacheEntry::isUpToDate const):

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/CMakeLists.txt (253009 => 253010)


--- trunk/Source/_javascript_Core/CMakeLists.txt	2019-12-02 22:30:59 UTC (rev 253009)
+++ trunk/Source/_javascript_Core/CMakeLists.txt	2019-12-02 22:45:25 UTC (rev 253010)
@@ -225,10 +225,7 @@
     string(TIMESTAMP BUILD_TIME "%s")
 endif ()
 
-file(WRITE ${_javascript_Core_DERIVED_SOURCES_DIR}/BytecodeCacheVersion.h "#define JSC_BYTECODE_CACHE_VERSION ${BUILD_TIME}\n")
-
 list(APPEND _javascript_Core_HEADERS
-    ${_javascript_Core_DERIVED_SOURCES_DIR}/BytecodeCacheVersion.h
     ${_javascript_Core_DERIVED_SOURCES_DIR}/BytecodeStructs.h
     ${_javascript_Core_DERIVED_SOURCES_DIR}/Bytecodes.h
 )

Modified: trunk/Source/_javascript_Core/ChangeLog (253009 => 253010)


--- trunk/Source/_javascript_Core/ChangeLog	2019-12-02 22:30:59 UTC (rev 253009)
+++ trunk/Source/_javascript_Core/ChangeLog	2019-12-02 22:45:25 UTC (rev 253010)
@@ -1,3 +1,22 @@
+2019-12-02  Tadeu Zagallo  <tzaga...@apple.com>
+
+        [JSC] Remove BytecodeCacheVersion.h
+        https://bugs.webkit.org/show_bug.cgi?id=204760
+
+        Reviewed by Mark Lam.
+
+        Having that as a phony make target causes a lot of unnecessary rebuilds. That was a workaround
+        the fact that we only need a new cache version when we rebuild CachedTypes.cpp, but there was
+        no straightforward way to get the current timestamp as an integer at that point. Instead, we now
+        just use a constexpr function that hashes __TIMESTAMP__.
+
+        * CMakeLists.txt:
+        * DerivedSources-output.xcfilelist:
+        * DerivedSources.make:
+        * runtime/CachedTypes.cpp:
+        (JSC::jscBytecodeCacheVersion):
+        (JSC::GenericCacheEntry::isUpToDate const):
+
 2019-12-02  Mark Lam  <mark....@apple.com>
 
         mozilla-tests.yaml/js1_5/Array/regress-101964.js is frequently failing on JSC EWS bots.

Modified: trunk/Source/_javascript_Core/DerivedSources-output.xcfilelist (253009 => 253010)


--- trunk/Source/_javascript_Core/DerivedSources-output.xcfilelist	2019-12-02 22:30:59 UTC (rev 253009)
+++ trunk/Source/_javascript_Core/DerivedSources-output.xcfilelist	2019-12-02 22:45:25 UTC (rev 253010)
@@ -8,7 +8,6 @@
 $(BUILT_PRODUCTS_DIR)/DerivedSources/_javascript_Core/BigIntConstructor.lut.h
 $(BUILT_PRODUCTS_DIR)/DerivedSources/_javascript_Core/BigIntPrototype.lut.h
 $(BUILT_PRODUCTS_DIR)/DerivedSources/_javascript_Core/BooleanPrototype.lut.h
-$(BUILT_PRODUCTS_DIR)/DerivedSources/_javascript_Core/BytecodeCacheVersion.h
 $(BUILT_PRODUCTS_DIR)/DerivedSources/_javascript_Core/BytecodeIndices.h
 $(BUILT_PRODUCTS_DIR)/DerivedSources/_javascript_Core/BytecodeStructs.h
 $(BUILT_PRODUCTS_DIR)/DerivedSources/_javascript_Core/Bytecodes.h

Modified: trunk/Source/_javascript_Core/DerivedSources.make (253009 => 253010)


--- trunk/Source/_javascript_Core/DerivedSources.make	2019-12-02 22:30:59 UTC (rev 253009)
+++ trunk/Source/_javascript_Core/DerivedSources.make	2019-12-02 22:45:25 UTC (rev 253010)
@@ -363,10 +363,3 @@
 all : \
     $(OBJECT_LUT_HEADERS) \
 #
-
-.PHONY : BytecodeCacheVersion.h
-
-BytecodeCacheVersion.h:
-	echo "#define JSC_BYTECODE_CACHE_VERSION $(shell date '+%s')" > BytecodeCacheVersion.h
-
-all : BytecodeCacheVersion.h

Modified: trunk/Source/_javascript_Core/runtime/CachedTypes.cpp (253009 => 253010)


--- trunk/Source/_javascript_Core/runtime/CachedTypes.cpp	2019-12-02 22:30:59 UTC (rev 253009)
+++ trunk/Source/_javascript_Core/runtime/CachedTypes.cpp	2019-12-02 22:45:25 UTC (rev 253010)
@@ -27,7 +27,6 @@
 #include "CachedTypes.h"
 
 #include "BytecodeCacheError.h"
-#include "BytecodeCacheVersion.h"
 #include "BytecodeLivenessAnalysis.h"
 #include "JSCInlines.h"
 #include "JSImmutableButterfly.h"
@@ -65,6 +64,11 @@
 template<typename T>
 using SourceType = typename SourceTypeImpl<T>::type;
 
+static constexpr unsigned jscBytecodeCacheVersion()
+{
+    return StringHasher::computeHash(__TIMESTAMP__);
+}
+
 class Encoder {
     WTF_MAKE_NONCOPYABLE(Encoder);
     WTF_FORBID_HEAP_ALLOCATION;
@@ -2265,7 +2269,7 @@
 
     bool isUpToDate(Decoder& decoder) const
     {
-        if (m_cacheVersion != JSC_BYTECODE_CACHE_VERSION)
+        if (m_cacheVersion != jscBytecodeCacheVersion())
             return false;
         if (m_bootSessionUUID.decode(decoder) != bootSessionUUIDString())
             return false;
@@ -2273,7 +2277,7 @@
     }
 
 private:
-    uint32_t m_cacheVersion { JSC_BYTECODE_CACHE_VERSION };
+    uint32_t m_cacheVersion { jscBytecodeCacheVersion() };
     CachedString m_bootSessionUUID;
     CachedCodeBlockTag m_tag;
 };
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to