[profview] Avoid treating embedded builtins as CPP code.

Instead attribute them properly as Bultin or BytecodeHandler.

Bug: v8:6240
Change-Id: I773a533b318afe52d63152edf5b16463801db8e9
Reviewed-on: https://chromium-review.googlesource.com/1249202
Reviewed-by: Camillo Bruni <cbruni@chromium.org>
Reviewed-by: Yang Guo <yangguo@chromium.org>
Commit-Queue: Jaroslav Sevcik <jarin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#56262}
This commit is contained in:
Jaroslav Sevcik 2018-09-27 12:55:49 +02:00 committed by Commit Bot
parent 94364486c6
commit 88a444baa2
2 changed files with 24 additions and 5 deletions

View File

@ -123,8 +123,19 @@ Code* BuiltinDeserializer::DeserializeBuiltinRaw(int builtin_id) {
Assembler::FlushICache(code->raw_instruction_start(),
code->raw_instruction_size());
PROFILE(isolate(), CodeCreateEvent(CodeEventListener::BUILTIN_TAG,
AbstractCode::cast(code),
CodeEventListener::LogEventsAndTags code_tag;
switch (code->kind()) {
case AbstractCode::BUILTIN:
code_tag = CodeEventListener::BUILTIN_TAG;
break;
case AbstractCode::BYTECODE_HANDLER:
code_tag = CodeEventListener::BYTECODE_HANDLER_TAG;
break;
default:
UNREACHABLE();
}
PROFILE(isolate(), CodeCreateEvent(code_tag, AbstractCode::cast(code),
Builtins::name(builtin_id)));
LOG_CODE_EVENT(isolate(),
CodeLinePosInfoRecordEvent(

View File

@ -892,16 +892,24 @@ JsonProfile.prototype.addStaticCode = function(
JsonProfile.prototype.addCode = function(
kind, name, timestamp, start, size) {
let codeId = this.codeEntries_.length;
// Find out if we have a static code entry for the code. If yes, we will
// make sure it is written to the JSON file just once.
let staticEntry = this.codeMap_.findAddress(start);
if (staticEntry && staticEntry.entry.type === 'CPP') {
codeId = staticEntry.entry.codeId;
}
var entry = new CodeMap.CodeEntry(size, name, 'CODE');
this.codeMap_.addCode(start, entry);
entry.codeId = this.codeEntries_.length;
this.codeEntries_.push({
entry.codeId = codeId;
this.codeEntries_[codeId] = {
name : entry.name,
timestamp: timestamp,
type : entry.type,
kind : kind
});
};
return entry;
};