Lines Matching refs:code

2 // Use of this source code is governed by a BSD-style license that can be
28 function resolveCodeKind(code) {
29 if (!code || !code.type) {
31 } else if (code.type === "CPP") {
33 } else if (code.type === "SHARED_LIB") {
35 } else if (code.type === "CODE") {
36 if (code.kind === "LoadIC" ||
37 code.kind === "StoreIC" ||
38 code.kind === "KeyedStoreIC" ||
39 code.kind === "KeyedLoadIC" ||
40 code.kind === "LoadGlobalIC" ||
41 code.kind === "Handler") {
43 } else if (code.kind === "BytecodeHandler") {
45 } else if (code.kind === "Stub") {
47 } else if (code.kind === "Builtin") {
49 } else if (code.kind === "RegExp") {
52 console.log("Unknown CODE: '" + code.kind + "'.");
54 } else if (code.type === "JS") {
55 if (code.kind === "Builtin") {
57 } else if (code.kind === "Opt") {
59 } else if (code.kind === "Unopt") {
61 } else if (code.kind === "Baseline") {
63 } else if (code.kind === "Turboprop") {
67 console.log("Unknown code type '" + type + "'.");
70 function resolveCodeKindAndVmState(code, vmState) {
71 let kind = resolveCodeKind(code);
102 function createNodeFromStackEntry(code, codeId, vmState) {
103 let name = code ? code.name : "UNKNOWN";
106 node.type = resolveCodeKindAndVmState(code, vmState);
110 function childIdFromCode(codeId, code) {
113 // Otherwise, just compute the id from code id.
114 let type = resolveCodeKind(code);
116 return code.func * 4 + 1;
118 return code.func * 4 + 2;
132 // Try to combine with the previous code run.
144 let code = null;
147 code = codeId >= 0 ? file.code[codeId] : undefined;
150 let type = code ? code.type : undefined;
151 let kind = code ? code.kind : undefined;
172 let code = codeId >= 0 ? file.code[codeId] : undefined;
174 let childId = childIdFromCode(codeId, code);
178 child = createNodeFromStackEntry(code, codeId, vmState);
233 let code = file.code[codeId];
234 if (code.type !== "CPP" && code.type !== "SHARED_LIB") {
308 let code = codeId >= 0 ? file.code[codeId] : undefined;
309 let kind = resolveCodeKindAndVmState(code, vmState);
349 let code = file.code[codeId];
351 let type = code ? code.type : undefined;
352 let kind = code ? code.kind : undefined;
355 let childId = childIdFromCode(codeId, code);
357 let kind = resolveCodeKindAndVmState(code, vmState);
364 child = createNodeFromStackEntry(code, codeId, vmState);
426 let code = codeId >= 0 ? file.code[codeId] : undefined;
427 let kind = resolveCodeKindAndVmState(code, vmState);
444 let functionCode = file.code[this.functionCodeId];
453 let code = codeId >= 0 ? file.code[codeId] : undefined;
454 let type = code ? code.type : undefined;
455 let kind = code ? code.kind : undefined;
460 if (codeEquals(code, functionCode, true)) {
462 stackCode = code;
489 code: stackCode,
501 // {file} is the JSON files with the ticks and code objects.
527 function addToCollection(collection, code) {
529 let funcData = collection.functionTable[code.func];
531 funcData = { f : file.functions[code.func], instances : [] };
532 collection.functionTable[code.func] = funcData;
535 funcData.instances.push(code);
555 if (file.code[f.codes[0]].type !== "JS") continue;
563 let code = file.code[f.codes[j]];
564 console.assert(code.type === "JS");
565 if (code.kind === "Opt") {
567 if (code.tm >= timeStart && code.tm <= timeEnd) {
568 addToCollection(optimizations, code);
571 if (code.kind === "Turboprop") {
573 if (code.tm >= timeStart && code.tm <= timeEnd) {
574 addToCollection(turbopropOptimizations, code);
577 if (code.deopt) {
578 if (code.deopt.bailoutType === "deopt-lazy" || code.deopt.bailoutType === "deopt-eager" || code.deopt.bailoutType === "deopt-lazy") {
581 if (code.deopt.tm >= timeStart && code.deopt.tm <= timeEnd) {
582 switch (code.deopt.bailoutType) {
584 addToCollection(lazyDeoptimizations, code);
587 addToCollection(eagerDeoptimizations, code);
590 addToCollection(softDeoptimizations, code);
593 addToCollection(softBailouts, code);
596 addToCollection(eagerBailouts, code);