11cb0ef41Sopenharmony_ci// Copyright 2017 the V8 project authors. All rights reserved. 21cb0ef41Sopenharmony_ci// Use of this source code is governed by a BSD-style license that can be 31cb0ef41Sopenharmony_ci// found in the LICENSE file. 41cb0ef41Sopenharmony_ci 51cb0ef41Sopenharmony_ciimport { Processor } from "./system-analyzer/processor.mjs"; 61cb0ef41Sopenharmony_ciimport { BaseArgumentsProcessor} from "./arguments.mjs"; 71cb0ef41Sopenharmony_ci 81cb0ef41Sopenharmony_ciclass ArgumentsProcessor extends BaseArgumentsProcessor { 91cb0ef41Sopenharmony_ci getArgsDispatch() { 101cb0ef41Sopenharmony_ci return { 111cb0ef41Sopenharmony_ci '--range': ['range', 'auto,auto', 121cb0ef41Sopenharmony_ci 'Specify the range limit as [start],[end]'], 131cb0ef41Sopenharmony_ci }; 141cb0ef41Sopenharmony_ci } 151cb0ef41Sopenharmony_ci getDefaultResults() { 161cb0ef41Sopenharmony_ci return { 171cb0ef41Sopenharmony_ci logFileName: 'v8.log', 181cb0ef41Sopenharmony_ci range: 'auto,auto', 191cb0ef41Sopenharmony_ci }; 201cb0ef41Sopenharmony_ci } 211cb0ef41Sopenharmony_ci} 221cb0ef41Sopenharmony_ci 231cb0ef41Sopenharmony_ciconst params = ArgumentsProcessor.process(arguments); 241cb0ef41Sopenharmony_ciconst processor = new Processor(); 251cb0ef41Sopenharmony_ciawait processor.processLogFile(params.logFileName); 261cb0ef41Sopenharmony_ci 271cb0ef41Sopenharmony_ciconst typeAccumulator = new Map(); 281cb0ef41Sopenharmony_ci 291cb0ef41Sopenharmony_ciconst accumulator = { 301cb0ef41Sopenharmony_ci __proto__: null, 311cb0ef41Sopenharmony_ci LoadGlobalIC: 0, 321cb0ef41Sopenharmony_ci StoreGlobalIC: 0, 331cb0ef41Sopenharmony_ci LoadIC: 0, 341cb0ef41Sopenharmony_ci StoreIC: 0, 351cb0ef41Sopenharmony_ci KeyedLoadIC: 0, 361cb0ef41Sopenharmony_ci KeyedStoreIC: 0, 371cb0ef41Sopenharmony_ci StoreInArrayLiteralIC: 0, 381cb0ef41Sopenharmony_ci} 391cb0ef41Sopenharmony_cifor (const ic of processor.icTimeline.all) { 401cb0ef41Sopenharmony_ci console.log(Object.values(ic)); 411cb0ef41Sopenharmony_ci accumulator[ic.type]++; 421cb0ef41Sopenharmony_ci} 431cb0ef41Sopenharmony_ci 441cb0ef41Sopenharmony_ciconsole.log("========================================"); 451cb0ef41Sopenharmony_cifor (const key of Object.keys(accumulator)) { 461cb0ef41Sopenharmony_ci console.log(key + ": " + accumulator[key]); 471cb0ef41Sopenharmony_ci} 48