Lines Matching defs:code

2 // Use of this source code is governed by a BSD-style license that can be
37 #include "src/objects/code-kind.h"
38 #include "src/objects/code.h"
52 #include "src/wasm/wasm-code-manager.h"
95 static const char* ComputeMarker(SharedFunctionInfo shared, AbstractCode code) {
96 CodeKind kind = code.kind();
100 code.GetCode().is_interpreter_trampoline_builtin() &&
101 ToCodeT(code.GetCode()) !=
113 static const char* ComputeMarker(const wasm::WasmCode* code) {
114 switch (code->kind()) {
116 return code->is_liftoff() ? "" : "*";
214 Handle<AbstractCode> code,
219 LogRecordedBuffer(code, MaybeHandle<SharedFunctionInfo>(),
224 Handle<AbstractCode> code,
229 LogRecordedBuffer(code, MaybeHandle<SharedFunctionInfo>(),
234 Handle<AbstractCode> code,
239 name_buffer_->AppendBytes(ComputeMarker(*shared, *code));
242 LogRecordedBuffer(code, shared, name_buffer_->get(), name_buffer_->size());
246 Handle<AbstractCode> code,
252 name_buffer_->AppendBytes(ComputeMarker(*shared, *code));
264 LogRecordedBuffer(code, shared, name_buffer_->get(), name_buffer_->size());
269 const wasm::WasmCode* code,
278 if (code->IsAnonymous()) {
281 name_buffer_->AppendInt(code->index());
284 name_buffer_->AppendBytes(ExecutionTierToString(code->tier()));
285 LogRecordedBuffer(code, name_buffer_->get(), name_buffer_->size());
289 void CodeEventLogger::RegExpCodeCreateEvent(Handle<AbstractCode> code,
294 LogRecordedBuffer(code, MaybeHandle<SharedFunctionInfo>(),
306 void CodeDisableOptEvent(Handle<AbstractCode> code,
310 void LogRecordedBuffer(Handle<AbstractCode> code,
314 void LogRecordedBuffer(const wasm::WasmCode* code, const char* name,
363 void PerfBasicLogger::LogRecordedBuffer(Handle<AbstractCode> code,
367 !CodeKindIsBuiltinOrJSFunction(code->kind())) {
371 WriteLogRecordedBuffer(static_cast<uintptr_t>(code->InstructionStart()),
372 code->InstructionSize(), name, length);
376 void PerfBasicLogger::LogRecordedBuffer(const wasm::WasmCode* code,
378 WriteLogRecordedBuffer(static_cast<uintptr_t>(code->instruction_start()),
379 code->instructions().length(), name, length);
423 Handle<AbstractCode> code,
427 static_cast<uintptr_t>(code->InstructionStart());
428 code_event.code_size = static_cast<size_t>(code->InstructionSize());
440 Handle<AbstractCode> code,
447 static_cast<uintptr_t>(code->InstructionStart());
448 code_event.code_size = static_cast<size_t>(code->InstructionSize());
460 LogEventsAndTags tag, Handle<AbstractCode> code,
467 static_cast<uintptr_t>(code->InstructionStart());
468 code_event.code_size = static_cast<size_t>(code->InstructionSize());
480 LogEventsAndTags tag, Handle<AbstractCode> code,
491 static_cast<uintptr_t>(code->InstructionStart());
492 code_event.code_size = static_cast<size_t>(code->InstructionSize());
505 LogEventsAndTags tag, const wasm::WasmCode* code, wasm::WasmName name,
511 void ExternalCodeEventListener::RegExpCodeCreateEvent(Handle<AbstractCode> code,
515 static_cast<uintptr_t>(code->InstructionStart());
516 code_event.code_size = static_cast<size_t>(code->InstructionSize());
551 void CodeDisableOptEvent(Handle<AbstractCode> code,
557 void LogRecordedBuffer(Handle<AbstractCode> code,
561 void LogRecordedBuffer(const wasm::WasmCode* code, const char* name,
647 void LowLevelLogger::LogRecordedBuffer(Handle<AbstractCode> code,
652 event.code_address = code->InstructionStart();
653 event.code_size = code->InstructionSize();
656 LogWriteBytes(reinterpret_cast<const char*>(code->InstructionStart()),
657 code->InstructionSize());
661 void LowLevelLogger::LogRecordedBuffer(const wasm::WasmCode* code,
665 event.code_address = code->instruction_start();
666 event.code_size = code->instructions().length();
669 LogWriteBytes(reinterpret_cast<const char*>(code->instruction_start()),
670 code->instructions().length());
698 void CodeDisableOptEvent(Handle<AbstractCode> code,
710 void LogRecordedBuffer(Handle<AbstractCode> code,
714 void LogRecordedBuffer(const wasm::WasmCode* code, const char* name,
725 void JitLogger::LogRecordedBuffer(Handle<AbstractCode> code,
730 event.code_start = reinterpret_cast<void*>(code->InstructionStart());
732 code->IsCode() ? JitCodeEvent::JIT_CODE : JitCodeEvent::BYTE_CODE;
733 event.code_len = code->InstructionSize();
747 void JitLogger::LogRecordedBuffer(const wasm::WasmCode* code, const char* name,
752 event.code_start = code->instructions().begin();
753 event.code_len = code->instructions().length();
759 code->native_module()->GetWasmSourceMap();
761 code->native_module()->module()->functions[code->index()].code;
773 for (SourcePositionTableIterator iterator(code->source_positions());
852 // the reason is to reduce code duplication during migration to sampler library,
1194 AbstractCode code, uint64_t time) {
1195 AppendCodeCreateHeader(msg, tag, code.kind(),
1196 reinterpret_cast<uint8_t*>(code.InstructionStart()),
1197 code.InstructionSize(), time);
1201 // We log source code information in the form:
1203 // code-source-info <addr>,<script>,<start>,<end>,<pos>,<inline-pos>,<fns>
1206 // <addr> is code object address
1211 // it is a sequence of C<code-offset>O<script-offset>[I<inlining-id>]
1213 // <code-offset> is the offset within the code object
1223 void Logger::LogSourceCodeInformation(Handle<AbstractCode> code,
1231 msg << "code-source-info" << Logger::kNext
1232 << reinterpret_cast<void*>(code->InstructionStart()) << Logger::kNext
1235 // TODO(v8:11429): Clean-up baseline-replated code in source position
1238 if (code->kind() != CodeKind::BASELINE) {
1239 SourcePositionTableIterator iterator(code->SourcePositionTable(*shared));
1254 Handle<Code>::cast(code)->deoptimization_data())
1275 Handle<Code>::cast(code)->deoptimization_data());
1287 void Logger::LogCodeDisassemble(Handle<AbstractCode> code) {
1290 msg << "code-disassemble" << Logger::kNext
1291 << reinterpret_cast<void*>(code->InstructionStart()) << Logger::kNext
1292 << CodeKindToString(code->kind()) << Logger::kNext;
1295 if (code->IsCode()) {
1297 Code::cast(*code).Disassemble(nullptr, stream, isolate_);
1300 BytecodeArray::cast(*code).Disassemble(stream);
1309 void Logger::CodeCreateEvent(LogEventsAndTags tag, Handle<AbstractCode> code,
1315 AppendCodeCreateHeader(msg, tag, *code, Time());
1319 LogCodeDisassemble(code);
1322 void Logger::CodeCreateEvent(LogEventsAndTags tag, Handle<AbstractCode> code,
1328 AppendCodeCreateHeader(msg, tag, *code, Time());
1332 LogCodeDisassemble(code);
1336 void Logger::CodeCreateEvent(LogEventsAndTags tag, Handle<AbstractCode> code,
1341 if (*code ==
1342 AbstractCode::cast(isolate_->builtins()->code(Builtin::kCompileLazy))) {
1347 AppendCodeCreateHeader(msg, tag, *code, Time());
1349 << kNext << ComputeMarker(*shared, *code);
1352 LogSourceCodeInformation(code, shared);
1353 LogCodeDisassemble(code);
1356 void Logger::FeedbackVectorEvent(FeedbackVector vector, AbstractCode code) {
1363 msg << kNext << reinterpret_cast<void*>(code.InstructionStart());
1384 void Logger::CodeCreateEvent(LogEventsAndTags tag, Handle<AbstractCode> code,
1391 AppendCodeCreateHeader(msg, tag, *code, Time());
1394 << kNext << ComputeMarker(*shared, *code);
1398 LogSourceCodeInformation(code, shared);
1399 LogCodeDisassemble(code);
1403 void Logger::CodeCreateEvent(LogEventsAndTags tag, const wasm::WasmCode* code,
1410 code->instructions().begin(),
1411 code->instructions().length(), Time());
1419 // TODO(herhut) Clean up the tick processor code instead.
1421 reinterpret_cast<byte*>(code->native_module()) + code->index();
1422 msg << kNext << tag_ptr << kNext << ComputeMarker(code);
1450 void Logger::RegExpCodeCreateEvent(Handle<AbstractCode> code,
1455 AppendCodeCreateHeader(msg, CodeEventListener::REG_EXP_TAG, *code, Time());
1477 void Logger::CodeDisableOptEvent(Handle<AbstractCode> code,
1488 void Logger::ProcessDeoptEvent(Handle<Code> code, SourcePosition position,
1491 msg << "code-deopt" << kNext << Time() << kNext << code->CodeSize() << kNext
1492 << reinterpret_cast<void*>(code->InstructionStart());
1498 position.Print(deopt_location, *code);
1510 void Logger::CodeDeoptEvent(Handle<Code> code, DeoptimizeKind kind, Address pc,
1513 Deoptimizer::DeoptInfo info = Deoptimizer::GetDeoptInfo(*code, pc);
1514 ProcessDeoptEvent(code, info.position, Deoptimizer::MessageFor(kind),
1518 void Logger::CodeDependencyChangeEvent(Handle<Code> code,
1523 ProcessDeoptEvent(code, position, "dependency-change", reason);
1566 if (code_name == nullptr) return; // Not a code object.
1707 // Log the source code.
1838 // Iterate the heap to find JSFunctions and record their optimized code.
1852 // TODO(jarin) This leaves out deoptimized code that might still be on the
1853 // stack. Also note that we will not log optimized code objects that are
1859 handle(AbstractCode::cast(FromCodeT(function.code())), isolate));
1886 Handle<AbstractCode> code) {
1887 existing_code_logger_.LogExistingFunction(shared, code);
2141 const char* description = "Unknown code from before profiling";
2149 description = "STUB code";
2153 description = "Regular expression code";
2215 Code code = FromCodeT(builtins->code(builtin));
2216 LogCodeObject(code);
2264 Handle<SharedFunctionInfo> shared, Handle<AbstractCode> code,
2275 CodeCreateEvent(Logger::ToNativeByScript(tag, *script), code,
2281 code, shared, script_name))
2285 Logger::ToNativeByScript(tag, *script), code, shared,