Debian Codegraph @

js/src/gdb/tests/test-jsbytecode.cpp

raw
1 #include "gdb-tests.h"
2 #include "js/CompilationAndEvaluation.h"
3 #include "js/CompileOptions.h"
4 #include "js/SourceText.h"
5 #include "util/Text.h"
6 #include "vm/JSFunction.h"
7 #include "vm/JSScript.h"
8 #include "mozilla/Utf8.h"
9
10 FRAGMENT(jsbytecode, simple) {
11 constexpr unsigned line0 = __LINE__;
12 static const char chars[] = R"(
13 debugger;
14 )";
15
16 JS::CompileOptions opts(cx);
17 opts.setFileAndLine(__FILE__, line0 + 1);
18
19 JS::SourceText<mozilla::Utf8Unit> srcBuf;
20 JS::Rooted<JS::Value> rval(cx);
21
22 bool ok =
23 srcBuf.init(cx, chars, js_strlen(chars), JS::SourceOwnership::Borrowed);
24
25 JSScript* script = JS::Compile(cx, opts, srcBuf);
26 jsbytecode* code = script->code();
27
28 breakpoint();
29
30 use(ok);
31 use(code);
32 }