Backed out changeset b71c8c052463 (bug 1943846) for causing mass failures. CLOSED...
[gecko.git] / devtools / client / performance-new / shared / profiler_get_symbols.js
blob2036a529b4c86c1901aebc8687cf8e35fd5d891e
1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
3 * You can obtain one at http://mozilla.org/MPL/2.0/. */
5 //
6 // THIS FILE IS AUTOGENERATED by wasm-bindgen.
7 //
8 // Generated from:
9 // https://github.com/mstange/profiler-get-symbols/commit/390b8c4be82c720dd3977ff205fb34bd7d0e00ba
10 // by following the instructions in that repository's Readme.md
13 let wasm_bindgen;
14 (function() {
15 const __exports = {};
16 let script_src;
17 if (typeof document !== 'undefined' && document.currentScript !== null) {
18 script_src = new URL(document.currentScript.src, location.href).toString();
20 let wasm = undefined;
22 const heap = new Array(128).fill(undefined);
24 heap.push(undefined, null, true, false);
26 function getObject(idx) { return heap[idx]; }
28 let WASM_VECTOR_LEN = 0;
30 let cachedUint8Memory0 = null;
32 function getUint8Memory0() {
33 if (cachedUint8Memory0 === null || cachedUint8Memory0.byteLength === 0) {
34 cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer);
36 return cachedUint8Memory0;
39 const cachedTextEncoder = (typeof TextEncoder !== 'undefined' ? new TextEncoder('utf-8') : { encode: () => { throw Error('TextEncoder not available') } } );
41 const encodeString = (typeof cachedTextEncoder.encodeInto === 'function'
42 ? function (arg, view) {
43 return cachedTextEncoder.encodeInto(arg, view);
45 : function (arg, view) {
46 const buf = cachedTextEncoder.encode(arg);
47 view.set(buf);
48 return {
49 read: arg.length,
50 written: buf.length
52 });
54 function passStringToWasm0(arg, malloc, realloc) {
56 if (realloc === undefined) {
57 const buf = cachedTextEncoder.encode(arg);
58 const ptr = malloc(buf.length, 1) >>> 0;
59 getUint8Memory0().subarray(ptr, ptr + buf.length).set(buf);
60 WASM_VECTOR_LEN = buf.length;
61 return ptr;
64 let len = arg.length;
65 let ptr = malloc(len, 1) >>> 0;
67 const mem = getUint8Memory0();
69 let offset = 0;
71 for (; offset < len; offset++) {
72 const code = arg.charCodeAt(offset);
73 if (code > 0x7F) break;
74 mem[ptr + offset] = code;
77 if (offset !== len) {
78 if (offset !== 0) {
79 arg = arg.slice(offset);
81 ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
82 const view = getUint8Memory0().subarray(ptr + offset, ptr + len);
83 const ret = encodeString(arg, view);
85 offset += ret.written;
86 ptr = realloc(ptr, len, offset, 1) >>> 0;
89 WASM_VECTOR_LEN = offset;
90 return ptr;
93 function isLikeNone(x) {
94 return x === undefined || x === null;
97 let cachedInt32Memory0 = null;
99 function getInt32Memory0() {
100 if (cachedInt32Memory0 === null || cachedInt32Memory0.byteLength === 0) {
101 cachedInt32Memory0 = new Int32Array(wasm.memory.buffer);
103 return cachedInt32Memory0;
106 let heap_next = heap.length;
108 function dropObject(idx) {
109 if (idx < 132) return;
110 heap[idx] = heap_next;
111 heap_next = idx;
114 function takeObject(idx) {
115 const ret = getObject(idx);
116 dropObject(idx);
117 return ret;
120 function addHeapObject(obj) {
121 if (heap_next === heap.length) heap.push(heap.length + 1);
122 const idx = heap_next;
123 heap_next = heap[idx];
125 heap[idx] = obj;
126 return idx;
129 const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } );
131 if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); };
133 function getStringFromWasm0(ptr, len) {
134 ptr = ptr >>> 0;
135 return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
138 const CLOSURE_DTORS = (typeof FinalizationRegistry === 'undefined')
139 ? { register: () => {}, unregister: () => {} }
140 : new FinalizationRegistry(state => {
141 wasm.__wbindgen_export_2.get(state.dtor)(state.a, state.b)
144 function makeMutClosure(arg0, arg1, dtor, f) {
145 const state = { a: arg0, b: arg1, cnt: 1, dtor };
146 const real = (...args) => {
147 // First up with a closure we increment the internal reference
148 // count. This ensures that the Rust closure environment won't
149 // be deallocated while we're invoking it.
150 state.cnt++;
151 const a = state.a;
152 state.a = 0;
153 try {
154 return f(a, state.b, ...args);
155 } finally {
156 if (--state.cnt === 0) {
157 wasm.__wbindgen_export_2.get(state.dtor)(a, state.b);
158 CLOSURE_DTORS.unregister(state);
159 } else {
160 state.a = a;
164 real.original = state;
165 CLOSURE_DTORS.register(real, state, state);
166 return real;
168 function __wbg_adapter_20(arg0, arg1, arg2) {
169 wasm.wasm_bindgen__convert__closures__invoke1_mut__h5c75a368331e2dfc(arg0, arg1, addHeapObject(arg2));
172 function handleError(f, args) {
173 try {
174 return f.apply(this, args);
175 } catch (e) {
176 wasm.__wbindgen_exn_store(addHeapObject(e));
179 function __wbg_adapter_41(arg0, arg1, arg2, arg3) {
180 wasm.wasm_bindgen__convert__closures__invoke2_mut__hb4d9edc8ea00b6ab(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
184 * Usage:
186 * ```js
187 * async function getSymbolTable(debugName, breakpadId, libKeyToPathMap) {
188 * const helper = {
189 * getCandidatePathsForDebugFile: (info) => {
190 * const path = libKeyToPathMap.get(`${info.debugName}/${info.breakpadId}`);
191 * if (path !== undefined) {
192 * return [path];
194 * return [];
195 * },
196 * getCandidatePathsForBinary: (info) => [],
197 * readFile: async (filename) => {
198 * const byteLength = await getFileSizeInBytes(filename);
199 * const fileHandle = getFileHandle(filename);
200 * return {
201 * size: byteLength,
202 * readBytesInto: (array, offset) => {
203 * syncReadFilePartIntoBuffer(fileHandle, array, offset);
204 * },
205 * close: () => {},
206 * };
207 * },
208 * };
210 * const [addr, index, buffer] = await getCompactSymbolTable(debugName, breakpadId, helper);
211 * return [addr, index, buffer];
213 * ```
214 * @param {string} debug_name
215 * @param {string} breakpad_id
216 * @param {any} helper
217 * @returns {Promise<any>}
219 __exports.getCompactSymbolTable = function(debug_name, breakpad_id, helper) {
220 const ptr0 = passStringToWasm0(debug_name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
221 const len0 = WASM_VECTOR_LEN;
222 const ptr1 = passStringToWasm0(breakpad_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
223 const len1 = WASM_VECTOR_LEN;
224 const ret = wasm.getCompactSymbolTable(ptr0, len0, ptr1, len1, addHeapObject(helper));
225 return takeObject(ret);
229 * Usage:
231 * ```js
232 * async function queryAPIWrapper(url, requestJSONString, libKeyToPathMap) {
233 * const helper = {
234 * getCandidatePathsForDebugFile: (info) => {
235 * const path = libKeyToPathMap.get(`${info.debugName}/${info.breakpadId}`);
236 * if (path !== undefined) {
237 * return [path];
239 * return [];
240 * },
241 * getCandidatePathsForBinary: (info) => [],
242 * readFile: async (filename) => {
243 * const byteLength = await getFileSizeInBytes(filename);
244 * const fileHandle = getFileHandle(filename);
245 * return {
246 * size: byteLength,
247 * readBytesInto: (array, offset) => {
248 * syncReadFilePartIntoBuffer(fileHandle, array, offset);
249 * },
250 * close: () => {},
251 * };
252 * },
253 * };
255 * const responseJSONString = await queryAPI(url, requestJSONString, helper);
256 * return responseJSONString;
258 * ```
259 * @param {string} url
260 * @param {string} request_json
261 * @param {any} helper
262 * @returns {Promise<any>}
264 __exports.queryAPI = function(url, request_json, helper) {
265 const ptr0 = passStringToWasm0(url, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
266 const len0 = WASM_VECTOR_LEN;
267 const ptr1 = passStringToWasm0(request_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
268 const len1 = WASM_VECTOR_LEN;
269 const ret = wasm.queryAPI(ptr0, len0, ptr1, len1, addHeapObject(helper));
270 return takeObject(ret);
273 async function __wbg_load(module, imports) {
274 if (typeof Response === 'function' && module instanceof Response) {
275 if (typeof WebAssembly.instantiateStreaming === 'function') {
276 try {
277 return await WebAssembly.instantiateStreaming(module, imports);
279 } catch (e) {
280 if (module.headers.get('Content-Type') != 'application/wasm') {
281 console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e);
283 } else {
284 throw e;
289 const bytes = await module.arrayBuffer();
290 return await WebAssembly.instantiate(bytes, imports);
292 } else {
293 const instance = await WebAssembly.instantiate(module, imports);
295 if (instance instanceof WebAssembly.Instance) {
296 return { instance, module };
298 } else {
299 return instance;
304 function __wbg_get_imports() {
305 const imports = {};
306 imports.wbg = {};
307 imports.wbg.__wbg_get_0ee8ea3c7c984c45 = function(arg0, arg1) {
308 const ret = getObject(arg0)[arg1 >>> 0];
309 return addHeapObject(ret);
311 imports.wbg.__wbindgen_string_get = function(arg0, arg1) {
312 const obj = getObject(arg1);
313 const ret = typeof(obj) === 'string' ? obj : undefined;
314 var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
315 var len1 = WASM_VECTOR_LEN;
316 getInt32Memory0()[arg0 / 4 + 1] = len1;
317 getInt32Memory0()[arg0 / 4 + 0] = ptr1;
319 imports.wbg.__wbindgen_object_drop_ref = function(arg0) {
320 takeObject(arg0);
322 imports.wbg.__wbg_self_05040bd9523805b9 = function() { return handleError(function () {
323 const ret = self.self;
324 return addHeapObject(ret);
325 }, arguments) };
326 imports.wbg.__wbg_window_adc720039f2cb14f = function() { return handleError(function () {
327 const ret = window.window;
328 return addHeapObject(ret);
329 }, arguments) };
330 imports.wbg.__wbg_globalThis_622105db80c1457d = function() { return handleError(function () {
331 const ret = globalThis.globalThis;
332 return addHeapObject(ret);
333 }, arguments) };
334 imports.wbg.__wbg_global_f56b013ed9bcf359 = function() { return handleError(function () {
335 const ret = global.global;
336 return addHeapObject(ret);
337 }, arguments) };
338 imports.wbg.__wbindgen_is_undefined = function(arg0) {
339 const ret = getObject(arg0) === undefined;
340 return ret;
342 imports.wbg.__wbg_newnoargs_cfecb3965268594c = function(arg0, arg1) {
343 const ret = new Function(getStringFromWasm0(arg0, arg1));
344 return addHeapObject(ret);
346 imports.wbg.__wbg_call_3f093dd26d5569f8 = function() { return handleError(function (arg0, arg1) {
347 const ret = getObject(arg0).call(getObject(arg1));
348 return addHeapObject(ret);
349 }, arguments) };
350 imports.wbg.__wbindgen_memory = function() {
351 const ret = wasm.memory;
352 return addHeapObject(ret);
354 imports.wbg.__wbg_buffer_b914fb8b50ebbc3e = function(arg0) {
355 const ret = getObject(arg0).buffer;
356 return addHeapObject(ret);
358 imports.wbg.__wbg_newwithbyteoffsetandlength_7f2d9491ea8c746e = function(arg0, arg1, arg2) {
359 const ret = new Uint32Array(getObject(arg0), arg1 >>> 0, arg2 >>> 0);
360 return addHeapObject(ret);
362 imports.wbg.__wbg_new_437b9c4fbab85dd9 = function(arg0) {
363 const ret = new Uint32Array(getObject(arg0));
364 return addHeapObject(ret);
366 imports.wbg.__wbg_newwithbyteoffsetandlength_0de9ee56e9f6ee6e = function(arg0, arg1, arg2) {
367 const ret = new Uint8Array(getObject(arg0), arg1 >>> 0, arg2 >>> 0);
368 return addHeapObject(ret);
370 imports.wbg.__wbg_new_b1f2d6842d615181 = function(arg0) {
371 const ret = new Uint8Array(getObject(arg0));
372 return addHeapObject(ret);
374 imports.wbg.__wbg_of_94ac9e20a3c46ec5 = function(arg0, arg1, arg2) {
375 const ret = Array.of(getObject(arg0), getObject(arg1), getObject(arg2));
376 return addHeapObject(ret);
378 imports.wbg.__wbg_call_67f2111acd2dfdb6 = function() { return handleError(function (arg0, arg1, arg2) {
379 const ret = getObject(arg0).call(getObject(arg1), getObject(arg2));
380 return addHeapObject(ret);
381 }, arguments) };
382 imports.wbg.__wbindgen_object_clone_ref = function(arg0) {
383 const ret = getObject(arg0);
384 return addHeapObject(ret);
386 imports.wbg.__wbg_getCandidatePathsForDebugFile_19de1ea293153630 = function() { return handleError(function (arg0, arg1) {
387 const ret = getObject(arg0).getCandidatePathsForDebugFile(takeObject(arg1));
388 return addHeapObject(ret);
389 }, arguments) };
390 imports.wbg.__wbg_name_405bb0aa047a1bf5 = function(arg0) {
391 const ret = getObject(arg0).name;
392 return addHeapObject(ret);
394 imports.wbg.__wbg_message_2a19bb5b62cf8e22 = function(arg0) {
395 const ret = getObject(arg0).message;
396 return addHeapObject(ret);
398 imports.wbg.__wbg_from_58c79ccfb68060f5 = function(arg0) {
399 const ret = Array.from(getObject(arg0));
400 return addHeapObject(ret);
402 imports.wbg.__wbg_length_161c0d89c6535c1d = function(arg0) {
403 const ret = getObject(arg0).length;
404 return ret;
406 imports.wbg.__wbindgen_string_new = function(arg0, arg1) {
407 const ret = getStringFromWasm0(arg0, arg1);
408 return addHeapObject(ret);
410 imports.wbg.__wbg_getCandidatePathsForBinary_8311cb7aeae90263 = function() { return handleError(function (arg0, arg1) {
411 const ret = getObject(arg0).getCandidatePathsForBinary(takeObject(arg1));
412 return addHeapObject(ret);
413 }, arguments) };
414 imports.wbg.__wbindgen_cb_drop = function(arg0) {
415 const obj = takeObject(arg0).original;
416 if (obj.cnt-- == 1) {
417 obj.a = 0;
418 return true;
420 const ret = false;
421 return ret;
423 imports.wbg.__wbg_new_632630b5cec17f21 = function() {
424 const ret = new Object();
425 return addHeapObject(ret);
427 imports.wbg.__wbg_set_9182712abebf82ef = function(arg0, arg1, arg2) {
428 getObject(arg0)[takeObject(arg1)] = takeObject(arg2);
430 imports.wbg.__wbg_close_0c320371e818efa4 = function() { return handleError(function (arg0) {
431 getObject(arg0).close();
432 }, arguments) };
433 imports.wbg.__wbg_readBytesInto_8dda8e37c69f2cbd = function() { return handleError(function (arg0, arg1, arg2) {
434 getObject(arg0).readBytesInto(takeObject(arg1), arg2);
435 }, arguments) };
436 imports.wbg.__wbg_readFile_33b95391c6839d48 = function(arg0, arg1, arg2) {
437 const ret = getObject(arg0).readFile(getStringFromWasm0(arg1, arg2));
438 return addHeapObject(ret);
440 imports.wbg.__wbg_then_20a5920e447d1cb1 = function(arg0, arg1, arg2) {
441 const ret = getObject(arg0).then(getObject(arg1), getObject(arg2));
442 return addHeapObject(ret);
444 imports.wbg.__wbg_size_45521802c91634d3 = function() { return handleError(function (arg0) {
445 const ret = getObject(arg0).size;
446 return ret;
447 }, arguments) };
448 imports.wbg.__wbg_new_70828a4353259d4b = function(arg0, arg1) {
449 try {
450 var state0 = {a: arg0, b: arg1};
451 var cb0 = (arg0, arg1) => {
452 const a = state0.a;
453 state0.a = 0;
454 try {
455 return __wbg_adapter_41(a, state0.b, arg0, arg1);
456 } finally {
457 state0.a = a;
460 const ret = new Promise(cb0);
461 return addHeapObject(ret);
462 } finally {
463 state0.a = state0.b = 0;
466 imports.wbg.__wbindgen_throw = function(arg0, arg1) {
467 throw new Error(getStringFromWasm0(arg0, arg1));
469 imports.wbg.__wbg_then_f9e58f5a50f43eae = function(arg0, arg1) {
470 const ret = getObject(arg0).then(getObject(arg1));
471 return addHeapObject(ret);
473 imports.wbg.__wbg_queueMicrotask_f61ee94ee663068b = function(arg0) {
474 queueMicrotask(getObject(arg0));
476 imports.wbg.__wbg_queueMicrotask_f82fc5d1e8f816ae = function(arg0) {
477 const ret = getObject(arg0).queueMicrotask;
478 return addHeapObject(ret);
480 imports.wbg.__wbindgen_is_function = function(arg0) {
481 const ret = typeof(getObject(arg0)) === 'function';
482 return ret;
484 imports.wbg.__wbg_resolve_5da6faf2c96fd1d5 = function(arg0) {
485 const ret = Promise.resolve(getObject(arg0));
486 return addHeapObject(ret);
488 imports.wbg.__wbindgen_closure_wrapper2106 = function(arg0, arg1, arg2) {
489 const ret = makeMutClosure(arg0, arg1, 159, __wbg_adapter_20);
490 return addHeapObject(ret);
493 return imports;
496 function __wbg_init_memory(imports, maybe_memory) {
500 function __wbg_finalize_init(instance, module) {
501 wasm = instance.exports;
502 __wbg_init.__wbindgen_wasm_module = module;
503 cachedInt32Memory0 = null;
504 cachedUint8Memory0 = null;
507 return wasm;
510 function initSync(module) {
511 if (wasm !== undefined) return wasm;
513 const imports = __wbg_get_imports();
515 __wbg_init_memory(imports);
517 if (!(module instanceof WebAssembly.Module)) {
518 module = new WebAssembly.Module(module);
521 const instance = new WebAssembly.Instance(module, imports);
523 return __wbg_finalize_init(instance, module);
526 async function __wbg_init(input) {
527 if (wasm !== undefined) return wasm;
529 if (typeof input === 'undefined' && typeof script_src !== 'undefined') {
530 input = script_src.replace(/\.js$/, '_bg.wasm');
532 const imports = __wbg_get_imports();
534 if (typeof input === 'string' || (typeof Request === 'function' && input instanceof Request) || (typeof URL === 'function' && input instanceof URL)) {
535 input = fetch(input);
538 __wbg_init_memory(imports);
540 const { instance, module } = await __wbg_load(await input, imports);
542 return __wbg_finalize_init(instance, module);
545 wasm_bindgen = Object.assign(__wbg_init, { initSync }, __exports);
547 })();