diff --git a/ReactAndroid/src/main/java/com/facebook/hermes/reactexecutor/HermesExecutor.java b/ReactAndroid/src/main/java/com/facebook/hermes/reactexecutor/HermesExecutor.java index 09c2eee962a..075da8c78e6 100644 --- a/ReactAndroid/src/main/java/com/facebook/hermes/reactexecutor/HermesExecutor.java +++ b/ReactAndroid/src/main/java/com/facebook/hermes/reactexecutor/HermesExecutor.java @@ -31,7 +31,7 @@ public class HermesExecutor extends JavaScriptExecutor { super( config == null ? initHybridDefaultConfig() - : initHybrid(config.heapSizeMB, config.es6Symbol, config.bytecodeWarmupPercent)); + : initHybrid(config.heapSizeMB, config.es6Proxy)); } @Override @@ -50,6 +50,5 @@ public class HermesExecutor extends JavaScriptExecutor { private static native HybridData initHybridDefaultConfig(); - private static native HybridData initHybrid( - long heapSizeMB, boolean es6Symbol, int bytecodeWarmupPercent); + private static native HybridData initHybrid(long heapSizeMB, boolean es6Proxy); } diff --git a/ReactAndroid/src/main/java/com/facebook/hermes/reactexecutor/OnLoad.cpp b/ReactAndroid/src/main/java/com/facebook/hermes/reactexecutor/OnLoad.cpp index b21457247ad..8b4dabd0f6f 100644 --- a/ReactAndroid/src/main/java/com/facebook/hermes/reactexecutor/OnLoad.cpp +++ b/ReactAndroid/src/main/java/com/facebook/hermes/reactexecutor/OnLoad.cpp @@ -22,12 +22,10 @@ namespace react { static ::hermes::vm::RuntimeConfig makeRuntimeConfig( jlong heapSizeMB, - bool es6Symbol, - jint bytecodeWarmupPercent) { + bool es6Proxy) { namespace vm = ::hermes::vm; auto gcConfigBuilder = vm::GCConfig::Builder() - .withMaxHeapSize(heapSizeMB << 20) .withName("RN") // For the next two arguments: avoid GC before TTI by initializing the // runtime to allocate directly in the old generation, but revert to @@ -35,10 +33,13 @@ static ::hermes::vm::RuntimeConfig makeRuntimeConfig( .withAllocInYoung(false) .withRevertToYGAtTTI(true); + if (heapSizeMB > 0) { + gcConfigBuilder.withMaxHeapSize(heapSizeMB << 20); + } + return vm::RuntimeConfig::Builder() .withGCConfig(gcConfigBuilder.build()) - .withES6Symbol(es6Symbol) - .withBytecodeWarmupPercent(bytecodeWarmupPercent) + .withES6Proxy(es6Proxy) .build(); } @@ -63,14 +64,10 @@ class HermesExecutorHolder std::make_unique(installBindings)); } - static jni::local_ref initHybrid( - jni::alias_ref, - jlong heapSizeMB, - bool es6Symbol, - jint bytecodeWarmupPercent) { + static jni::local_ref + initHybrid(jni::alias_ref, jlong heapSizeMB, bool es6Proxy) { JReactMarker::setLogPerfMarkerIfNeeded(); - auto runtimeConfig = - makeRuntimeConfig(heapSizeMB, es6Symbol, bytecodeWarmupPercent); + auto runtimeConfig = makeRuntimeConfig(heapSizeMB, es6Proxy); return makeCxxInstance(std::make_unique( installBindings, JSIExecutor::defaultTimeoutInvoker, runtimeConfig)); } diff --git a/ReactAndroid/src/main/java/com/facebook/hermes/reactexecutor/RuntimeConfig.java b/ReactAndroid/src/main/java/com/facebook/hermes/reactexecutor/RuntimeConfig.java index 98e5f68b0c5..15349f1d8d0 100644 --- a/ReactAndroid/src/main/java/com/facebook/hermes/reactexecutor/RuntimeConfig.java +++ b/ReactAndroid/src/main/java/com/facebook/hermes/reactexecutor/RuntimeConfig.java @@ -10,7 +10,5 @@ package com.facebook.hermes.reactexecutor; /** Holds runtime configuration for a Hermes VM instance (master or snapshot). */ public final class RuntimeConfig { public long heapSizeMB; - public boolean enableSampledStats; - public boolean es6Symbol; - public int bytecodeWarmupPercent; + public boolean es6Proxy; }