File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -63,4 +63,8 @@ add_builtin(fastly::html_rewriter
6363
6464add_compile_definitions (PUBLIC RUNTIME_VERSION=${RUNTIME_VERSION} )
6565
66+ if (DEFINED FASTLY_GC_FREQUENCY)
67+ add_compile_definitions (PUBLIC FASTLY_GC_FREQUENCY=${FASTLY_GC_FREQUENCY} )
68+ endif ()
69+
6670project (FastlyJS)
Original file line number Diff line number Diff line change @@ -4,10 +4,37 @@ set -euo pipefail
44set -x
55
66cd " $( dirname " $0 " ) " || exit 1
7+
8+ # Parse command line arguments
9+ KEEP_DEBUG_INFO=0
10+ GC_FREQUENCY=" "
11+
12+ while [[ $# -gt 0 ]]; do
13+ case $1 in
14+ --keep-debug-info)
15+ KEEP_DEBUG_INFO=1
16+ shift
17+ ;;
18+ --gc-frequency)
19+ if [[ -n " ${2:- } " ]]; then
20+ GC_FREQUENCY=" -DFASTLY_GC_FREQUENCY=$2 "
21+ shift 2
22+ else
23+ echo " Error: --gc-frequency requires a value"
24+ exit 1
25+ fi
26+ ;;
27+ * )
28+ echo " Unknown option: $1 "
29+ exit 1
30+ ;;
31+ esac
32+ done
33+
734RUNTIME_VERSION=$( npm pkg get version --json --prefix=../../ | jq -r)
8- HOST_API=$( realpath host-api) cmake -B build-debug -DCMAKE_BUILD_TYPE=Debug -DENABLE_BUILTIN_WEB_FETCH=0 -DENABLE_BUILTIN_WEB_FETCH_FETCH_EVENT=0 -DCMAKE_EXPORT_COMPILE_COMMANDS=1 -DRUNTIME_VERSION=" \" $RUNTIME_VERSION -debug\" " -DENABLE_JS_DEBUGGER=OFF
35+ HOST_API=$( realpath host-api) cmake -B build-debug -DCMAKE_BUILD_TYPE=Debug -DENABLE_BUILTIN_WEB_FETCH=0 -DENABLE_BUILTIN_WEB_FETCH_FETCH_EVENT=0 -DCMAKE_EXPORT_COMPILE_COMMANDS=1 -DRUNTIME_VERSION=" \" $RUNTIME_VERSION -debug\" " -DENABLE_JS_DEBUGGER=OFF " $GC_FREQUENCY "
936cmake --build build-debug --parallel 10
10- if [ " ${1 :- default} " != " --keep-debug-info " ]; then
37+ if [ " $KEEP_DEBUG_INFO " -eq 0 ]; then
1138 wasm-tools strip build-debug/starling-raw.wasm/starling-raw.wasm -d " .debug_(info|loc|ranges|abbrev|line|str)" -o ../../fastly.debug.wasm
1239else
1340 cp build-debug/starling-raw.wasm/starling-raw.wasm ../../fastly.debug.wasm
Original file line number Diff line number Diff line change @@ -19,6 +19,9 @@ api::Engine *ENGINE;
1919
2020// Install corresponds to Wizer time, so we configure the engine here
2121bool install (api::Engine *engine) {
22+ #if defined(JS_GC_ZEAL) && defined(FASTLY_GC_FREQUENCY)
23+ JS::SetGCZeal (engine->cx (), 2 , FASTLY_GC_FREQUENCY);
24+ #endif
2225 ENGINE = engine;
2326 return true ;
2427}
You can’t perform that action at this time.
0 commit comments