michael@0: #include "gdb-tests.h" michael@0: #include "jsatom.h" michael@0: #include "jscntxt.h" michael@0: michael@0: // When JSGC_ANALYSIS is #defined, Rooted needs the definition michael@0: // of JSFlatString in order to figure out its ThingRootKind michael@0: #include "vm/String.h" michael@0: michael@0: FRAGMENT(JSString, simple) { michael@0: JS::Rooted empty(cx, JS_NewStringCopyN(cx, nullptr, 0)); michael@0: JS::Rooted x(cx, JS_NewStringCopyN(cx, "x", 1)); michael@0: JS::Rooted z(cx, JS_NewStringCopyZ(cx, "z")); michael@0: michael@0: // I expect this will be a non-inlined string. michael@0: JS::Rooted stars(cx, JS_NewStringCopyZ(cx, michael@0: "*************************" michael@0: "*************************" michael@0: "*************************" michael@0: "*************************")); michael@0: michael@0: // This may well be an inlined string. michael@0: JS::Rooted xz(cx, JS_ConcatStrings(cx, x, z)); michael@0: michael@0: // This will probably be a rope. michael@0: JS::Rooted doubleStars(cx, JS_ConcatStrings(cx, stars, stars)); michael@0: michael@0: // Ensure we're not confused by typedefs for pointer types. michael@0: JSString *xRaw = x; michael@0: michael@0: breakpoint(); michael@0: michael@0: (void) empty; michael@0: (void) x; michael@0: (void) z; michael@0: (void) stars; michael@0: (void) xz; michael@0: (void) doubleStars; michael@0: (void) xRaw; michael@0: } michael@0: michael@0: FRAGMENT(JSString, null) { michael@0: JS::Rooted null(cx, nullptr); michael@0: JSString *nullRaw = null; michael@0: michael@0: breakpoint(); michael@0: michael@0: (void) null; michael@0: (void) nullRaw; michael@0: } michael@0: michael@0: FRAGMENT(JSString, subclasses) { michael@0: JS::Rooted flat(cx, JS_FlattenString(cx, JS_NewStringCopyZ(cx, "Hi!"))); michael@0: michael@0: breakpoint(); michael@0: michael@0: (void) flat; michael@0: } michael@0: michael@0: FRAGMENT(JSString, atom) { michael@0: JSAtom *molybdenum = js::Atomize(cx, "molybdenum", 10); michael@0: breakpoint(); michael@0: michael@0: (void) molybdenum; michael@0: }