feat: add startTrace/stopTrace to control mark capture

Implemented a capture flag in `Ask262Debug` to enable/disable marking.
- Added `_captureEnabled` property and related logic in `mark()`.
- Introduced `startTrace()` and `stopTrace()` methods to toggle capture.
- Updated verification script to start tracing, run tests, stop tracing, and assert that the `Array.prototype.every` section is captured and marked important.
This commit is contained in:
2026-04-08 16:03:09 +05:30
parent b73035a4d3
commit aa9c875006
2 changed files with 38 additions and 0 deletions
@@ -41,6 +41,7 @@ realm.scope(() => {
skipDebugger(CreateDataProperty(debugObj, Value('stopImportant'), stopImportant));
});
ask262Debug.startTrace();
realm.evaluateScript(`
// Array.prototype.every - should hit sec-array.prototype.every
ask262Debug.startImportant();
@@ -50,6 +51,7 @@ realm.evaluateScript(`
// Proxy creation - should hit sec-proxycreate or similar
new Proxy({}, {});
`);
ask262Debug.stopTrace();
// 3. Verify marks were captured
console.log('3. Checking marks...');
@@ -61,6 +63,18 @@ if (marks.length === 0) {
process.exit(1);
}
// 3a. Assert that Array.prototype.every section is found and marked important
const everyMark = marks.find((m) => m.sectionIds.some((id) => id.includes('array.prototype.every')));
if (!everyMark) {
console.error('FAIL: sec-array.prototype.every not found in marks');
process.exit(1);
}
if (!everyMark.important) {
console.error('FAIL: sec-array.prototype.every found but not marked as important');
process.exit(1);
}
console.log(' ✓ Found sec-array.prototype.every (marked as important)\n');
// 4. Show sample marks
console.log('4. Sample marks:');
marks.slice(0, 5).forEach((m, i) => {