1 // Copyright 2021 the V8 project authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #if !V8_ENABLE_WEBASSEMBLY 6 #error This header should only be included if WebAssembly is enabled. 7 #endif // !V8_ENABLE_WEBASSEMBLY 8 9 #ifndef V8_COMPILER_WASM_LOOP_PEELING_H_ 10 #define V8_COMPILER_WASM_LOOP_PEELING_H_ 11 12 #include "src/compiler/common-operator.h" 13 #include "src/compiler/loop-analysis.h" 14 15 namespace v8 { 16 namespace internal { 17 namespace compiler { 18 19 // Loop peeling is an optimization that copies the body of a loop, creating 20 // a new copy of the body called the "peeled iteration" that represents the 21 // first iteration. It enables a kind of loop hoisting: repeated computations 22 // without side-effects in the body of the loop can be computed in the first 23 // iteration only and reused in the next iterations. 24 void PeelWasmLoop(Node* loop_node, ZoneUnorderedSet<Node*>* loop, Graph* graph, 25 CommonOperatorBuilder* common, Zone* tmp_zone, 26 SourcePositionTable* source_positions, 27 NodeOriginTable* node_origins); 28 29 } // namespace compiler 30 } // namespace internal 31 } // namespace v8 32 33 #endif // V8_COMPILER_WASM_LOOP_PEELING_H_ 34