web:chrome

文書の過去の版を表示しています。


Chrome

chrome の起動コマンドに以下のオプションを追加して起動する。

Linux

$ /opt/google/chrome/chrome --js-flags="--allow-natives-syntax" &

chrome-beta の場合

$ /opt/google/chrome-beta/chrome --js-flags="--allow-natives-syntax" &

ネイティブ シンタックスを有効にすると、ブラウザーで以下の runtime.h に記載のある各組み込み関数が使用できるようになる。
https://cs.chromium.org/chromium/src/v8/src/runtime/runtime.h

例えば、%GetOptimizationStatus(func) 関数で V8 エンジンの JavaScript の最適化ステータスを取得することが出来る。

const GetOptimizationStatus = (func) => {
  const wrapEval = (script) => {
    return (new Function(`"use strict"; return ${script};`))();
  };
  const isAllowNativeSyntax = () => {
    let native = false;
    try {
      wrapEval('%GetOptimizationStatus();');
      native = true;
    }
    catch (err) {
      console.log('v8 engine is not running with --js-flags="--allow-natives-syntax";');
      console.log('Native v8 functions are not available.');
      native = false;
    }
    return native;
  };
  const optStatusString = [];
 
  if (isAllowNativeSyntax()) {
    const checkBitmap = (value, bit) => {
      return ((value & bit) === bit);
    };
 
    self._optCheckFunc = func;
 
    const optStatus = wrapEval('%GetOptimizationStatus(self._optCheckFunc);');
    const funcName = wrapEval('%GetFunctionName(self._optCheckFunc);');
 
    if (checkBitmap(optStatus,1)) { optStatusString.push("is Function"); }
    if (checkBitmap(optStatus,2)) { optStatusString.push("Never Optimized"); }
    if (checkBitmap(optStatus,4)) { optStatusString.push("Always Optimized");	}
    if (checkBitmap(optStatus,8)) { optStatusString.push("Maybe Deopted"); }
    if (checkBitmap(optStatus,16)) { optStatusString.push("Optimized"); }
    if (checkBitmap(optStatus,32)) { optStatusString.push("TurboFanned"); }
    if (checkBitmap(optStatus,64)) { optStatusString.push("Interpreted"); }
    if (checkBitmap(optStatus,128)) { optStatusString.push("Marked for Optimization"); }
    if (checkBitmap(optStatus,256)) { optStatusString.push("Marked for Concurrent Optimization"); }
    if (checkBitmap(optStatus,512)) { optStatusString.push("Conccurently Optimizating"); }
    if (checkBitmap(optStatus,1024)) { optStatusString.push("Is Executing"); }
    if (checkBitmap(optStatus,2048)) { optStatusString.push("Topmost frame is Turbo Fanned"); }
    if (checkBitmap(optStatus,4096)) { optStatusString.push("Lite Mode"); }
    if (checkBitmap(optStatus,8192)) { optStatusString.push("Marked for Deoptimization"); }
    console.log(`${funcName}: ${optStatusString.join(", ")}`);
  }
 
  return optStatusString.join(", ");
};

※ここでは eval() を使わずに new Function() を利用してコードをとして評価している。

optStatus bit について

0 0 0 0 0 0 0 1 0 0 0 0 0 1 = 65 の場合
┬ ┬ ┬ ┬ ┬ ┬ ┬ ┬ ┬ ┬ ┬ ┬ ┬ ┬    val(    C++): C++ enum define name
│ │ │ │ │ │ │ │ │ │ │ │ │ └──    1(1 <<  0): is function
│ │ │ │ │ │ │ │ │ │ │ │ └────    2(1 <<  1): is never optimized
│ │ │ │ │ │ │ │ │ │ │ └──────    4(1 <<  2): is always optimized
│ │ │ │ │ │ │ │ │ │ └────────    8(1 <<  3): is maybe deoptimized
│ │ │ │ │ │ │ │ │ └──────────   16(1 <<  4): is optimized
│ │ │ │ │ │ │ │ └────────────   32(1 <<  5): is optimized by TurboFan
│ │ │ │ │ │ │ └──────────────   64(1 <<  6): is interpreted
│ │ │ │ │ │ └────────────────  128(1 <<  7): is marked for optimization
│ │ │ │ │ └──────────────────  256(1 <<  8): is marked for concurrent optimization
│ │ │ │ └────────────────────  512(1 <<  9): is optimizing concurrently
│ │ │ └────────────────────── 1024(1 << 10): is executing
│ │ └──────────────────────── 2048(1 << 11): topmost frame is turbo fanned
│ └────────────────────────── 4096(1 << 12): lite mode
└──────────────────────────── 8192(1 << 13): marked for deoptimization

Chrome を起動後、2~30分 CPU が高負荷になり CPU ファンが高回転しだす。
chrome://settings の [詳細設定] - [リセットとクリーンアップ] - [パソコンのクリーンアップ] の画面にある以下の文章の隣にある [検索] ボタンを押すと起動されるプログラムのようである。

有害なソフトウェアの検出
Chrome で、パソコン上の有害なソフトウェアを探して削除することができます

software_reporter_tool.exe は以下の場所にインストールされている。

%USERPROFILE%\AppData\Local\Google\Chrome\User Data\SwReporter\44.215.200.3(バージョン)\software_reporter_tool.exe

※上記のパスのバージョン部分は変わる可能性がある。

無効化するには...

software_reporter_tool.exeを右クリックして「プロパティ」を開く。
「セキュリティ」タブの [詳細設定] ボタンを押す。
[継承の無効化] ボタンを押して [適用] ボタンを押し、[はい] で答える。

上記の設定で Chrome は software_reporter_tool.exe を実行出来なくなる。

  • web/chrome.1568123292.txt.gz
  • 最終更新: 2019/09/10 22:48
  • by ともやん