Skip to content
This repository has been archived by the owner on Oct 15, 2020. It is now read-only.

Commit

Permalink
chakrashim: fixes and updates for TTD
Browse files Browse the repository at this point in the history
Reverse continue fix and updates for TTD info tracking.

PR-URL: #231
Reviewed-By: Kyle Farnung <[email protected]>
  • Loading branch information
mrkmarron authored and kfarnung committed May 5, 2017
1 parent 9a7af26 commit fe44f54
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 20 deletions.
11 changes: 6 additions & 5 deletions deps/chakrashim/src/jsrtisolateshim.cc
Original file line number Diff line number Diff line change
Expand Up @@ -648,17 +648,14 @@ bool IsolateShim::RunSingleStepOfReverseMoveLoop(v8::Isolate* isolate,

*nextEventTime = -1;
JsTTDPreExecuteSnapShotInterval(rHandle, ciStart, ciEnd,
((JsTTDMoveMode)(*moveMode)),
(JsTTDMoveMode)(*moveMode | JsTTDMoveMode::JsTTDMoveScanIntervalForContinueInActiveBreakpointSegment),
nextEventTime);

while (*nextEventTime == -1) {
int64_t newCiStart = -1;
JsTTDGetPreviousSnapshotInterval(rHandle, ciStart, &newCiStart);

if (newCiStart == -1) {
// no previous so break on first
_moveMode = (JsTTDMoveMode)(_moveMode |
JsTTDMoveMode::JsTTDMoveFirstEvent);
break;
}

Expand All @@ -674,6 +671,10 @@ bool IsolateShim::RunSingleStepOfReverseMoveLoop(v8::Isolate* isolate,
~JsTTDMoveMode::JsTTDMoveScanIntervalForContinue);
}

if(*nextEventTime == -1) {
_moveMode = (JsTTDMoveMode)(JsTTDMoveMode::JsTTDMoveFirstEvent | JsTTDMoveMode::JsTTDMoveBreakOnEntry);
}

JsErrorCode timeError = JsTTDGetSnapTimeTopLevelEventMove(rHandle,
_moveMode,
0,
Expand Down Expand Up @@ -701,7 +702,7 @@ bool IsolateShim::RunSingleStepOfReverseMoveLoop(v8::Isolate* isolate,
}

JsErrorCode replayError = JsTTDReplayExecution(&_moveMode, nextEventTime);
if(replayError != JsNoError)
if(replayError != JsNoError && replayError != JsErrorCategoryScript)
{
fprintf(stderr, "Fatal Error in Replay Action!!!");
exit(1);
Expand Down
13 changes: 13 additions & 0 deletions src/node_os.cc
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,13 @@ static void GetCPUInfo(const FunctionCallbackInfo<Value>& args) {
fields[field_idx++] = ci->cpu_times.irq;
model_argv[model_idx++] = OneByteString(env->isolate(), ci->model);

#if ENABLE_TTD_NODE
if (s_doTTRecord || s_doTTReplay) {
int modlength = field_idx * sizeof(double);
ab->TTDRawBufferModifyNotifySync(0, modlength);
}
#endif

if (model_idx >= NODE_PUSH_VAL_TO_ARRAY_MAX) {
addfn->Call(env->context(), cpus, model_idx, model_argv).ToLocalChecked();
model_idx = 0;
Expand Down Expand Up @@ -224,6 +231,12 @@ static void GetLoadAvg(const FunctionCallbackInfo<Value>& args) {
Local<ArrayBuffer> ab = array->Buffer();
double* loadavg = static_cast<double*>(ab->GetContents().Data());
uv_loadavg(loadavg);

#if ENABLE_TTD_NODE
if (s_doTTRecord || s_doTTReplay) {
ab->TTDRawBufferModifyNotifySync(0, 3 * sizeof(double));
}
#endif
}


Expand Down
15 changes: 0 additions & 15 deletions src/tls_wrap.cc
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,6 @@ TLSWrap::TLSWrap(Environment* env,
node::Wrap(object(), this);
MakeWeak(this);

// TODO(marron): This is a temp workaround for the stashed persistent pointer
if (s_doTTRecord) {
unsigned int refct = 0;
JsAddRef(*(this->object()), &refct);
}

// sc comes from an Unwrap. Make sure it was assigned.
CHECK_NE(sc, nullptr);

Expand Down Expand Up @@ -834,15 +828,6 @@ void TLSWrap::DestroySSL(const FunctionCallbackInfo<Value>& args) {
// Destroy the SSL structure and friends
wrap->SSLWrap<TLSWrap>::DestroySSL();

// See comment with AddRef earlier in this file.
if (s_doTTRecord) {
unsigned int refct = 0;
// As this is null we may have lost the reference earlier in the run...
if (*(wrap->object()) != nullptr) {
JsRelease(*(wrap->object()), &refct);
}
}

delete wrap->clear_in_;
wrap->clear_in_ = nullptr;
}
Expand Down

0 comments on commit fe44f54

Please sign in to comment.