Add more profiling, fix existing profiling, perf fix

Reviewed By: javache

Differential Revision: D3807467

fbshipit-source-id: 3ff6feebd6d7966952152bac708389506de721e6
This commit is contained in:
Marc Horowitz
2016-09-02 12:43:14 -07:00
committed by Facebook Github Bot 4
parent d7fdc448d5
commit 3940f06211
3 changed files with 11 additions and 4 deletions

View File

@@ -332,6 +332,7 @@ void JSCExecutor::setJSModulesUnbundle(std::unique_ptr<JSModulesUnbundle> unbund
}
void JSCExecutor::bindBridge() throw(JSException) {
SystraceSection s("JSCExecutor::bindBridge");
auto global = Object::getGlobalObject(m_context);
auto batchedBridgeValue = global.getProperty("__fbBatchedBridge");
if (batchedBridgeValue.isUndefined()) {
@@ -345,11 +346,12 @@ void JSCExecutor::bindBridge() throw(JSException) {
}
void JSCExecutor::callNativeModules(Value&& value) {
SystraceSection s("JSCExecutor::callNativeModules");
try {
auto calls = value.toJSONString();
m_delegate->callNativeModules(*this, std::move(calls), true);
} catch (...) {
std::string message = "Error in flush()";
std::string message = "Error in callNativeModules()";
try {
message += ":" + value.toString().str();
} catch (...) {
@@ -360,10 +362,12 @@ void JSCExecutor::callNativeModules(Value&& value) {
}
void JSCExecutor::flush() {
SystraceSection s("JSCExecutor::flush");
callNativeModules(m_flushedQueueJS->callAsFunction({}));
}
void JSCExecutor::callFunction(const std::string& moduleId, const std::string& methodId, const folly::dynamic& arguments) {
SystraceSection s("JSCExecutor::callFunction");
// This weird pattern is because Value is not default constructible.
// The lambda is inlined, so there's no overhead.
@@ -384,6 +388,7 @@ void JSCExecutor::callFunction(const std::string& moduleId, const std::string& m
}
void JSCExecutor::invokeCallback(const double callbackId, const folly::dynamic& arguments) {
SystraceSection s("JSCExecutor::invokeCallback");
auto result = [&] {
try {
return m_invokeCallbackAndReturnFlushedQueueJS->callAsFunction({