Index: test/mjsunit/wasm/wasm-constants.js |
diff --git a/test/mjsunit/wasm/wasm-constants.js b/test/mjsunit/wasm/wasm-constants.js |
index 861ffa562c030db9ec4bd78b57d51d5c7b748745..f8558fced8ea9bedfb607fb44202ba6917a352cc 100644 |
--- a/test/mjsunit/wasm/wasm-constants.js |
+++ b/test/mjsunit/wasm/wasm-constants.js |
@@ -15,6 +15,38 @@ function bytes() { |
return buffer; |
} |
+// Header declaration constants |
+var kWasmH0 = 0; |
+var kWasmH1 = 0x61; |
+var kWasmH2 = 0x73; |
+var kWasmH3 = 0x6d; |
+ |
+var kWasmV0 = 10; |
+var kWasmV1 = 0; |
+var kWasmV2 = 0; |
+var kWasmV3 = 0; |
+ |
+var kHeaderSize = 8; |
+ |
+function bytesWithHeader() { |
+ var buffer = new ArrayBuffer(kHeaderSize + arguments.length); |
+ var view = new Uint8Array(buffer); |
+ view[0] = kWasmH0; |
+ view[1] = kWasmH1; |
+ view[2] = kWasmH2; |
+ view[3] = kWasmH3; |
+ view[4] = kWasmV0; |
+ view[5] = kWasmV1; |
+ view[6] = kWasmV2; |
+ view[7] = kWasmV3; |
+ for (var i = 0; i < arguments.length; i++) { |
+ var val = arguments[i]; |
+ if ((typeof val) == "string") val = val.charCodeAt(0); |
+ view[kHeaderSize + i] = val | 0; |
+ } |
+ return buffer; |
+} |
+ |
// Section declaration constants |
var kDeclMemory = 0x00; |
var kDeclSignatures = 0x01; |