1 #include "gdb-tests.h"
2 #include "jsapi.h"
3
4 #include "js/Symbol.h"
5 #include "vm/BigIntType.h"
6
FRAGMENT(jsval,simple)7 FRAGMENT(jsval, simple) {
8 using namespace JS;
9
10 RootedValue fortytwo(cx, Int32Value(42));
11 RootedValue fortytwoD(cx, DoubleValue(42));
12 RootedValue negone(cx, Int32Value(-1));
13 RootedValue undefined(cx, UndefinedValue());
14 RootedValue null(cx, NullValue());
15 RootedValue js_true(cx, BooleanValue(true));
16 RootedValue js_false(cx, BooleanValue(false));
17 RootedValue elements_hole(cx, js::MagicValue(JS_ELEMENTS_HOLE));
18
19 RootedValue empty_string(cx);
20 empty_string.setString(JS_NewStringCopyZ(cx, ""));
21 RootedString hello(cx, JS_NewStringCopyZ(cx, "Hello!"));
22 RootedValue friendly_string(cx, StringValue(hello));
23 RootedValue symbol(cx, SymbolValue(GetSymbolFor(cx, hello)));
24 RootedValue bi(cx, BigIntValue(BigInt::zero(cx)));
25
26 RootedValue global(cx);
27 global.setObject(*CurrentGlobalOrNull(cx));
28
29 // Some interesting value that floating-point won't munge.
30 RootedValue onehundredthirtysevenonehundredtwentyeighths(
31 cx, DoubleValue(137.0 / 128.0));
32
33 breakpoint();
34
35 use(fortytwo);
36 use(fortytwoD);
37 use(negone);
38 use(undefined);
39 use(js_true);
40 use(js_false);
41 use(null);
42 use(elements_hole);
43 use(empty_string);
44 use(friendly_string);
45 use(symbol);
46 use(bi);
47 use(global);
48 }
49