ic-processor-driver.mjs 1.17 KB
Newer Older
1 2 3 4
// Copyright 2017 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

5
import { Processor } from "./system-analyzer/processor.mjs";
6
import { BaseArgumentsProcessor} from "./arguments.mjs";
7

8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
class ArgumentsProcessor extends BaseArgumentsProcessor {
  getArgsDispatch() {
    return {
      '--range': ['range', 'auto,auto',
          'Specify the range limit as [start],[end]'],
    };
  }
  getDefaultResults() {
   return {
      logFileName: 'v8.log',
      range: 'auto,auto',
    };
  }
}

23
const params = ArgumentsProcessor.process(arguments);
24
const processor = new Processor();
25
await processor.processLogFile(params.logFileName);
26 27 28 29

const typeAccumulator = new Map();

const accumulator = {
30
  __proto__: null,
31 32 33 34 35 36
  LoadGlobalIC: 0,
  StoreGlobalIC: 0,
  LoadIC: 0,
  StoreIC: 0,
  KeyedLoadIC: 0,
  KeyedStoreIC: 0,
37
  StoreInArrayLiteralIC: 0,
38 39
}
for (const ic of processor.icTimeline.all) {
40
  console.log(Object.values(ic));
41 42 43
  accumulator[ic.type]++;
}

44
console.log("========================================");
45
for (const key of Object.keys(accumulator)) {
46
  console.log(key + ": " + accumulator[key]);
47
}