Skip to content

Commit

Permalink
Merge pull request #3170 from cloudflare/yagiz/remove-autogate-for-cc
Browse files Browse the repository at this point in the history
remove autogates for compile cache
  • Loading branch information
anonrig authored Nov 25, 2024
2 parents 72fd2eb + fc16648 commit 124b7d4
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 16 deletions.
1 change: 0 additions & 1 deletion src/workerd/jsg/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ wd_cc_library(
":observer",
":url",
"//src/workerd/util",
"//src/workerd/util:autogate",
"//src/workerd/util:sentry",
"//src/workerd/util:thread-scopes",
"//src/workerd/util:uuid",
Expand Down
16 changes: 6 additions & 10 deletions src/workerd/jsg/modules.c++
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
#include "jsg.h"
#include "setup.h"

#include <workerd/util/autogate.h>

#include <kj/mutex.h>

#include <set>
Expand Down Expand Up @@ -395,14 +393,12 @@ v8::Local<v8::Module> compileEsmModule(jsg::Lock& js,
contentStr = jsg::v8Str(js.v8Isolate, content);
}

if (util::Autogate::isEnabled(util::AutogateKey::COMPILE_CACHE_FOR_BUILTINS)) {
if (compileCache.size() > 0 && compileCache.begin() != nullptr) {
auto cached = std::make_unique<v8::ScriptCompiler::CachedData>(
compileCache.begin(), compileCache.size());
v8::ScriptCompiler::Source source(contentStr, origin, cached.release());
return jsg::check(v8::ScriptCompiler::CompileModule(
js.v8Isolate, &source, v8::ScriptCompiler::kConsumeCodeCache));
}
if (compileCache.size() > 0 && compileCache.begin() != nullptr) {
auto cached =
std::make_unique<v8::ScriptCompiler::CachedData>(compileCache.begin(), compileCache.size());
v8::ScriptCompiler::Source source(contentStr, origin, cached.release());
return jsg::check(v8::ScriptCompiler::CompileModule(
js.v8Isolate, &source, v8::ScriptCompiler::kConsumeCodeCache));
}

v8::ScriptCompiler::Source source(contentStr, origin);
Expand Down
2 changes: 0 additions & 2 deletions src/workerd/jsg/resource-test.c++
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
#include "jsg-test.h"

#include <workerd/jsg/resource-test.capnp.h>
#include <workerd/util/autogate.h>

namespace workerd::jsg::test {
namespace {
Expand Down Expand Up @@ -591,7 +590,6 @@ struct JsBundleContext: public ContextGlobalObject {
JSG_DECLARE_ISOLATE_TYPE(JsBundleIsolate, JsBundleContext);

KJ_TEST("expectEvalModule function works") {
util::Autogate::initAutogate({});
Evaluator<JsBundleContext, JsBundleIsolate, decltype(nullptr), JsBundleIsolate_TypeWrapper> e(
v8System);
e.expectEvalModule("export function run() { return 123; }", "number", "123");
Expand Down
2 changes: 0 additions & 2 deletions src/workerd/util/autogate.c++
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ kj::StringPtr KJ_STRINGIFY(AutogateKey key) {
switch (key) {
case AutogateKey::TEST_WORKERD:
return "test-workerd"_kj;
case AutogateKey::COMPILE_CACHE_FOR_BUILTINS:
return "compile-cache-for-builtins"_kj;
case AutogateKey::NumOfKeys:
KJ_FAIL_ASSERT("NumOfKeys should not be used in getName");
}
Expand Down
1 change: 0 additions & 1 deletion src/workerd/util/autogate.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ namespace workerd::util {
// Workerd-specific list of autogate keys (can also be used in internal repo).
enum class AutogateKey {
TEST_WORKERD,
COMPILE_CACHE_FOR_BUILTINS,
NumOfKeys // Reserved for iteration.
};

Expand Down

0 comments on commit 124b7d4

Please sign in to comment.