Skip to content

Commit

Permalink
Remove unused nativeTrace*stage methods
Browse files Browse the repository at this point in the history
Reviewed By: alexeylang

Differential Revision: D5433403

fbshipit-source-id: f83b576e12a59f0a066960fcb3d1446da011cf39
  • Loading branch information
javache authored and facebook-github-bot committed Jul 26, 2017
1 parent f9808f0 commit 4d55ce3
Showing 1 changed file with 0 additions and 77 deletions.
77 changes: 0 additions & 77 deletions ReactCommon/cxxreact/JSCTracing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -224,47 +224,6 @@ static JSValueRef beginOrEndAsync(
return Value::makeUndefined(ctx);
}

static JSValueRef stageAsync(
bool isFlow,
JSContextRef ctx,
JSObjectRef function,
JSObjectRef thisObject,
size_t argumentCount,
const JSValueRef arguments[],
JSValueRef* exception) {
if (FBSYSTRACE_UNLIKELY(argumentCount < 4)) {
if (exception) {
*exception = Value::makeError(
ctx,
"stageAsync: requires at least 4 arguments");
}
return Value::makeUndefined(ctx);
}

uint64_t tag = int64FromJSValue(ctx, arguments[0], exception);
if (!fbsystrace_is_tracing(tag)) {
return Value::makeUndefined(ctx);
}

char buf[FBSYSTRACE_MAX_MESSAGE_LENGTH];
size_t pos = 0;

buf[pos++] = (isFlow ? 't' : 'T');
pos += snprintf(buf + pos, sizeof(buf) - pos, "|%d", getpid());
// Skip the overflow check here because the int will be small.

// Arguments are section name, cookie, and stage name.
// All added together, they still cannot cause an overflow.
for (int i = 1; i < 4; i++) {
buf[pos++] = '|';
pos += copyTruncatedAsciiChars(buf + pos, sizeof(buf) - pos, ctx, arguments[i], FBSYSTRACE_MAX_SECTION_NAME_LENGTH);
}

fbsystrace_trace_raw(buf, min(pos, sizeof(buf)-1));

return Value::makeUndefined(ctx);
}

static JSValueRef nativeTraceBeginAsyncSection(
JSContextRef ctx,
JSObjectRef function,
Expand All @@ -287,23 +246,6 @@ static JSValueRef nativeTraceEndAsyncSection(
ctx, argumentCount, arguments, exception);
}

static JSValueRef nativeTraceAsyncSectionStage(
JSContextRef ctx,
JSObjectRef function,
JSObjectRef thisObject,
size_t argumentCount,
const JSValueRef arguments[],
JSValueRef* exception) {
return stageAsync(
false /* isFlow */,
ctx,
function,
thisObject,
argumentCount,
arguments,
exception);
}

static JSValueRef nativeTraceBeginAsyncFlow(
JSContextRef ctx,
JSObjectRef function,
Expand All @@ -326,23 +268,6 @@ static JSValueRef nativeTraceEndAsyncFlow(
ctx, argumentCount, arguments, exception);
}

static JSValueRef nativeTraceAsyncFlowStage(
JSContextRef ctx,
JSObjectRef function,
JSObjectRef thisObject,
size_t argumentCount,
const JSValueRef arguments[],
JSValueRef* exception) {
return stageAsync(
true /* isFlow */,
ctx,
function,
thisObject,
argumentCount,
arguments,
exception);
}

static JSValueRef nativeTraceCounter(
JSContextRef ctx,
JSObjectRef function,
Expand Down Expand Up @@ -386,10 +311,8 @@ void addNativeTracingHooks(JSGlobalContextRef ctx) {
installGlobalFunction(ctx, "nativeTraceEndSection", nativeTraceEndSection);
installGlobalFunction(ctx, "nativeTraceBeginAsyncSection", nativeTraceBeginAsyncSection);
installGlobalFunction(ctx, "nativeTraceEndAsyncSection", nativeTraceEndAsyncSection);
installGlobalFunction(ctx, "nativeTraceAsyncSectionStage", nativeTraceAsyncSectionStage);
installGlobalFunction(ctx, "nativeTraceBeginAsyncFlow", nativeTraceBeginAsyncFlow);
installGlobalFunction(ctx, "nativeTraceEndAsyncFlow", nativeTraceEndAsyncFlow);
installGlobalFunction(ctx, "nativeTraceAsyncFlowStage", nativeTraceAsyncFlowStage);
installGlobalFunction(ctx, "nativeTraceCounter", nativeTraceCounter);
#endif
}
Expand Down

0 comments on commit 4d55ce3

Please sign in to comment.