Beispiel #1
0
void JSCExecutor::initOnJSVMThread() {
  #if defined(WITH_FB_JSC_TUNING)
  configureJSCForAndroid(m_jscConfig);
  #endif
  m_context = JSGlobalContextCreateInGroup(nullptr, nullptr);
  s_globalContextRefToJSCExecutor[m_context] = this;
  installGlobalFunction(m_context, "nativeFlushQueueImmediate", nativeFlushQueueImmediate);
  installGlobalFunction(m_context, "nativeStartWorker", nativeStartWorker);
  installGlobalFunction(m_context, "nativePostMessageToWorker", nativePostMessageToWorker);
  installGlobalFunction(m_context, "nativeTerminateWorker", nativeTerminateWorker);
  installGlobalFunction(m_context, "nativeInjectHMRUpdate", nativeInjectHMRUpdate);
  installGlobalFunction(m_context, "nativeCallSyncHook", nativeCallSyncHook);

  installGlobalFunction(m_context, "nativeLoggingHook", JSNativeHooks::loggingHook);
  installGlobalFunction(m_context, "nativePerformanceNow", JSNativeHooks::nowHook);

  #ifdef WITH_JSC_EXTRA_TRACING
  addNativeTracingHooks(m_context);
  addNativeProfilingHooks(m_context);
  PerfLogging::installNativeHooks(m_context);
  #endif

  #ifdef WITH_FB_MEMORY_PROFILING
  addNativeMemoryHooks(m_context);
  #endif

  #ifdef JSC_HAS_PERF_STATS_API
  addJSCPerfStatsHooks(m_context);
  #endif

  #if defined(WITH_FB_JSC_TUNING)
  configureJSContextForAndroid(m_context, m_jscConfig, m_deviceCacheDir);
  #endif
}
Beispiel #2
0
JSCExecutor::JSCExecutor(FlushImmediateCallback cb, const std::string& cacheDir) :
    m_flushImmediateCallback(cb), m_deviceCacheDir(cacheDir) {
    m_context = JSGlobalContextCreateInGroup(nullptr, nullptr);
    m_messageQueueThread = MessageQueues::getCurrentMessageQueueThread();
    s_globalContextRefToJSCExecutor[m_context] = this;
    installGlobalFunction(m_context, "nativeFlushQueueImmediate", nativeFlushQueueImmediate);
    installGlobalFunction(m_context, "nativePerformanceNow", nativePerformanceNow);
    installGlobalFunction(m_context, "nativeStartWorker", nativeStartWorker);
    installGlobalFunction(m_context, "nativePostMessageToWorker", nativePostMessageToWorker);
    installGlobalFunction(m_context, "nativeTerminateWorker", nativeTerminateWorker);

    installGlobalFunction(m_context, "nativeLoggingHook", JSLogging::nativeHook);

#ifdef WITH_FB_JSC_TUNING
    configureJSCForAndroid();
#endif

#ifdef WITH_JSC_EXTRA_TRACING
    addNativeTracingHooks(m_context);
    addNativeProfilingHooks(m_context);
    PerfLogging::installNativeHooks(m_context);
#endif

#ifdef WITH_FB_MEMORY_PROFILING
    addNativeMemoryHooks(m_context);
#endif
}
Beispiel #3
0
void JSCExecutor::initOnJSVMThread() {
  m_context = JSGlobalContextCreateInGroup(nullptr, nullptr);
  s_globalContextRefToJSCExecutor[m_context] = this;
  installGlobalFunction(m_context, "nativeFlushQueueImmediate", nativeFlushQueueImmediate);
  installGlobalFunction(m_context, "nativePerformanceNow", nativePerformanceNow);
  installGlobalFunction(m_context, "nativeStartWorker", nativeStartWorker);
  installGlobalFunction(m_context, "nativePostMessageToWorker", nativePostMessageToWorker);
  installGlobalFunction(m_context, "nativeTerminateWorker", nativeTerminateWorker);
  installGlobalFunction(m_context, "nativeInjectHMRUpdate", nativeInjectHMRUpdate);

  installGlobalFunction(m_context, "nativeLoggingHook", JSLogging::nativeHook);

  // TODO (t10136849): Pass the config options from map to JSC

  #ifdef WITH_FB_JSC_TUNING
  configureJSCForAndroid();
  #endif

  #ifdef WITH_JSC_EXTRA_TRACING
  addNativeTracingHooks(m_context);
  addNativeProfilingHooks(m_context);
  PerfLogging::installNativeHooks(m_context);
  #endif

  #ifdef WITH_FB_MEMORY_PROFILING
  addNativeMemoryHooks(m_context);
  #endif
}
Beispiel #4
0
void JSCExecutor::initOnJSVMThread() {
  #if defined(WITH_FB_JSC_TUNING) && !defined(WITH_JSC_INTERNAL)
  // TODO: Find a way to pass m_jscConfig to configureJSCForAndroid()
  configureJSCForAndroid(m_jscConfig.getDefault("GCTimers", false).asBool());
  #endif
  m_context = JSGlobalContextCreateInGroup(nullptr, nullptr);
  s_globalContextRefToJSCExecutor[m_context] = this;
  installGlobalFunction(m_context, "nativeFlushQueueImmediate", nativeFlushQueueImmediate);
  installGlobalFunction(m_context, "nativePerformanceNow", nativePerformanceNow);
  installGlobalFunction(m_context, "nativeStartWorker", nativeStartWorker);
  installGlobalFunction(m_context, "nativePostMessageToWorker", nativePostMessageToWorker);
  installGlobalFunction(m_context, "nativeTerminateWorker", nativeTerminateWorker);
  installGlobalFunction(m_context, "nativeInjectHMRUpdate", nativeInjectHMRUpdate);

  installGlobalFunction(m_context, "nativeLoggingHook", JSLogging::nativeHook);

  #if defined(WITH_JSC_INTERNAL) && defined(WITH_FB_JSC_TUNING)
  configureJSCForAndroid();
  #endif

  #ifdef WITH_JSC_EXTRA_TRACING
  addNativeTracingHooks(m_context);
  addNativeProfilingHooks(m_context);
  PerfLogging::installNativeHooks(m_context);
  #endif

  #ifdef WITH_FB_MEMORY_PROFILING
  addNativeMemoryHooks(m_context);
  #endif

  #ifdef JSC_HAS_PERF_STATS_API
  addJSCPerfStatsHooks(m_context);
  #endif
}
Beispiel #5
0
JSCExecutor::JSCExecutor(FlushImmediateCallback cb) :
    m_flushImmediateCallback(cb) {
  m_context = JSGlobalContextCreateInGroup(nullptr, nullptr);
  s_globalContextRefToJSCExecutor[m_context] = this;
  installGlobalFunction(m_context, "nativeFlushQueueImmediate", nativeFlushQueueImmediate);
  installGlobalFunction(m_context, "nativeLoggingHook", nativeLoggingHook);

  #ifdef WITH_FB_JSC_TUNING
  configureJSCForAndroid();
  #endif

  #ifdef WITH_JSC_EXTRA_TRACING
  addNativeTracingHooks(m_context);
  addNativeProfilingHooks(m_context);
  addNativePerfLoggingHooks(m_context);
  #endif
}