summaryrefslogtreecommitdiffstats
path: root/js/src/gdb/tests/test-GCCellPtr.cpp
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 19:33:14 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 19:33:14 +0000
commit36d22d82aa202bb199967e9512281e9a53db42c9 (patch)
tree105e8c98ddea1c1e4784a60a5a6410fa416be2de /js/src/gdb/tests/test-GCCellPtr.cpp
parentInitial commit. (diff)
downloadfirefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.tar.xz
firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.zip
Adding upstream version 115.7.0esr.upstream/115.7.0esrupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'js/src/gdb/tests/test-GCCellPtr.cpp')
-rw-r--r--js/src/gdb/tests/test-GCCellPtr.cpp62
1 files changed, 62 insertions, 0 deletions
diff --git a/js/src/gdb/tests/test-GCCellPtr.cpp b/js/src/gdb/tests/test-GCCellPtr.cpp
new file mode 100644
index 0000000000..8dcf135be8
--- /dev/null
+++ b/js/src/gdb/tests/test-GCCellPtr.cpp
@@ -0,0 +1,62 @@
+#include "gdb-tests.h"
+
+#include "js/CompileOptions.h"
+#include "js/CompilationAndEvaluation.h"
+#include "js/GlobalObject.h"
+#include "js/HeapAPI.h"
+#include "js/RegExpFlags.h"
+#include "js/SourceText.h"
+#include "js/Symbol.h"
+#include "js/TypeDecls.h"
+#include "vm/BigIntType.h"
+#include "vm/JSObject.h"
+#include "vm/RegExpObject.h"
+#include "vm/Shape.h"
+
+#include "vm/JSObject-inl.h"
+
+FRAGMENT(GCCellPtr, simple) {
+ JS::Rooted<JSObject*> glob(cx, JS::CurrentGlobalOrNull(cx));
+ JS::Rooted<JSString*> empty(cx, JS_NewStringCopyN(cx, nullptr, 0));
+ JS::Rooted<JS::Symbol*> unique(cx, JS::NewSymbol(cx, nullptr));
+ JS::Rooted<JS::BigInt*> zeroBigInt(cx, JS::BigInt::zero(cx));
+ JS::Rooted<js::RegExpObject*> regExp(
+ cx, js::RegExpObject::create(cx, u"", 0, JS::RegExpFlags{},
+ js::GenericObject));
+ JS::Rooted<js::RegExpShared*> rootedRegExpShared(
+ cx, js::RegExpObject::getShared(cx, regExp));
+
+ JS::CompileOptions options(cx);
+ options.setFileAndLine(__FILE__, __LINE__);
+ JS::SourceText<char16_t> srcBuf;
+ (void)srcBuf.init(cx, nullptr, 0, JS::SourceOwnership::Borrowed);
+ JS::RootedScript emptyScript(cx, JS::Compile(cx, options, srcBuf));
+
+ // Inline TraceKinds.
+ JS::GCCellPtr nulll(nullptr);
+ JS::GCCellPtr object(glob.get());
+ JS::GCCellPtr string(empty.get());
+ JS::GCCellPtr symbol(unique.get());
+ JS::GCCellPtr bigint(zeroBigInt.get());
+ JS::GCCellPtr shape(glob->shape());
+
+ // Out-of-line TraceKinds.
+ JS::GCCellPtr baseShape(glob->shape()->base());
+ // JitCode can't easily be tested here, so skip it.
+ JS::GCCellPtr script(emptyScript.get());
+ JS::GCCellPtr scope(emptyScript->bodyScope());
+ JS::GCCellPtr regExpShared(rootedRegExpShared.get());
+
+ breakpoint();
+
+ use(nulll);
+ use(object);
+ use(string);
+ use(symbol);
+ use(bigint);
+ use(shape);
+ use(baseShape);
+ use(script);
+ use(scope);
+ use(regExpShared);
+}