Skip to content

Commit 830fa57

Browse files
committed
TTD - Tests and Bug Fixes
1 parent 1e964f0 commit 830fa57

119 files changed

Lines changed: 3863 additions & 159 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

lib/Jsrt/Jsrt.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3986,6 +3986,10 @@ CHAKRA_API JsTTDPreExecuteSnapShotInterval(_In_ int64_t startSnapTime, _In_ int6
39863986
}
39873987
catch(TTD::TTDebuggerAbortException abortException)
39883988
{
3989+
//
3990+
//TODO: we need to clear out the exception state if needed otherwise when we try to re-enter execution we will fail
3991+
//
3992+
39893993
//If we hit the end of the log or we hit a terminal exception that is fine -- anything else is a problem
39903994
if(!abortException.IsEndOfLog() && !abortException.IsTopLevelException())
39913995
{
@@ -4196,6 +4200,10 @@ CHAKRA_API JsTTDReplayExecution(_Inout_ JsTTDMoveMode* moveMode, _Inout_ int64_t
41964200

41974201
if(abortException.IsTopLevelException())
41984202
{
4203+
//
4204+
//TODO: we need to clear out the exception state if needed otherwise when we try to re-enter execution we will fail
4205+
//
4206+
41994207
bool markedAsJustMyCode = false;
42004208
TTD::TTDebuggerSourceLocation throwLocation;
42014209
elog->GetLastExecutedTimeAndPositionForDebugger(&markedAsJustMyCode, throwLocation);

lib/Runtime/Debug/TTEventLog.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -979,7 +979,7 @@ namespace TTD
979979
#endif
980980
}
981981

982-
void EventLog::ReplayPropertyEnumEvent(BOOL* returnCode, int32* newIndex, const Js::DynamicObject* obj, Js::PropertyId* pid, Js::PropertyAttributes* attributes, Js::JavascriptString** propertyName)
982+
void EventLog::ReplayPropertyEnumEvent(BOOL* returnCode, Js::BigPropertyIndex* newIndex, const Js::DynamicObject* obj, Js::PropertyId* pid, Js::PropertyAttributes* attributes, Js::JavascriptString** propertyName)
983983
{
984984
const NSLogEvents::PropertyEnumStepEventLogEntry* peEvent = this->ReplayGetReplayEvent_Helper<NSLogEvents::PropertyEnumStepEventLogEntry, NSLogEvents::EventKind::PropertyEnumTag>();
985985

@@ -996,7 +996,7 @@ namespace TTD
996996
const Js::PropertyRecord* pRecord = obj->GetScriptContext()->GetPropertyName(*pid);
997997
*newIndex = obj->GetDynamicType()->GetTypeHandler()->GetPropertyIndex_EnumerateTTD(pRecord);
998998

999-
AssertMsg(*newIndex != Js::Constants::NoSlot, "If *returnCode is true then we found it during record -- but missing in replay.");
999+
AssertMsg(*newIndex != Js::Constants::NoBigSlot, "If *returnCode is true then we found it during record -- but missing in replay.");
10001000
}
10011001
else
10021002
{

lib/Runtime/Debug/TTEventLog.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -481,7 +481,7 @@ namespace TTD
481481
void RecordPropertyEnumEvent(BOOL returnCode, Js::PropertyId pid, Js::PropertyAttributes attributes, Js::JavascriptString* propertyName);
482482

483483
//Replay a property enumeration step
484-
void ReplayPropertyEnumEvent(BOOL* returnCode, int32* newIndex, const Js::DynamicObject* obj, Js::PropertyId* pid, Js::PropertyAttributes* attributes, Js::JavascriptString** propertyName);
484+
void ReplayPropertyEnumEvent(BOOL* returnCode, Js::BigPropertyIndex* newIndex, const Js::DynamicObject* obj, Js::PropertyId* pid, Js::PropertyAttributes* attributes, Js::JavascriptString** propertyName);
485485

486486
//Log symbol creation
487487
void RecordSymbolCreationEvent(Js::PropertyId pid);

lib/Runtime/Debug/TTEvents.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ namespace TTD
8686
int64 m_ltime; //-1 indicates any ltime is OK
8787

8888
//The document
89-
wchar* m_sourceFile; //temp use until we make docid stable
89+
char16* m_sourceFile; //temp use until we make docid stable
9090
uint32 m_docid;
9191

9292
//The position of the function in the document

lib/Runtime/Debug/TTSerialize.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,8 @@ namespace TTD
1515
const char16** nameArray = TT_HEAP_ALLOC_ARRAY(const char16*, (uint32)Key::Count);
1616
size_t* lengthArray = TT_HEAP_ALLOC_ARRAY(size_t, (uint32)Key::Count);
1717

18-
#define __STEXT(X) ((const char16*)__TEXT(X))
19-
#define ENTRY_SERIALIZE_ENUM(K) { nameArray[(uint32)Key::##K] = __STEXT(#K); lengthArray[(uint32)Key::##K] = wcslen(__STEXT(#K)); }
18+
#define ENTRY_SERIALIZE_ENUM(K) { nameArray[(uint32)Key::##K] = _u(#K); lengthArray[(uint32)Key::##K] = wcslen(_u(#K)); }
2019
#include "TTSerializeEnum.h"
21-
#undef __STEXT
2220

2321
*names = nameArray;
2422
*lengths = lengthArray;

lib/Runtime/Debug/TTSnapObjects.cpp

Lines changed: 61 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -230,62 +230,70 @@ namespace TTD
230230
AssertMsg(!Js::JavascriptProxy::Is(obj), "I didn't think proxies could have real properties directly on them.");
231231

232232
Js::PropertyId pid = handler->PropertyInfoArray[i].PropertyRecordId;
233-
TTDVar ttdVal = snpObject->VarArray[i];
234-
Js::Var pVal = inflator->InflateTTDVar(ttdVal);
235233

236-
if(handler->PropertyInfoArray[i].DataKind == NSSnapType::SnapEntryDataKindTag::Data)
234+
if(handler->PropertyInfoArray[i].DataKind == NSSnapType::SnapEntryDataKindTag::Uninitialized)
237235
{
238-
BOOL success = FALSE;
239-
if(!obj->HasOwnProperty(pid))
240-
{
241-
//easy case just set the property
242-
success = obj->SetProperty(pid, pVal, Js::PropertyOperationFlags::PropertyOperation_Force, nullptr);
243-
}
244-
else
236+
AssertMsg(!obj->HasOwnProperty(pid), "Shouldn't have this defined, or we should have cleared it, and nothing more to do.");
237+
238+
BOOL success = obj->EnsureProperty(pid);
239+
240+
AssertMsg(success, "Failed to set property during restore!!!");
241+
}
242+
else
243+
{
244+
TTDVar ttdVal = snpObject->VarArray[i];
245+
Js::Var pVal = (ttdVal != nullptr) ? inflator->InflateTTDVar(ttdVal) : nullptr;
246+
247+
if(handler->PropertyInfoArray[i].DataKind == NSSnapType::SnapEntryDataKindTag::Data)
245248
{
246-
if(obj->IsWritable(pid))
249+
BOOL success = FALSE;
250+
if(!obj->HasOwnProperty(pid))
247251
{
248-
//also easy just write the property
252+
//easy case just set the property
249253
success = obj->SetProperty(pid, pVal, Js::PropertyOperationFlags::PropertyOperation_Force, nullptr);
250254
}
251255
else
252256
{
253-
//get the value to see if it is alreay ok
254-
Js::Var currentValue = nullptr;
255-
Js::JavascriptOperators::GetProperty(obj, pid, obj->GetScriptContext(), nullptr);
256-
257-
if(currentValue == pVal)
257+
if(obj->IsWritable(pid))
258258
{
259-
//the right value is already there -- easy
260-
success = TRUE;
259+
//also easy just write the property
260+
success = obj->SetProperty(pid, pVal, Js::PropertyOperationFlags::PropertyOperation_Force, nullptr);
261261
}
262262
else
263263
{
264-
//Ok so now we force set the property
265-
success = obj->SetPropertyWithAttributes(pid, pVal, PropertyDynamicTypeDefaults, nullptr);
264+
//get the value to see if it is alreay ok
265+
Js::Var currentValue = nullptr;
266+
Js::JavascriptOperators::GetProperty(obj, pid, obj->GetScriptContext(), nullptr);
267+
268+
if(currentValue == pVal)
269+
{
270+
//the right value is already there -- easy
271+
success = TRUE;
272+
}
273+
else
274+
{
275+
//Ok so now we force set the property
276+
success = obj->SetPropertyWithAttributes(pid, pVal, PropertyDynamicTypeDefaults, nullptr);
277+
}
266278
}
267279
}
268-
}
269-
AssertMsg(success, "Failed to set property during restore!!!");
270-
}
271-
else
272-
{
273-
//
274-
//TODO: we could have a problem if we set a getter (and make it not writable say) then what happens with the setter -- or maybe set accessors just ignores this?
275-
//
276-
277-
NSSnapType::SnapEntryDataKindTag ttag = handler->PropertyInfoArray[i].DataKind;
278-
if(ttag == NSSnapType::SnapEntryDataKindTag::Getter)
279-
{
280-
obj->SetAccessors(pid, pVal, nullptr);
281-
}
282-
else if(ttag == NSSnapType::SnapEntryDataKindTag::Setter)
283-
{
284-
obj->SetAccessors(pid, nullptr, pVal);
280+
AssertMsg(success, "Failed to set property during restore!!!");
285281
}
286282
else
287283
{
288-
AssertMsg(false, "Don't know how to restore this accesstag!!");
284+
NSSnapType::SnapEntryDataKindTag ttag = handler->PropertyInfoArray[i].DataKind;
285+
if(ttag == NSSnapType::SnapEntryDataKindTag::Getter)
286+
{
287+
obj->SetAccessors(pid, pVal, nullptr);
288+
}
289+
else if(ttag == NSSnapType::SnapEntryDataKindTag::Setter)
290+
{
291+
obj->SetAccessors(pid, nullptr, pVal);
292+
}
293+
else
294+
{
295+
AssertMsg(false, "Don't know how to restore this accesstag!!");
296+
}
289297
}
290298
}
291299

@@ -550,7 +558,7 @@ namespace TTD
550558
for(uint32 i = 0; i < handler2->MaxPropertyIndex; ++i)
551559
{
552560
const NSSnapType::SnapHandlerPropertyEntry spe = handler2->PropertyInfoArray[i];
553-
if(spe.DataKind != NSSnapType::SnapEntryDataKindTag::Clear)
561+
if(spe.DataKind != NSSnapType::SnapEntryDataKindTag::Clear && spe.DataKind != NSSnapType::SnapEntryDataKindTag::Uninitialized)
554562
{
555563
int64 locationTag = ComputeLocationTagForAssertCompare(spe);
556564

@@ -1285,7 +1293,7 @@ namespace TTD
12851293
const double* dateInfo1 = SnapObjectGetAddtlInfoAs<double*, SnapObjectType::SnapDateObject>(sobj1);
12861294
const double* dateInfo2 = SnapObjectGetAddtlInfoAs<double*, SnapObjectType::SnapDateObject>(sobj2);
12871295

1288-
compareMap.DiagnosticAssert(*dateInfo1 == *dateInfo2);
1296+
compareMap.DiagnosticAssert(NSSnapValues::CheckSnapEquivTTDDouble(*dateInfo1, *dateInfo2));
12891297
}
12901298
#endif
12911299

@@ -1435,13 +1443,18 @@ namespace TTD
14351443

14361444
arrayObj->SetItemAttributes(entry->Index, entry->Attributes);
14371445
}
1446+
1447+
//do length writable as needed
1448+
Js::JavascriptLibrary::SetLengthWritableES5Array_TTD(arrayObj, es5Info->IsLengthWritable);
14381449
}
14391450

14401451
void EmitAddtlInfo_SnapES5ArrayInfo(const SnapObject* snpObject, FileWriter* writer)
14411452
{
14421453
SnapES5ArrayInfo* es5Info = SnapObjectGetAddtlInfoAs<SnapES5ArrayInfo*, SnapObjectType::SnapES5ArrayObject>(snpObject);
14431454

14441455
writer->WriteLengthValue(es5Info->GetterSetterCount, NSTokens::Separator::CommaSeparator);
1456+
writer->WriteBool(NSTokens::Key::boolVal, es5Info->IsLengthWritable, NSTokens::Separator::CommaSeparator);
1457+
14451458
writer->WriteSequenceStart_DefaultKey(NSTokens::Separator::CommaSeparator);
14461459
for(uint32 i = 0; i < es5Info->GetterSetterCount; ++i)
14471460
{
@@ -1471,6 +1484,8 @@ namespace TTD
14711484
SnapES5ArrayInfo* es5Info = alloc.SlabAllocateStruct<SnapES5ArrayInfo>();
14721485

14731486
es5Info->GetterSetterCount = reader->ReadLengthValue(true);
1487+
es5Info->IsLengthWritable = reader->ReadBool(NSTokens::Key::boolVal, true);
1488+
14741489
if(es5Info->GetterSetterCount == 0)
14751490
{
14761491
es5Info->GetterSetterEntries = nullptr;
@@ -1512,6 +1527,8 @@ namespace TTD
15121527
SnapES5ArrayInfo* es5Info2 = SnapObjectGetAddtlInfoAs<SnapES5ArrayInfo*, SnapObjectType::SnapES5ArrayObject>(sobj2);
15131528

15141529
compareMap.DiagnosticAssert(es5Info1->GetterSetterCount == es5Info2->GetterSetterCount);
1530+
compareMap.DiagnosticAssert(es5Info1->IsLengthWritable == es5Info2->IsLengthWritable);
1531+
15151532
for(uint32 i = 0; i < es5Info1->GetterSetterCount; ++i)
15161533
{
15171534
const SnapES5ArrayGetterSetterEntry* entry1 = es5Info1->GetterSetterEntries + i;
@@ -1524,7 +1541,9 @@ namespace TTD
15241541
NSSnapValues::AssertSnapEquivTTDVar_SpecialArray(entry1->Setter, entry2->Setter, compareMap, _u("es5Setter"), entry1->Index);
15251542
}
15261543

1527-
AssertSnapEquiv_SnapArrayInfoCore<TTDVar>(es5Info1->BasicArrayData, es5Info2->BasicArrayData, compareMap);
1544+
compareMap.DiagnosticAssert(es5Info1->BasicArrayData->Length == es5Info2->BasicArrayData->Length);
1545+
1546+
AssertSnapEquiv_SnapArrayInfoCore<TTDVar>(es5Info1->BasicArrayData->Data, es5Info2->BasicArrayData->Data, compareMap);
15281547
}
15291548
#endif
15301549

0 commit comments

Comments
 (0)