Changeset 253010 in webkit


Ignore:
Timestamp:
Dec 2, 2019 2:45:25 PM (4 years ago)
Author:
Tadeu Zagallo
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):

Location:
trunk/Source/JavaScriptCore
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/CMakeLists.txt

    r252843 r253010  
    226226endif ()
    227227
    228 file(WRITE ${JavaScriptCore_DERIVED_SOURCES_DIR}/BytecodeCacheVersion.h "#define JSC_BYTECODE_CACHE_VERSION ${BUILD_TIME}\n")
    229 
    230228list(APPEND JavaScriptCore_HEADERS
    231     ${JavaScriptCore_DERIVED_SOURCES_DIR}/BytecodeCacheVersion.h
    232229    ${JavaScriptCore_DERIVED_SOURCES_DIR}/BytecodeStructs.h
    233230    ${JavaScriptCore_DERIVED_SOURCES_DIR}/Bytecodes.h
  • trunk/Source/JavaScriptCore/ChangeLog

    r253008 r253010  
     12019-12-02  Tadeu Zagallo  <tzagallo@apple.com>
     2
     3        [JSC] Remove BytecodeCacheVersion.h
     4        https://bugs.webkit.org/show_bug.cgi?id=204760
     5
     6        Reviewed by Mark Lam.
     7
     8        Having that as a phony make target causes a lot of unnecessary rebuilds. That was a workaround
     9        the fact that we only need a new cache version when we rebuild CachedTypes.cpp, but there was
     10        no straightforward way to get the current timestamp as an integer at that point. Instead, we now
     11        just use a constexpr function that hashes __TIMESTAMP__.
     12
     13        * CMakeLists.txt:
     14        * DerivedSources-output.xcfilelist:
     15        * DerivedSources.make:
     16        * runtime/CachedTypes.cpp:
     17        (JSC::jscBytecodeCacheVersion):
     18        (JSC::GenericCacheEntry::isUpToDate const):
     19
    1202019-12-02  Mark Lam  <mark.lam@apple.com>
    221
  • trunk/Source/JavaScriptCore/DerivedSources-output.xcfilelist

    r251886 r253010  
    99$(BUILT_PRODUCTS_DIR)/DerivedSources/JavaScriptCore/BigIntPrototype.lut.h
    1010$(BUILT_PRODUCTS_DIR)/DerivedSources/JavaScriptCore/BooleanPrototype.lut.h
    11 $(BUILT_PRODUCTS_DIR)/DerivedSources/JavaScriptCore/BytecodeCacheVersion.h
    1211$(BUILT_PRODUCTS_DIR)/DerivedSources/JavaScriptCore/BytecodeIndices.h
    1312$(BUILT_PRODUCTS_DIR)/DerivedSources/JavaScriptCore/BytecodeStructs.h
  • trunk/Source/JavaScriptCore/DerivedSources.make

    r251959 r253010  
    364364    $(OBJECT_LUT_HEADERS) \
    365365#
    366 
    367 .PHONY : BytecodeCacheVersion.h
    368 
    369 BytecodeCacheVersion.h:
    370         echo "#define JSC_BYTECODE_CACHE_VERSION $(shell date '+%s')" > BytecodeCacheVersion.h
    371 
    372 all : BytecodeCacheVersion.h
  • trunk/Source/JavaScriptCore/runtime/CachedTypes.cpp

    r252032 r253010  
    2828
    2929#include "BytecodeCacheError.h"
    30 #include "BytecodeCacheVersion.h"
    3130#include "BytecodeLivenessAnalysis.h"
    3231#include "JSCInlines.h"
     
    6564template<typename T>
    6665using SourceType = typename SourceTypeImpl<T>::type;
     66
     67static constexpr unsigned jscBytecodeCacheVersion()
     68{
     69    return StringHasher::computeHash(__TIMESTAMP__);
     70}
    6771
    6872class Encoder {
     
    22662270    bool isUpToDate(Decoder& decoder) const
    22672271    {
    2268         if (m_cacheVersion != JSC_BYTECODE_CACHE_VERSION)
     2272        if (m_cacheVersion != jscBytecodeCacheVersion())
    22692273            return false;
    22702274        if (m_bootSessionUUID.decode(decoder) != bootSessionUUIDString())
     
    22742278
    22752279private:
    2276     uint32_t m_cacheVersion { JSC_BYTECODE_CACHE_VERSION };
     2280    uint32_t m_cacheVersion { jscBytecodeCacheVersion() };
    22772281    CachedString m_bootSessionUUID;
    22782282    CachedCodeBlockTag m_tag;
Note: See TracChangeset for help on using the changeset viewer.