summaryrefslogtreecommitdiffstats
path: root/js/src/gdb/tests/test-jsid.cpp
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /js/src/gdb/tests/test-jsid.cpp
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip
Add m-esr52 at 52.6.0
Diffstat (limited to 'js/src/gdb/tests/test-jsid.cpp')
-rw-r--r--js/src/gdb/tests/test-jsid.cpp44
1 files changed, 44 insertions, 0 deletions
diff --git a/js/src/gdb/tests/test-jsid.cpp b/js/src/gdb/tests/test-jsid.cpp
new file mode 100644
index 000000000..9dd1ff90a
--- /dev/null
+++ b/js/src/gdb/tests/test-jsid.cpp
@@ -0,0 +1,44 @@
+#include "gdb-tests.h"
+#include "jsapi.h"
+
+FRAGMENT(jsid, simple) {
+ JS::Rooted<JSString*> string(cx, JS_NewStringCopyZ(cx, "moon"));
+ JS::Rooted<JSString*> interned(cx, JS_AtomizeAndPinJSString(cx, string));
+ JS::Rooted<jsid> string_id(cx, INTERNED_STRING_TO_JSID(cx, interned));
+ jsid int_id = INT_TO_JSID(1729);
+ JS::Rooted<jsid> unique_symbol_id(
+ cx, SYMBOL_TO_JSID(JS::NewSymbol(cx, interned)));
+ JS::Rooted<jsid> registry_symbol_id(
+ cx, SYMBOL_TO_JSID(JS::GetSymbolFor(cx, interned)));
+ JS::Rooted<jsid> well_known_symbol_id(
+ cx, SYMBOL_TO_JSID(JS::GetWellKnownSymbol(cx, JS::SymbolCode::iterator)));
+ jsid void_id = JSID_VOID;
+ jsid empty_id = JSID_EMPTY;
+
+ breakpoint();
+
+ (void) string_id;
+ (void) int_id;
+ (void) unique_symbol_id;
+ (void) registry_symbol_id;
+ (void) well_known_symbol_id;
+ (void) void_id;
+ (void) empty_id;
+}
+
+void
+jsid_handles(JS::Handle<jsid> jsid_handle,
+ JS::MutableHandle<jsid> mutable_jsid_handle)
+{
+ // Prevent the linker from unifying this function with others that are
+ // equivalent in machine code but not type.
+ fprintf(stderr, "Called " __FILE__ ":jsid_handles\n");
+ breakpoint();
+}
+
+FRAGMENT(jsid, handles) {
+ JS::Rooted<JSString*> string(cx, JS_NewStringCopyZ(cx, "shovel"));
+ JS::Rooted<JSString*> interned(cx, JS_AtomizeAndPinJSString(cx, string));
+ JS::Rooted<jsid> string_id(cx, INTERNED_STRING_TO_JSID(cx, interned));
+ jsid_handles(string_id, &string_id);
+}