File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed
test-app/runtime/src/main/cpp Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change 2222#include < mutex>
2323#include < libgen.h>
2424#include < dlfcn.h>
25+ #include < sys/stat.h>
2526
2627using namespace v8 ;
2728using namespace std ;
@@ -460,6 +461,19 @@ ScriptCompiler::CachedData* ModuleInternal::TryLoadScriptCache(const std::string
460461 }
461462
462463 auto cachePath = path + " .cache" ;
464+
465+ struct stat result;
466+ if (stat (cachePath.c_str (), &result) == 0 ) {
467+ auto cacheLastModifiedTime = result.st_mtime ;
468+ if (stat (path.c_str (), &result) == 0 ) {
469+ auto jsLastModifiedTime = result.st_mtime ;
470+ if (jsLastModifiedTime > 0 && cacheLastModifiedTime > 0 && jsLastModifiedTime > cacheLastModifiedTime) {
471+ // The javascript file is more recent than the cache file => ignore the cache
472+ return nullptr ;
473+ }
474+ }
475+ }
476+
463477 int length = 0 ;
464478 auto data = File::ReadBinary (cachePath, length);
465479 if (!data) {
You can’t perform that action at this time.
0 commit comments