Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/Linux/tools/testing/selftests/intel_pstate/   (Linux Kernel Version 6.17.9©)  Datei vom 24.10.2025 mit Größe 50 B image not shown  

Quelle  megamorphic-permissive.js  Sprache: unbekannt

 
var throwCount = 0;

var objs = [
  // This is just bread and butter trigger-the-megamorphic-path stuff
  {x: 2, a: 1},
  {x: 2, b: 1},
  {x: 2, c: 1},
  {x: 2, d: 1},
  {x: 2, e: 1},
  {x: 2, f: 1},

  // These ensure we hit the megamorphic permissive case
  { get x() { return 2; }, l: 2 },
  { get x() { return 2; }, m: 2 },
  { get x() { return 2; }, n: 2 },
  { get x() { return 2; }, o: 2 },
  { get x() { return 2; }, p: 2 },
  { get x() { return 2; }, q: 2 },
];

function bar(o) {
  return o.x;
}

with({}){}

var count = 0;

for (var i = 0; i < 1000; i++) {
  count += bar(objs[i % objs.length]);
}


try {
  // Throw once during a cache miss
  count += bar({ get x() { throwCount++; throw new Error("foo"); }, z: 2 });
} catch(e) {}

try {
  // Populate the shape so we get a cache hit, and then throw during that cache hit
  count += bar({ get x() { return 2 }, z: 2 });
  count += bar({ get x() { throwCount++; throw new Error("foo"); }, z: 2 });
} catch(e) {}

assertEq(count, 2002);
assertEq(throwCount, 2);

Messung V0.5 in Prozent
C=92 H=91 G=91

[0.11QuellennavigatorsProjekt 2026-10-11]