* Registers dynamic (JIT-compiled) code entry. * * @param {string} type Code entry type. * @param {string} name Code entry name. * @param {number} start Starting address. * @param {number} size Code entry size. * @param {number} sfiAddr Shared function object address. * @param {
(type, name, timestamp, start, size, sfiAddr, state)
| 528 | * @param {Profile.CodeState} state Optimization state. |
| 529 | */ |
| 530 | addFuncCode(type, name, timestamp, start, size, sfiAddr, state) { |
| 531 | // As code and functions are in the same address space, |
| 532 | // it is safe to put them in a single code map. |
| 533 | let sfi = this.codeMap_.findDynamicEntryByStartAddress(sfiAddr); |
| 534 | // Overwrite any old (unused) code objects that overlap with the new SFI. |
| 535 | const new_sfi_old_code = !(sfi instanceof SharedFunctionInfoEntry) |
| 536 | if (sfi === null || new_sfi_old_code) { |
| 537 | sfi = new SharedFunctionInfoEntry(name, this.useBigIntAddresses); |
| 538 | this.codeMap_.addCode(sfiAddr, sfi); |
| 539 | } else if (sfi.name !== name) { |
| 540 | // SFI object has been overwritten with a new one. |
| 541 | sfi.name = name; |
| 542 | } |
| 543 | let entry = this.codeMap_.findDynamicEntryByStartAddress(start); |
| 544 | if (entry !== null) { |
| 545 | if (entry.size === size && entry.sfi === sfi) { |
| 546 | // Entry state has changed. |
| 547 | entry.state = state; |
| 548 | } else { |
| 549 | this.codeMap_.deleteCode(start); |
| 550 | entry = null; |
| 551 | } |
| 552 | } |
| 553 | if (entry === null) { |
| 554 | entry = new DynamicFuncCodeEntry(size, type, sfi, state); |
| 555 | this.codeMap_.addCode(start, entry); |
| 556 | } |
| 557 | return entry; |
| 558 | } |
| 559 | |
| 560 | /** |
| 561 | * Reports about moving of a dynamic code entry. |
no test coverage detected