mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Add es6Proxy to RuntimeConfig
Summary: Also clean up some unused items Changelog: [Internal] Reviewed By: willholen Differential Revision: D19917035 fbshipit-source-id: dd5a0af135bdbdb7fb1a98475d99db1ec281eeba
This commit is contained in:
committed by
Facebook Github Bot
parent
ad64979d7a
commit
ef021eac9c
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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<HermesExecutorFactory>(installBindings));
|
||||
}
|
||||
|
||||
static jni::local_ref<jhybriddata> initHybrid(
|
||||
jni::alias_ref<jclass>,
|
||||
jlong heapSizeMB,
|
||||
bool es6Symbol,
|
||||
jint bytecodeWarmupPercent) {
|
||||
static jni::local_ref<jhybriddata>
|
||||
initHybrid(jni::alias_ref<jclass>, jlong heapSizeMB, bool es6Proxy) {
|
||||
JReactMarker::setLogPerfMarkerIfNeeded();
|
||||
auto runtimeConfig =
|
||||
makeRuntimeConfig(heapSizeMB, es6Symbol, bytecodeWarmupPercent);
|
||||
auto runtimeConfig = makeRuntimeConfig(heapSizeMB, es6Proxy);
|
||||
return makeCxxInstance(std::make_unique<HermesExecutorFactory>(
|
||||
installBindings, JSIExecutor::defaultTimeoutInvoker, runtimeConfig));
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user