Index: test/cctest/wasm/wasm-run-utils.h |
diff --git a/test/cctest/wasm/wasm-run-utils.h b/test/cctest/wasm/wasm-run-utils.h |
index f85f4ca3e2ccec4cd5bdde5371e9128d69c366e6..533fab41b921da5f0d090857fc9be4b23b546e49 100644 |
--- a/test/cctest/wasm/wasm-run-utils.h |
+++ b/test/cctest/wasm/wasm-run-utils.h |
@@ -509,18 +509,7 @@ |
uint32_t function_index() { return function_->func_index; } |
void Build(const byte* start, const byte* end) { |
- size_t locals_size = local_decls.Size(); |
- size_t total_size = end - start + locals_size + 1; |
- byte* buffer = static_cast<byte*>(zone()->New(total_size)); |
- // Prepend the local decls to the code. |
- local_decls.Emit(buffer); |
- // Emit the code. |
- memcpy(buffer + locals_size, start, end - start); |
- // Append an extra end opcode. |
- buffer[total_size - 1] = kExprEnd; |
- |
- start = buffer; |
- end = buffer + total_size; |
+ local_decls.Prepend(zone(), &start, &end); |
CHECK_GE(kMaxInt, end - start); |
int len = static_cast<int>(end - start); |