diff options
author | Ben Wiederhake <BenWiederhake.GitHub@gmx.de> | 2021-12-24 21:38:33 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2022-01-01 15:40:39 +0100 |
commit | a1aea5b9e0c5c621fc6fcae9995163d285d150ef (patch) | |
tree | 34075bdca8b6309dc1b4fcd162aae609f726dbd2 /Userland | |
parent | 8b8cd184822a1ac98d09ac587368cb515f2a85ff (diff) | |
download | serenity-a1aea5b9e0c5c621fc6fcae9995163d285d150ef.zip |
LibJS: Avoid unnecessary copies in PlaceBlocks codegen pass
Diffstat (limited to 'Userland')
-rw-r--r-- | Userland/Libraries/LibJS/Bytecode/Pass/PlaceBlocks.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/Userland/Libraries/LibJS/Bytecode/Pass/PlaceBlocks.cpp b/Userland/Libraries/LibJS/Bytecode/Pass/PlaceBlocks.cpp index a9b925f301..017ef191b2 100644 --- a/Userland/Libraries/LibJS/Bytecode/Pass/PlaceBlocks.cpp +++ b/Userland/Libraries/LibJS/Bytecode/Pass/PlaceBlocks.cpp @@ -26,7 +26,11 @@ void PlaceBlocks::perform(PassPipelineExecutable& executable) reachable_blocks.set(block); replaced_blocks.append(*const_cast<BasicBlock*>(block)); - for (auto& entry : cfg.get(block).value_or({})) + auto children = cfg.find(block); + if (children == cfg.end()) + return; + + for (auto& entry : children->value) visit(entry); }; |