@@ -448,7 +448,10 @@ static void Close(const FunctionCallbackInfo<Value>& args) {
448448}
449449
450450
451- void FillStatsArray (double * fields, const uv_stat_t * s) {
451+ void FillStatsArray (v8::Local<v8::Float64Array> fields_array, const uv_stat_t * s, int offset) {
452+ Local<ArrayBuffer> ab = fields_array->Buffer ();
453+ double * fields = static_cast <double *>(ab->GetContents ().Data ()) + offset;
454+
452455 fields[0 ] = s->st_dev ;
453456 fields[1 ] = s->st_mode ;
454457 fields[2 ] = s->st_nlink ;
@@ -477,6 +480,12 @@ void FillStatsArray(double* fields, const uv_stat_t* s) {
477480 X (12 , ctim)
478481 X (13 , birthtim)
479482#undef X
483+
484+ #if ENABLE_TTD_NODE
485+ if (s_doTTRecord || s_doTTReplay) {
486+ ab->TTDRawBufferModifyNotifySync (offset * sizeof (double ), 14 * sizeof (double ));
487+ }
488+ #endif
480489}
481490
482491// Used to speed up module loading. Returns the contents of the file as
@@ -1392,18 +1401,20 @@ static void Mkdtemp(const FunctionCallbackInfo<Value>& args) {
13921401
13931402void GetStatValues (const FunctionCallbackInfo<Value>& args) {
13941403 Environment* env = Environment::GetCurrent (args);
1395- double * fields = env->fs_stats_field_array ();
1396- if (fields == nullptr ) {
1404+ Local<Float64Array> fields = env->fs_stats_field_array ();
1405+
1406+ if (fields.IsEmpty ()) {
13971407 // stat fields contains twice the number of entries because `fs.StatWatcher`
13981408 // needs room to store data for *two* `fs.Stats` instances.
1399- fields = new double [2 * 14 ];
1409+ Local<ArrayBuffer> ab = ArrayBuffer::New (env->isolate (),
1410+ new double [2 * 14 ],
1411+ sizeof (double ) * 2 * 14 );
1412+ fields = Float64Array::New (ab, 0 , 2 * 14 );
1413+
14001414 env->set_fs_stats_field_array (fields);
14011415 }
1402- Local<ArrayBuffer> ab = ArrayBuffer::New (env->isolate (),
1403- fields,
1404- sizeof (double ) * 2 * 14 );
1405- Local<Float64Array> fields_array = Float64Array::New (ab, 0 , 2 * 14 );
1406- args.GetReturnValue ().Set (fields_array);
1416+
1417+ args.GetReturnValue ().Set (fields);
14071418}
14081419
14091420void InitFs (Local<Object> target,
0 commit comments