mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Backout 754a1efb5b37 for bustage on a CLOSED TREE
This commit is contained in:
parent
b1fb442071
commit
98b249d2c0
@ -207,7 +207,7 @@ EvalKernel(JSContext *cx, const CallArgs &args, EvalType evalType, StackFrame *c
|
||||
if (!stableStr)
|
||||
return false;
|
||||
|
||||
StableCharPtr chars = stableStr->chars();
|
||||
const jschar *chars = stableStr->chars();
|
||||
size_t length = stableStr->length();
|
||||
|
||||
// If the eval string starts with '(' or '[' and ends with ')' or ']', it may be JSON.
|
||||
@ -271,7 +271,8 @@ EvalKernel(JSContext *cx, const CallArgs &args, EvalType evalType, StackFrame *c
|
||||
.setPrincipals(principals)
|
||||
.setOriginPrincipals(originPrincipals);
|
||||
JSScript *compiled = frontend::CompileScript(cx, scopeobj, caller, options,
|
||||
chars, length, stableStr, staticLevel);
|
||||
chars, length, stableStr,
|
||||
staticLevel);
|
||||
if (!compiled)
|
||||
return false;
|
||||
|
||||
|
@ -49,7 +49,7 @@ class RegExpMatchBuilder
|
||||
};
|
||||
|
||||
static bool
|
||||
CreateRegExpMatchResult(JSContext *cx, JSString *input_, StableCharPtr chars, size_t length,
|
||||
CreateRegExpMatchResult(JSContext *cx, JSString *input_, const jschar *chars, size_t length,
|
||||
MatchPairs *matchPairs, Value *rval)
|
||||
{
|
||||
RootedString input(cx, input_);
|
||||
@ -68,7 +68,7 @@ CreateRegExpMatchResult(JSContext *cx, JSString *input_, StableCharPtr chars, si
|
||||
return false;
|
||||
|
||||
if (!input) {
|
||||
input = js_NewStringCopyN(cx, chars.get(), length);
|
||||
input = js_NewStringCopyN(cx, chars, length);
|
||||
if (!input)
|
||||
return false;
|
||||
}
|
||||
@ -102,7 +102,7 @@ CreateRegExpMatchResult(JSContext *cx, JSString *input_, StableCharPtr chars, si
|
||||
template <class T>
|
||||
bool
|
||||
ExecuteRegExpImpl(JSContext *cx, RegExpStatics *res, T &re, JSLinearString *input,
|
||||
StableCharPtr chars, size_t length,
|
||||
const jschar *chars, size_t length,
|
||||
size_t *lastIndex, RegExpExecType type, Value *rval)
|
||||
{
|
||||
LifoAllocScope allocScope(&cx->tempLifoAlloc());
|
||||
@ -134,16 +134,16 @@ ExecuteRegExpImpl(JSContext *cx, RegExpStatics *res, T &re, JSLinearString *inpu
|
||||
}
|
||||
|
||||
bool
|
||||
js::ExecuteRegExp(JSContext *cx, RegExpStatics *res, RegExpShared &shared,
|
||||
Handle<JSStableString*> input, StableCharPtr chars, size_t length,
|
||||
js::ExecuteRegExp(JSContext *cx, RegExpStatics *res, RegExpShared &shared, JSLinearString *input,
|
||||
const jschar *chars, size_t length,
|
||||
size_t *lastIndex, RegExpExecType type, Value *rval)
|
||||
{
|
||||
return ExecuteRegExpImpl(cx, res, shared, input, chars, length, lastIndex, type, rval);
|
||||
}
|
||||
|
||||
bool
|
||||
js::ExecuteRegExp(JSContext *cx, RegExpStatics *res, RegExpObject &reobj,
|
||||
Handle<JSStableString*> input, StableCharPtr chars, size_t length,
|
||||
js::ExecuteRegExp(JSContext *cx, RegExpStatics *res, RegExpObject &reobj, JSLinearString *input,
|
||||
const jschar *chars, size_t length,
|
||||
size_t *lastIndex, RegExpExecType type, Value *rval)
|
||||
{
|
||||
return ExecuteRegExpImpl(cx, res, reobj, input, chars, length, lastIndex, type, rval);
|
||||
@ -580,8 +580,8 @@ js::ExecuteRegExp(JSContext *cx, RegExpExecType execType, HandleObject regexp,
|
||||
RegExpStatics *res = cx->regExpStatics();
|
||||
|
||||
/* Step 3. */
|
||||
Rooted<JSStableString*> stableInput(cx, string->ensureStable(cx));
|
||||
if (!stableInput)
|
||||
Rooted<JSLinearString*> linearInput(cx, string->ensureLinear(cx));
|
||||
if (!linearInput)
|
||||
return false;
|
||||
|
||||
/* Step 4. */
|
||||
@ -596,8 +596,8 @@ js::ExecuteRegExp(JSContext *cx, RegExpExecType execType, HandleObject regexp,
|
||||
if (!re->global() && !re->sticky())
|
||||
i = 0;
|
||||
|
||||
StableCharPtr chars = stableInput->chars();
|
||||
size_t length = stableInput->length();
|
||||
const jschar *chars = linearInput->chars();
|
||||
size_t length = linearInput->length();
|
||||
|
||||
/* Step 9a. */
|
||||
if (i < 0 || i > length) {
|
||||
@ -608,7 +608,7 @@ js::ExecuteRegExp(JSContext *cx, RegExpExecType execType, HandleObject regexp,
|
||||
|
||||
/* Steps 8-21. */
|
||||
size_t lastIndexInt(i);
|
||||
if (!ExecuteRegExp(cx, res, *re, stableInput, chars, length, &lastIndexInt, execType,
|
||||
if (!ExecuteRegExp(cx, res, *re, linearInput.get(), chars, length, &lastIndexInt, execType,
|
||||
rval.address())) {
|
||||
return false;
|
||||
}
|
||||
|
@ -27,12 +27,12 @@ namespace js {
|
||||
*/
|
||||
bool
|
||||
ExecuteRegExp(JSContext *cx, RegExpStatics *res, RegExpObject &reobj,
|
||||
Handle<JSStableString*> input, StableCharPtr chars, size_t length,
|
||||
JSLinearString *input, const jschar *chars, size_t length,
|
||||
size_t *lastIndex, RegExpExecType type, Value *rval);
|
||||
|
||||
bool
|
||||
ExecuteRegExp(JSContext *cx, RegExpStatics *res, RegExpShared &shared,
|
||||
Handle<JSStableString*> input, StableCharPtr chars, size_t length,
|
||||
JSLinearString *input, const jschar *chars, size_t length,
|
||||
size_t *lastIndex, RegExpExecType type, Value *rval);
|
||||
|
||||
bool
|
||||
|
@ -49,7 +49,7 @@ SetSourceMap(JSContext *cx, TokenStream &tokenStream, ScriptSource *ss, JSScript
|
||||
JSScript *
|
||||
frontend::CompileScript(JSContext *cx, HandleObject scopeChain, StackFrame *callerFrame,
|
||||
const CompileOptions &options,
|
||||
StableCharPtr chars, size_t length,
|
||||
const jschar *chars, size_t length,
|
||||
JSString *source_ /* = NULL */,
|
||||
unsigned staticLevel /* = 0 */)
|
||||
{
|
||||
@ -250,7 +250,7 @@ frontend::CompileScript(JSContext *cx, HandleObject scopeChain, StackFrame *call
|
||||
// handler attribute in an HTML <INPUT> tag, or in a Function() constructor.
|
||||
bool
|
||||
frontend::CompileFunctionBody(JSContext *cx, HandleFunction fun, CompileOptions options,
|
||||
const AutoNameVector &formals, StableCharPtr chars, size_t length)
|
||||
const AutoNameVector &formals, const jschar *chars, size_t length)
|
||||
{
|
||||
if (!CheckLength(cx, length))
|
||||
return false;
|
||||
|
@ -15,12 +15,12 @@ namespace frontend {
|
||||
|
||||
JSScript *
|
||||
CompileScript(JSContext *cx, HandleObject scopeChain, StackFrame *callerFrame,
|
||||
const CompileOptions &options, StableCharPtr chars, size_t length,
|
||||
const CompileOptions &options, const jschar *chars, size_t length,
|
||||
JSString *source_ = NULL, unsigned staticLevel = 0);
|
||||
|
||||
bool
|
||||
CompileFunctionBody(JSContext *cx, HandleFunction fun, CompileOptions options,
|
||||
const AutoNameVector &formals, StableCharPtr chars, size_t length);
|
||||
const AutoNameVector &formals, const jschar *chars, size_t length);
|
||||
|
||||
} /* namespace frontend */
|
||||
} /* namespace js */
|
||||
|
@ -323,7 +323,7 @@ ParseContext::generateFunctionBindings(JSContext *cx, InternalHandle<Bindings*>
|
||||
}
|
||||
|
||||
Parser::Parser(JSContext *cx, const CompileOptions &options,
|
||||
StableCharPtr chars, size_t length, bool foldConstants)
|
||||
const jschar *chars, size_t length, bool foldConstants)
|
||||
: AutoGCRooter(cx, PARSER),
|
||||
context(cx),
|
||||
strictModeGetter(thisForCtor()),
|
||||
@ -6941,8 +6941,8 @@ Parser::primaryExpr(TokenKind tt, bool afterDoubleDot)
|
||||
if (!pn)
|
||||
return NULL;
|
||||
|
||||
const jschar *chars = tokenStream.getTokenbuf().begin();
|
||||
size_t length = tokenStream.getTokenbuf().length();
|
||||
const StableCharPtr chars(tokenStream.getTokenbuf().begin(), length);
|
||||
RegExpFlag flags = tokenStream.currentToken().regExpFlags();
|
||||
RegExpStatics *res = context->regExpStatics();
|
||||
|
||||
|
@ -268,7 +268,7 @@ struct Parser : private AutoGCRooter
|
||||
|
||||
public:
|
||||
Parser(JSContext *cx, const CompileOptions &options,
|
||||
StableCharPtr chars, size_t length, bool foldConstants);
|
||||
const jschar *chars, size_t length, bool foldConstants);
|
||||
~Parser();
|
||||
|
||||
friend void AutoGCRooter::trace(JSTracer *trc);
|
||||
|
@ -117,18 +117,19 @@ frontend::IsIdentifier(JSLinearString *str)
|
||||
|
||||
/* Initialize members that aren't initialized in |init|. */
|
||||
TokenStream::TokenStream(JSContext *cx, const CompileOptions &options,
|
||||
StableCharPtr base, size_t length, StrictModeGetter *smg)
|
||||
const jschar *base, size_t length, StrictModeGetter *smg)
|
||||
: tokens(),
|
||||
tokensRoot(cx, &tokens),
|
||||
cursor(),
|
||||
lookahead(),
|
||||
lineno(options.lineno),
|
||||
flags(),
|
||||
linebase(base.get()),
|
||||
linebase(base),
|
||||
prevLinebase(NULL),
|
||||
linebaseRoot(cx, &linebase),
|
||||
prevLinebaseRoot(cx, &prevLinebase),
|
||||
userbuf(base.get(), length),
|
||||
userbuf(base, length),
|
||||
userbufRoot(cx, &userbuf),
|
||||
filename(options.filename),
|
||||
sourceMap(NULL),
|
||||
listenerTSData(),
|
||||
@ -148,7 +149,7 @@ TokenStream::TokenStream(JSContext *cx, const CompileOptions &options,
|
||||
void *listenerData = cx->runtime->debugHooks.sourceHandlerData;
|
||||
|
||||
if (listener)
|
||||
listener(options.filename, options.lineno, base.get(), length, &listenerTSData, listenerData);
|
||||
listener(options.filename, options.lineno, base, length, &listenerTSData, listenerData);
|
||||
|
||||
/*
|
||||
* This table holds all the token kinds that satisfy these properties:
|
||||
|
@ -479,7 +479,7 @@ class TokenStream
|
||||
typedef Vector<jschar, 32> CharBuffer;
|
||||
|
||||
TokenStream(JSContext *cx, const CompileOptions &options,
|
||||
StableCharPtr base, size_t length, StrictModeGetter *smg);
|
||||
const jschar *base, size_t length, StrictModeGetter *smg);
|
||||
|
||||
~TokenStream();
|
||||
|
||||
@ -855,6 +855,7 @@ class TokenStream
|
||||
js::SkipRoot linebaseRoot;
|
||||
js::SkipRoot prevLinebaseRoot;
|
||||
TokenBuf userbuf; /* user input buffer */
|
||||
js::SkipRoot userbufRoot;
|
||||
const char *filename; /* input filename or null */
|
||||
jschar *sourceMap; /* source map's filename or null */
|
||||
void *listenerTSData;/* listener data for this TokenStream */
|
||||
|
@ -164,7 +164,7 @@ EvalScriptVersion16(JSContext *cx, unsigned argc, jsval *vp)
|
||||
JS_ASSERT(JSVAL_IS_STRING(argv[0]));
|
||||
JSStableString *str = JSVAL_TO_STRING(argv[0])->ensureStable(cx);
|
||||
JS_ASSERT(str);
|
||||
return callbackData->evalVersion(str->chars().get(), str->length(), JSVERSION_1_6);
|
||||
return callbackData->evalVersion(str->chars(), str->length(), JSVERSION_1_6);
|
||||
}
|
||||
|
||||
JSBool
|
||||
|
@ -349,7 +349,7 @@ JS_ConvertArgumentsVA(JSContext *cx, unsigned argc, jsval *argv, const char *for
|
||||
JSStableString *stable = str->ensureStable(cx);
|
||||
if (!stable)
|
||||
return JS_FALSE;
|
||||
*va_arg(ap, const jschar **) = stable->chars().get();
|
||||
*va_arg(ap, const jschar **) = stable->chars();
|
||||
} else {
|
||||
*va_arg(ap, JSString **) = str;
|
||||
}
|
||||
@ -5190,7 +5190,7 @@ JS::Compile(JSContext *cx, HandleObject obj, CompileOptions options,
|
||||
JS_ASSERT_IF(options.principals, cx->compartment->principals == options.principals);
|
||||
AutoLastFrameCheck lfc(cx);
|
||||
|
||||
return frontend::CompileScript(cx, obj, NULL, options, StableCharPtr(chars, length), length);
|
||||
return frontend::CompileScript(cx, obj, NULL, options, chars, length);
|
||||
}
|
||||
|
||||
JSScript *
|
||||
@ -5359,7 +5359,7 @@ JS_BufferIsCompilableUnit(JSContext *cx, JSBool bytes_are_utf8, JSObject *objArg
|
||||
{
|
||||
CompileOptions options(cx);
|
||||
options.setCompileAndGo(false);
|
||||
Parser parser(cx, options, StableCharPtr(chars, length), length, /* foldConstants = */ true);
|
||||
Parser parser(cx, options, chars, length, /* foldConstants = */ true);
|
||||
if (parser.init()) {
|
||||
older = JS_SetErrorReporter(cx, NULL);
|
||||
if (!parser.parse(obj) &&
|
||||
@ -5472,7 +5472,7 @@ JS::CompileFunction(JSContext *cx, HandleObject obj, CompileOptions options,
|
||||
if (!fun)
|
||||
return NULL;
|
||||
|
||||
if (!frontend::CompileFunctionBody(cx, fun, options, formals, StableCharPtr(chars, length), length))
|
||||
if (!frontend::CompileFunctionBody(cx, fun, options, formals, chars, length))
|
||||
return NULL;
|
||||
|
||||
if (obj && funAtom) {
|
||||
@ -5675,8 +5675,7 @@ JS::Evaluate(JSContext *cx, HandleObject obj, CompileOptions options,
|
||||
|
||||
options.setCompileAndGo(true);
|
||||
options.setNoScriptRval(!rval);
|
||||
RootedScript script(cx, frontend::CompileScript(cx, obj, NULL, options,
|
||||
StableCharPtr(chars, length), length));
|
||||
RootedScript script(cx, frontend::CompileScript(cx, obj, NULL, options, chars, length));
|
||||
if (!script)
|
||||
return false;
|
||||
|
||||
@ -6111,7 +6110,7 @@ JS_GetStringCharsZ(JSContext *cx, JSString *str)
|
||||
JSStableString *stable = str->ensureStable(cx);
|
||||
if (!stable)
|
||||
return NULL;
|
||||
return stable->chars().get();
|
||||
return stable->chars();
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(const jschar *)
|
||||
@ -6125,7 +6124,7 @@ JS_GetStringCharsZAndLength(JSContext *cx, JSString *str, size_t *plength)
|
||||
if (!stable)
|
||||
return NULL;
|
||||
*plength = stable->length();
|
||||
return stable->chars().get();
|
||||
return stable->chars();
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(const jschar *)
|
||||
@ -6139,7 +6138,7 @@ JS_GetStringCharsAndLength(JSContext *cx, JSString *str, size_t *plength)
|
||||
if (!stable)
|
||||
return NULL;
|
||||
*plength = stable->length();
|
||||
return stable->chars().get();
|
||||
return stable->chars();
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(const jschar *)
|
||||
@ -6149,7 +6148,7 @@ JS_GetInternedStringChars(JSString *str)
|
||||
JSStableString *stable = str->ensureStable(NULL);
|
||||
if (!stable)
|
||||
return NULL;
|
||||
return stable->chars().get();
|
||||
return stable->chars();
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(const jschar *)
|
||||
@ -6161,7 +6160,7 @@ JS_GetInternedStringCharsAndLength(JSString *str, size_t *plength)
|
||||
if (!stable)
|
||||
return NULL;
|
||||
*plength = stable->length();
|
||||
return stable->chars().get();
|
||||
return stable->chars();
|
||||
}
|
||||
|
||||
extern JS_PUBLIC_API(JSFlatString *)
|
||||
@ -6182,7 +6181,7 @@ JS_GetFlatStringChars(JSFlatString *str)
|
||||
JSStableString *stable = str->ensureStable(NULL);
|
||||
if (!stable)
|
||||
return NULL;
|
||||
return stable->chars().get();
|
||||
return str->chars();
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(JSBool)
|
||||
@ -6392,7 +6391,7 @@ JS_ParseJSON(JSContext *cx, const jschar *chars, uint32_t len, jsval *vp)
|
||||
CHECK_REQUEST(cx);
|
||||
|
||||
RootedValue reviver(cx, NullValue()), value(cx);
|
||||
if (!ParseJSONWithReviver(cx, StableCharPtr(chars, len), len, reviver, &value))
|
||||
if (!ParseJSONWithReviver(cx, chars, len, reviver, &value))
|
||||
return false;
|
||||
|
||||
*vp = value;
|
||||
@ -6406,7 +6405,7 @@ JS_ParseJSONWithReviver(JSContext *cx, const jschar *chars, uint32_t len, jsval
|
||||
CHECK_REQUEST(cx);
|
||||
|
||||
RootedValue reviver(cx, reviverArg), value(cx);
|
||||
if (!ParseJSONWithReviver(cx, StableCharPtr(chars, len), len, reviver, &value))
|
||||
if (!ParseJSONWithReviver(cx, chars, len, reviver, &value))
|
||||
return false;
|
||||
|
||||
*vp = value;
|
||||
@ -6824,8 +6823,7 @@ JS_NewRegExpObject(JSContext *cx, JSObject *objArg, char *bytes, size_t length,
|
||||
return NULL;
|
||||
|
||||
RegExpStatics *res = obj->asGlobal().getRegExpStatics();
|
||||
RegExpObject *reobj = RegExpObject::create(cx, res, StableCharPtr(chars, length), length,
|
||||
RegExpFlag(flags), NULL);
|
||||
RegExpObject *reobj = RegExpObject::create(cx, res, chars, length, RegExpFlag(flags), NULL);
|
||||
js_free(chars);
|
||||
return reobj;
|
||||
}
|
||||
@ -6837,8 +6835,7 @@ JS_NewUCRegExpObject(JSContext *cx, JSObject *objArg, jschar *chars, size_t leng
|
||||
AssertHeapIsIdle(cx);
|
||||
CHECK_REQUEST(cx);
|
||||
RegExpStatics *res = obj->asGlobal().getRegExpStatics();
|
||||
return RegExpObject::create(cx, res, StableCharPtr(chars, length), length,
|
||||
RegExpFlag(flags), NULL);
|
||||
return RegExpObject::create(cx, res, chars, length, RegExpFlag(flags), NULL);
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(void)
|
||||
@ -6873,8 +6870,8 @@ JS_ExecuteRegExp(JSContext *cx, JSObject *objArg, JSObject *reobjArg, jschar *ch
|
||||
CHECK_REQUEST(cx);
|
||||
|
||||
RegExpStatics *res = obj->asGlobal().getRegExpStatics();
|
||||
return ExecuteRegExp(cx, res, reobj->asRegExp(), NullPtr(), StableCharPtr(chars, length),
|
||||
length, indexp, test ? RegExpTest : RegExpExec, rval);
|
||||
return ExecuteRegExp(cx, res, reobj->asRegExp(), NULL, chars, length,
|
||||
indexp, test ? RegExpTest : RegExpExec, rval);
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(JSObject *)
|
||||
@ -6885,8 +6882,7 @@ JS_NewRegExpObjectNoStatics(JSContext *cx, char *bytes, size_t length, unsigned
|
||||
jschar *chars = InflateString(cx, bytes, &length);
|
||||
if (!chars)
|
||||
return NULL;
|
||||
RegExpObject *reobj = RegExpObject::createNoStatics(cx, StableCharPtr(chars, length), length,
|
||||
RegExpFlag(flags), NULL);
|
||||
RegExpObject *reobj = RegExpObject::createNoStatics(cx, chars, length, RegExpFlag(flags), NULL);
|
||||
js_free(chars);
|
||||
return reobj;
|
||||
}
|
||||
@ -6896,8 +6892,7 @@ JS_NewUCRegExpObjectNoStatics(JSContext *cx, jschar *chars, size_t length, unsig
|
||||
{
|
||||
AssertHeapIsIdle(cx);
|
||||
CHECK_REQUEST(cx);
|
||||
return RegExpObject::createNoStatics(cx, StableCharPtr(chars, length), length,
|
||||
RegExpFlag(flags), NULL);
|
||||
return RegExpObject::createNoStatics(cx, chars, length, RegExpFlag(flags), NULL);
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(JSBool)
|
||||
@ -6908,8 +6903,8 @@ JS_ExecuteRegExpNoStatics(JSContext *cx, JSObject *objArg, jschar *chars, size_t
|
||||
AssertHeapIsIdle(cx);
|
||||
CHECK_REQUEST(cx);
|
||||
|
||||
return ExecuteRegExp(cx, NULL, obj->asRegExp(), NullPtr(), StableCharPtr(chars, length),
|
||||
length, indexp, test ? RegExpTest : RegExpExec, rval);
|
||||
return ExecuteRegExp(cx, NULL, obj->asRegExp(), NULL, chars, length, indexp,
|
||||
test ? RegExpTest : RegExpExec, rval);
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(JSBool)
|
||||
|
@ -15,7 +15,6 @@
|
||||
#include "mozilla/FloatingPoint.h"
|
||||
#include "mozilla/StandardInteger.h"
|
||||
#ifdef __cplusplus
|
||||
# include "mozilla/RangedPtr.h"
|
||||
# include "mozilla/ThreadLocal.h"
|
||||
#endif
|
||||
|
||||
@ -48,18 +47,6 @@
|
||||
#ifdef __cplusplus
|
||||
namespace JS {
|
||||
|
||||
typedef mozilla::RangedPtr<const jschar> CharPtr;
|
||||
|
||||
class StableCharPtr : public CharPtr {
|
||||
public:
|
||||
StableCharPtr(const StableCharPtr &s) : CharPtr(s) {}
|
||||
StableCharPtr(const mozilla::RangedPtr<const jschar> &s) : CharPtr(s) {}
|
||||
StableCharPtr(const jschar *s, size_t len) : CharPtr(s, len) {}
|
||||
StableCharPtr(const jschar *pos, const jschar *start, size_t len)
|
||||
: CharPtr(pos, start, len)
|
||||
{}
|
||||
};
|
||||
|
||||
/*
|
||||
* Protecting non-jsval, non-JSObject *, non-JSString * values from collection
|
||||
*
|
||||
|
@ -312,7 +312,7 @@ js::AtomizeString(JSContext *cx, JSString *str, InternBehavior ib)
|
||||
if (!stable)
|
||||
return NULL;
|
||||
|
||||
const jschar *chars = stable->chars().get();
|
||||
const jschar *chars = stable->chars();
|
||||
size_t length = stable->length();
|
||||
JS_ASSERT(length <= JSString::MAX_LENGTH);
|
||||
return AtomizeInline(cx, &chars, length, ib);
|
||||
|
@ -1004,7 +1004,7 @@ JSStructuredCloneReader::startRead(Value *vp)
|
||||
return false;
|
||||
|
||||
size_t length = stable->length();
|
||||
const StableCharPtr chars = stable->chars();
|
||||
const jschar *chars = stable->chars();
|
||||
RegExpObject *reobj = RegExpObject::createNoStatics(context(), chars, length, flags, NULL);
|
||||
if (!reobj)
|
||||
return false;
|
||||
|
@ -289,7 +289,7 @@ JSCompartment::wrap(JSContext *cx, Value *vp)
|
||||
JSStableString *str = vp->toString()->ensureStable(cx);
|
||||
if (!str)
|
||||
return false;
|
||||
JSString *wrapped = js_NewStringCopyN(cx, str->chars().get(), str->length());
|
||||
JSString *wrapped = js_NewStringCopyN(cx, str->chars(), str->length());
|
||||
if (!wrapped)
|
||||
return false;
|
||||
vp->setString(wrapped);
|
||||
|
@ -739,6 +739,8 @@ JS_EvaluateUCInStackFrame(JSContext *cx, JSStackFrame *fpArg,
|
||||
if (!CheckDebugMode(cx))
|
||||
return false;
|
||||
|
||||
SkipRoot skip(cx, &chars);
|
||||
|
||||
Rooted<Env*> env(cx, JS_GetFrameScopeChain(cx, fpArg));
|
||||
if (!env)
|
||||
return false;
|
||||
@ -746,8 +748,7 @@ JS_EvaluateUCInStackFrame(JSContext *cx, JSStackFrame *fpArg,
|
||||
StackFrame *fp = Valueify(fpArg);
|
||||
|
||||
js::AutoCompartment ac(cx, env);
|
||||
return EvaluateInEnv(cx, env, fp, StableCharPtr(chars, length), length,
|
||||
filename, lineno, rval);
|
||||
return EvaluateInEnv(cx, env, fp, chars, length, filename, lineno, rval);
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(JSBool)
|
||||
|
@ -1114,7 +1114,7 @@ js_ReportUncaughtException(JSContext *cx)
|
||||
report.column = (unsigned) column;
|
||||
if (str) {
|
||||
if (JSStableString *stable = str->ensureStable(cx))
|
||||
report.ucmessage = stable->chars().get();
|
||||
report.ucmessage = stable->chars();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -555,7 +555,7 @@ JS_FRIEND_DATA(Class) js::FunctionClass = {
|
||||
|
||||
/* Find the body of a function (not including braces). */
|
||||
static bool
|
||||
FindBody(JSContext *cx, HandleFunction fun, StableCharPtr chars, size_t length,
|
||||
FindBody(JSContext *cx, HandleFunction fun, const jschar *chars, size_t length,
|
||||
size_t *bodyStart, size_t *bodyEnd)
|
||||
{
|
||||
// We don't need principals, since those are only used for error reporting.
|
||||
@ -591,7 +591,8 @@ FindBody(JSContext *cx, HandleFunction fun, StableCharPtr chars, size_t length,
|
||||
*bodyStart = ts.offsetOfToken(ts.currentToken());
|
||||
if (braced)
|
||||
*bodyStart += 1;
|
||||
StableCharPtr end(chars.get() + length, chars.get(), length);
|
||||
RangedPtr<const jschar> end(chars, length);
|
||||
end = chars + length;
|
||||
if (end[-1] == '}') {
|
||||
end--;
|
||||
} else {
|
||||
@ -599,7 +600,7 @@ FindBody(JSContext *cx, HandleFunction fun, StableCharPtr chars, size_t length,
|
||||
for (; unicode::IsSpaceOrBOM2(end[-1]); end--)
|
||||
;
|
||||
}
|
||||
*bodyEnd = end - chars;
|
||||
*bodyEnd = end.get() - chars;
|
||||
JS_ASSERT(*bodyStart <= *bodyEnd);
|
||||
return true;
|
||||
}
|
||||
@ -645,7 +646,7 @@ js::FunctionToString(JSContext *cx, HandleFunction fun, bool bodyOnly, bool lamb
|
||||
if (!src)
|
||||
return NULL;
|
||||
|
||||
StableCharPtr chars = src->chars();
|
||||
const jschar *chars = src->chars();
|
||||
bool exprBody = fun->flags & JSFUN_EXPR_CLOSURE;
|
||||
// The source data for functions created by calling the Function
|
||||
// constructor is only the function's body.
|
||||
@ -1290,7 +1291,7 @@ Function(JSContext *cx, unsigned argc, Value *vp)
|
||||
js_ReportOutOfMemory(cx);
|
||||
return false;
|
||||
}
|
||||
StableCharPtr collected_args(cp, args_length + 1);
|
||||
jschar *collected_args = cp;
|
||||
|
||||
/*
|
||||
* Concatenate the arguments into the new string, separated by commas.
|
||||
@ -1369,6 +1370,8 @@ Function(JSContext *cx, unsigned argc, Value *vp)
|
||||
#endif
|
||||
|
||||
JS::Anchor<JSString *> strAnchor(NULL);
|
||||
const jschar *chars;
|
||||
size_t length;
|
||||
|
||||
RootedString str(cx);
|
||||
if (!args.length())
|
||||
@ -1381,8 +1384,8 @@ Function(JSContext *cx, unsigned argc, Value *vp)
|
||||
if (!stable)
|
||||
return false;
|
||||
strAnchor.set(str);
|
||||
StableCharPtr chars = stable->chars();
|
||||
size_t length = stable->length();
|
||||
chars = stable->chars();
|
||||
length = stable->length();
|
||||
|
||||
/*
|
||||
* NB: (new Function) is not lexically closed by its caller, it's just an
|
||||
|
@ -863,7 +863,7 @@ Revive(JSContext *cx, HandleValue reviver, MutableHandleValue vp)
|
||||
namespace js {
|
||||
|
||||
JSBool
|
||||
ParseJSONWithReviver(JSContext *cx, StableCharPtr chars, size_t length, HandleValue reviver,
|
||||
ParseJSONWithReviver(JSContext *cx, const jschar *chars, size_t length, HandleValue reviver,
|
||||
MutableHandleValue vp, DecodingMode decodingMode /* = STRICT */)
|
||||
{
|
||||
/* 15.12.2 steps 2-3. */
|
||||
|
@ -38,7 +38,7 @@ enum DecodingMode { STRICT, LEGACY };
|
||||
namespace js {
|
||||
|
||||
extern JS_FRIEND_API(JSBool)
|
||||
ParseJSONWithReviver(JSContext *cx, JS::StableCharPtr chars, size_t length, HandleValue filter,
|
||||
ParseJSONWithReviver(JSContext *cx, const jschar *chars, size_t length, HandleValue filter,
|
||||
MutableHandleValue vp, DecodingMode decodingMode = STRICT);
|
||||
|
||||
} /* namespace js */
|
||||
|
@ -27,8 +27,8 @@ class JSONParser
|
||||
/* Data members */
|
||||
|
||||
JSContext * const cx;
|
||||
JS::StableCharPtr current;
|
||||
const JS::StableCharPtr end;
|
||||
mozilla::RangedPtr<const jschar> current;
|
||||
const mozilla::RangedPtr<const jschar> end;
|
||||
|
||||
js::Value v;
|
||||
|
||||
@ -55,12 +55,12 @@ class JSONParser
|
||||
* Description of this syntax is deliberately omitted: new code should only
|
||||
* use strict JSON parsing.
|
||||
*/
|
||||
JSONParser(JSContext *cx, JS::StableCharPtr data, size_t length,
|
||||
JSONParser(JSContext *cx, const jschar *data, size_t length,
|
||||
ParsingMode parsingMode = StrictJSON,
|
||||
ErrorHandling errorHandling = RaiseError)
|
||||
: cx(cx),
|
||||
current(data),
|
||||
end((data + length).get(), data.get(), length),
|
||||
current(data, length),
|
||||
end(data + length, data, length),
|
||||
parsingMode(parsingMode),
|
||||
errorHandling(errorHandling)
|
||||
#ifdef DEBUG
|
||||
|
@ -3484,7 +3484,7 @@ reflect_parse(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
if (!stable)
|
||||
return JS_FALSE;
|
||||
|
||||
const StableCharPtr chars = stable->chars();
|
||||
const jschar *chars = stable->chars();
|
||||
size_t length = stable->length();
|
||||
CompileOptions options(cx);
|
||||
options.setFileAndLine(filename, lineno);
|
||||
|
@ -1128,7 +1128,7 @@ ScriptSource::substring(JSContext *cx, uint32_t start, uint32_t stop)
|
||||
}
|
||||
cx->runtime->sourceDataCache.put(this, cached);
|
||||
}
|
||||
chars = cached->chars().get();
|
||||
chars = cached->chars();
|
||||
JS_ASSERT(chars);
|
||||
} else {
|
||||
chars = data.source;
|
||||
@ -1140,7 +1140,7 @@ ScriptSource::substring(JSContext *cx, uint32_t start, uint32_t stop)
|
||||
}
|
||||
|
||||
bool
|
||||
ScriptSource::setSourceCopy(JSContext *cx, StableCharPtr src, uint32_t length,
|
||||
ScriptSource::setSourceCopy(JSContext *cx, const jschar *src, uint32_t length,
|
||||
bool argumentsNotIncluded, SourceCompressionToken *tok)
|
||||
{
|
||||
JS_ASSERT(!hasSourceData());
|
||||
@ -1157,12 +1157,12 @@ ScriptSource::setSourceCopy(JSContext *cx, StableCharPtr src, uint32_t length,
|
||||
ready_ = false;
|
||||
#endif
|
||||
tok->ss = this;
|
||||
tok->chars = src.get();
|
||||
tok->chars = src;
|
||||
cx->runtime->sourceCompressorThread.compress(tok);
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
PodCopy(data.source, src.get(), length_);
|
||||
PodCopy(data.source, src, length_);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -1028,7 +1028,7 @@ struct ScriptSource
|
||||
destroy(rt);
|
||||
}
|
||||
bool setSourceCopy(JSContext *cx,
|
||||
StableCharPtr src,
|
||||
const jschar *src,
|
||||
uint32_t length,
|
||||
bool argumentsNotIncluded,
|
||||
SourceCompressionToken *tok);
|
||||
|
@ -1673,8 +1673,8 @@ static bool
|
||||
DoMatch(JSContext *cx, RegExpStatics *res, JSString *str, RegExpShared &re,
|
||||
DoMatchCallback callback, void *data, MatchControlFlags flags, Value *rval)
|
||||
{
|
||||
Rooted<JSStableString*> stableStr(cx, str->ensureStable(cx));
|
||||
if (!stableStr)
|
||||
Rooted<JSLinearString*> linearStr(cx, str->ensureLinear(cx));
|
||||
if (!linearStr)
|
||||
return false;
|
||||
|
||||
if (re.global()) {
|
||||
@ -1683,10 +1683,10 @@ DoMatch(JSContext *cx, RegExpStatics *res, JSString *str, RegExpShared &re,
|
||||
if (!JS_CHECK_OPERATION_LIMIT(cx))
|
||||
return false;
|
||||
|
||||
StableCharPtr chars = stableStr->chars();
|
||||
size_t charsLen = stableStr->length();
|
||||
const jschar *chars = linearStr->chars();
|
||||
size_t charsLen = linearStr->length();
|
||||
|
||||
if (!ExecuteRegExp(cx, res, re, stableStr, chars, charsLen, &i, type, rval))
|
||||
if (!ExecuteRegExp(cx, res, re, linearStr, chars, charsLen, &i, type, rval))
|
||||
return false;
|
||||
if (!Matched(type, *rval))
|
||||
break;
|
||||
@ -1696,13 +1696,13 @@ DoMatch(JSContext *cx, RegExpStatics *res, JSString *str, RegExpShared &re,
|
||||
++i;
|
||||
}
|
||||
} else {
|
||||
StableCharPtr chars = stableStr->chars();
|
||||
size_t charsLen = stableStr->length();
|
||||
const jschar *chars = linearStr->chars();
|
||||
size_t charsLen = linearStr->length();
|
||||
|
||||
RegExpExecType type = (flags & TEST_SINGLE_BIT) ? RegExpTest : RegExpExec;
|
||||
bool callbackOnSingle = !!(flags & CALLBACK_ON_SINGLE_BIT);
|
||||
size_t i = 0;
|
||||
if (!ExecuteRegExp(cx, res, re, stableStr, chars, charsLen, &i, type, rval))
|
||||
if (!ExecuteRegExp(cx, res, re, linearStr, chars, charsLen, &i, type, rval))
|
||||
return false;
|
||||
if (callbackOnSingle && Matched(type, *rval) && !callback(cx, res, 0, data))
|
||||
return false;
|
||||
@ -1819,18 +1819,18 @@ js::str_search(JSContext *cx, unsigned argc, Value *vp)
|
||||
if (!g.normalizeRegExp(cx, false, 1, args))
|
||||
return false;
|
||||
|
||||
Rooted<JSStableString*> stableStr(cx, str->ensureStable(cx));
|
||||
if (!stableStr)
|
||||
JSLinearString *linearStr = str->ensureLinear(cx);
|
||||
if (!linearStr)
|
||||
return false;
|
||||
|
||||
StableCharPtr chars = stableStr->chars();
|
||||
size_t length = stableStr->length();
|
||||
const jschar *chars = linearStr->chars();
|
||||
size_t length = linearStr->length();
|
||||
RegExpStatics *res = cx->regExpStatics();
|
||||
|
||||
/* Per ECMAv5 15.5.4.12 (5) The last index property is ignored and left unchanged. */
|
||||
size_t i = 0;
|
||||
Value result;
|
||||
if (!ExecuteRegExp(cx, res, g.regExp(), stableStr, chars, length, &i, RegExpTest, &result))
|
||||
if (!ExecuteRegExp(cx, res, g.regExp(), linearStr, chars, length, &i, RegExpTest, &result))
|
||||
return false;
|
||||
|
||||
if (result.isTrue())
|
||||
@ -2443,8 +2443,8 @@ js::str_replace(JSContext *cx, unsigned argc, Value *vp)
|
||||
JSStableString *stable = rdata.repstr->ensureStable(cx);
|
||||
if (!stable)
|
||||
return false;
|
||||
rdata.dollarEnd = stable->chars().get() + stable->length();
|
||||
rdata.dollar = js_strchr_limit(stable->chars().get(), '$', rdata.dollarEnd);
|
||||
rdata.dollarEnd = stable->chars() + stable->length();
|
||||
rdata.dollar = js_strchr_limit(stable->chars(), '$', rdata.dollarEnd);
|
||||
}
|
||||
|
||||
rdata.fig.initFunction(ObjectOrNullValue(rdata.lambda));
|
||||
@ -2512,7 +2512,7 @@ class SplitMatchResult {
|
||||
|
||||
template<class Matcher>
|
||||
static JSObject *
|
||||
SplitHelper(JSContext *cx, Handle<JSStableString*> str, uint32_t limit, const Matcher &splitMatch,
|
||||
SplitHelper(JSContext *cx, Handle<JSLinearString*> str, uint32_t limit, const Matcher &splitMatch,
|
||||
Handle<TypeObject*> type)
|
||||
{
|
||||
size_t strLength = str->length();
|
||||
@ -2654,12 +2654,11 @@ class SplitRegExpMatcher
|
||||
|
||||
static const bool returnsCaptures = true;
|
||||
|
||||
bool operator()(JSContext *cx, Handle<JSStableString*> str, size_t index,
|
||||
bool operator()(JSContext *cx, JSLinearString *str, size_t index,
|
||||
SplitMatchResult *result) const
|
||||
{
|
||||
AssertCanGC();
|
||||
Value rval = UndefinedValue();
|
||||
StableCharPtr chars = str->chars();
|
||||
const jschar *chars = str->chars();
|
||||
size_t length = str->length();
|
||||
if (!ExecuteRegExp(cx, res, re, str, chars, length, &index, RegExpTest, &rval))
|
||||
return false;
|
||||
@ -2688,7 +2687,6 @@ class SplitStringMatcher
|
||||
|
||||
bool operator()(JSContext *cx, JSLinearString *str, size_t index, SplitMatchResult *res) const
|
||||
{
|
||||
AutoAssertNoGC nogc;
|
||||
JS_ASSERT(index == 0 || index < str->length());
|
||||
const jschar *chars = str->chars();
|
||||
int match = StringMatch(chars + index, str->length() - index,
|
||||
@ -2763,18 +2761,18 @@ js::str_split(JSContext *cx, unsigned argc, Value *vp)
|
||||
args.rval().setObject(*aobj);
|
||||
return true;
|
||||
}
|
||||
Rooted<JSStableString*> stableStr(cx, str->ensureStable(cx));
|
||||
if (!stableStr)
|
||||
Rooted<JSLinearString*> strlin(cx, str->ensureLinear(cx));
|
||||
if (!strlin)
|
||||
return false;
|
||||
|
||||
/* Steps 11-15. */
|
||||
JSObject *aobj;
|
||||
if (!re.initialized()) {
|
||||
SplitStringMatcher matcher(cx, sepstr);
|
||||
aobj = SplitHelper(cx, stableStr, limit, matcher, type);
|
||||
aobj = SplitHelper(cx, strlin, limit, matcher, type);
|
||||
} else {
|
||||
SplitRegExpMatcher matcher(*re, cx->regExpStatics());
|
||||
aobj = SplitHelper(cx, stableStr, limit, matcher, type);
|
||||
aobj = SplitHelper(cx, strlin, limit, matcher, type);
|
||||
}
|
||||
if (!aobj)
|
||||
return false;
|
||||
|
@ -1184,7 +1184,7 @@ ParseNodeToQName(Parser *parser, ParseNode *pn,
|
||||
JSStableString *str = atom->ensureStable(cx);
|
||||
if (!str)
|
||||
return NULL;
|
||||
start = str->chars().get();
|
||||
start = str->chars();
|
||||
length = str->length();
|
||||
JS_ASSERT(length != 0 && *start != '@');
|
||||
JS_ASSERT(length != 1 || *start != '*');
|
||||
@ -1764,7 +1764,7 @@ ParseXMLSource(JSContext *cx, HandleString src)
|
||||
{
|
||||
CompileOptions options(cx);
|
||||
options.setFileAndLine(filename, lineno);
|
||||
Parser parser(cx, options, StableCharPtr(chars, length), length, /* foldConstants = */ true);
|
||||
Parser parser(cx, options, chars, length, /* foldConstants = */ true);
|
||||
if (parser.init()) {
|
||||
JSObject *scopeChain = GetCurrentScopeChain(cx);
|
||||
if (!scopeChain) {
|
||||
|
@ -3091,9 +3091,7 @@ Parse(JSContext *cx, unsigned argc, jsval *vp)
|
||||
options.setFileAndLine("<string>", 1)
|
||||
.setCompileAndGo(false);
|
||||
Parser parser(cx, options,
|
||||
JS::StableCharPtr(JS_GetStringCharsZ(cx, scriptContents),
|
||||
JS_GetStringLength(scriptContents)),
|
||||
JS_GetStringLength(scriptContents),
|
||||
JS_GetStringCharsZ(cx, scriptContents), JS_GetStringLength(scriptContents),
|
||||
/* foldConstants = */ true);
|
||||
if (!parser.init())
|
||||
return false;
|
||||
@ -3369,8 +3367,7 @@ ParseLegacyJSON(JSContext *cx, unsigned argc, jsval *vp)
|
||||
return false;
|
||||
|
||||
RootedValue value(cx, NullValue());
|
||||
return js::ParseJSONWithReviver(cx, StableCharPtr(chars, length), length,
|
||||
value, args.rval(), LEGACY);
|
||||
return js::ParseJSONWithReviver(cx, chars, length, value, args.rval(), LEGACY);
|
||||
}
|
||||
|
||||
static JSBool
|
||||
|
@ -3391,12 +3391,13 @@ DebuggerFrame_setOnPop(JSContext *cx, unsigned argc, Value *vp)
|
||||
}
|
||||
|
||||
JSBool
|
||||
js::EvaluateInEnv(JSContext *cx, Handle<Env*> env, StackFrame *fp, StableCharPtr chars,
|
||||
js::EvaluateInEnv(JSContext *cx, Handle<Env*> env, StackFrame *fp, const jschar *chars,
|
||||
unsigned length, const char *filename, unsigned lineno, Value *rval)
|
||||
{
|
||||
assertSameCompartment(cx, env, fp);
|
||||
|
||||
JS_ASSERT(!IsPoisonedPtr(chars.get()));
|
||||
JS_ASSERT(!IsPoisonedPtr(chars));
|
||||
SkipRoot skip(cx, &chars);
|
||||
|
||||
RootedValue thisv(cx);
|
||||
if (fp) {
|
||||
|
@ -523,7 +523,7 @@ Debugger::onNewScript(JSContext *cx, JSScript *script, GlobalObject *compileAndG
|
||||
}
|
||||
|
||||
extern JSBool
|
||||
EvaluateInEnv(JSContext *cx, Handle<Env*> env, StackFrame *fp, StableCharPtr chars,
|
||||
EvaluateInEnv(JSContext *cx, Handle<Env*> env, StackFrame *fp, const jschar *chars,
|
||||
unsigned length, const char *filename, unsigned lineno, Value *rval);
|
||||
|
||||
}
|
||||
|
@ -215,18 +215,18 @@ RegExpCode::compile(JSContext *cx, JSLinearString &pattern, unsigned *parenCount
|
||||
}
|
||||
|
||||
RegExpRunStatus
|
||||
RegExpCode::execute(JSContext *cx, StableCharPtr chars, size_t length, size_t start,
|
||||
RegExpCode::execute(JSContext *cx, const jschar *chars, size_t length, size_t start,
|
||||
int *output, size_t outputCount)
|
||||
{
|
||||
int result;
|
||||
#if ENABLE_YARR_JIT
|
||||
(void) cx; /* Unused. */
|
||||
if (codeBlock.isFallBack())
|
||||
result = JSC::Yarr::interpret(byteCode, chars.get(), start, length, output);
|
||||
result = JSC::Yarr::interpret(byteCode, chars, start, length, output);
|
||||
else
|
||||
result = JSC::Yarr::execute(codeBlock, chars.get(), start, length, output);
|
||||
result = JSC::Yarr::execute(codeBlock, chars, start, length, output);
|
||||
#else
|
||||
result = JSC::Yarr::interpret(byteCode, chars.get(), start, length, output);
|
||||
result = JSC::Yarr::interpret(byteCode, chars, start, length, output);
|
||||
#endif
|
||||
|
||||
if (result == -1)
|
||||
@ -275,7 +275,7 @@ RegExpShared::RegExpShared(JSRuntime *rt, RegExpFlag flags)
|
||||
{}
|
||||
|
||||
RegExpObject *
|
||||
RegExpObject::create(JSContext *cx, RegExpStatics *res, StableCharPtr chars, size_t length,
|
||||
RegExpObject::create(JSContext *cx, RegExpStatics *res, const jschar *chars, size_t length,
|
||||
RegExpFlag flags, TokenStream *tokenStream)
|
||||
{
|
||||
RegExpFlag staticsFlags = res->getFlags();
|
||||
@ -283,10 +283,10 @@ RegExpObject::create(JSContext *cx, RegExpStatics *res, StableCharPtr chars, siz
|
||||
}
|
||||
|
||||
RegExpObject *
|
||||
RegExpObject::createNoStatics(JSContext *cx, StableCharPtr chars, size_t length, RegExpFlag flags,
|
||||
RegExpObject::createNoStatics(JSContext *cx, const jschar *chars, size_t length, RegExpFlag flags,
|
||||
TokenStream *tokenStream)
|
||||
{
|
||||
RootedAtom source(cx, AtomizeChars(cx, chars.get(), length));
|
||||
RootedAtom source(cx, AtomizeChars(cx, chars, length));
|
||||
if (!source)
|
||||
return NULL;
|
||||
|
||||
@ -403,7 +403,7 @@ RegExpObject::init(JSContext *cx, HandleAtom source, RegExpFlag flags)
|
||||
}
|
||||
|
||||
RegExpRunStatus
|
||||
RegExpObject::execute(JSContext *cx, StableCharPtr chars, size_t length, size_t *lastIndex,
|
||||
RegExpObject::execute(JSContext *cx, const jschar *chars, size_t length, size_t *lastIndex,
|
||||
MatchPairs **output)
|
||||
{
|
||||
RegExpGuard g;
|
||||
@ -469,7 +469,7 @@ RegExpShared::compile(JSContext *cx, JSAtom *source)
|
||||
}
|
||||
|
||||
RegExpRunStatus
|
||||
RegExpShared::execute(JSContext *cx, StableCharPtr chars, size_t length, size_t *lastIndex,
|
||||
RegExpShared::execute(JSContext *cx, const jschar *chars, size_t length, size_t *lastIndex,
|
||||
MatchPairs **output)
|
||||
{
|
||||
const size_t origLength = length;
|
||||
|
@ -132,7 +132,7 @@ class RegExpCode
|
||||
|
||||
|
||||
RegExpRunStatus
|
||||
execute(JSContext *cx, StableCharPtr chars, size_t length, size_t start,
|
||||
execute(JSContext *cx, const jschar *chars, size_t length, size_t start,
|
||||
int *output, size_t outputCount);
|
||||
};
|
||||
|
||||
@ -183,7 +183,7 @@ class RegExpShared
|
||||
/* Primary interface: run this regular expression on the given string. */
|
||||
|
||||
RegExpRunStatus
|
||||
execute(JSContext *cx, StableCharPtr chars, size_t length, size_t *lastIndex,
|
||||
execute(JSContext *cx, const jschar *chars, size_t length, size_t *lastIndex,
|
||||
MatchPairs **output);
|
||||
|
||||
/* Accessors */
|
||||
@ -314,11 +314,11 @@ class RegExpObject : public JSObject
|
||||
* execution, as opposed to during something like XDR.
|
||||
*/
|
||||
static RegExpObject *
|
||||
create(JSContext *cx, RegExpStatics *res, StableCharPtr chars, size_t length,
|
||||
create(JSContext *cx, RegExpStatics *res, const jschar *chars, size_t length,
|
||||
RegExpFlag flags, frontend::TokenStream *ts);
|
||||
|
||||
static RegExpObject *
|
||||
createNoStatics(JSContext *cx, StableCharPtr chars, size_t length, RegExpFlag flags,
|
||||
createNoStatics(JSContext *cx, const jschar *chars, size_t length, RegExpFlag flags,
|
||||
frontend::TokenStream *ts);
|
||||
|
||||
static RegExpObject *
|
||||
@ -336,7 +336,7 @@ class RegExpObject : public JSObject
|
||||
* into the |RegExpStatics| appropriately, if necessary.
|
||||
*/
|
||||
RegExpRunStatus
|
||||
execute(JSContext *cx, StableCharPtr chars, size_t length, size_t *lastIndex,
|
||||
execute(JSContext *cx, const jschar *chars, size_t length, size_t *lastIndex,
|
||||
MatchPairs **output);
|
||||
|
||||
/* Accessors. */
|
||||
|
@ -546,12 +546,6 @@ class JSStableString : public JSFlatString
|
||||
|
||||
public:
|
||||
static inline JSStableString *new_(JSContext *cx, const jschar *chars, size_t length);
|
||||
|
||||
JS_ALWAYS_INLINE
|
||||
JS::StableCharPtr chars() const {
|
||||
JS_ASSERT(!JSString::isInline());
|
||||
return JS::StableCharPtr(d.u1.chars, length());
|
||||
}
|
||||
};
|
||||
|
||||
JS_STATIC_ASSERT(sizeof(JSStableString) == sizeof(JSString));
|
||||
|
@ -46,7 +46,6 @@ class StringBuffer
|
||||
inline bool resize(size_t len) { return cb.resize(len); }
|
||||
inline bool append(const jschar c) { return cb.append(c); }
|
||||
inline bool append(const jschar *chars, size_t len) { return cb.append(chars, len); }
|
||||
inline bool append(const CharPtr chars, size_t len) { return cb.append(chars.get(), len); }
|
||||
inline bool append(const jschar *begin, const jschar *end) { return cb.append(begin, end); }
|
||||
inline bool append(JSString *str);
|
||||
inline bool append(JSLinearString *str);
|
||||
@ -65,9 +64,6 @@ class StringBuffer
|
||||
void infallibleAppend(const jschar *chars, size_t len) {
|
||||
cb.infallibleAppend(chars, len);
|
||||
}
|
||||
void infallibleAppend(const CharPtr chars, size_t len) {
|
||||
cb.infallibleAppend(chars.get(), len);
|
||||
}
|
||||
void infallibleAppend(const jschar *begin, const jschar *end) {
|
||||
cb.infallibleAppend(begin, end);
|
||||
}
|
||||
|
@ -128,13 +128,13 @@ class RangedPtr
|
||||
|
||||
RangedPtr<T> operator+(size_t inc) {
|
||||
MOZ_ASSERT(inc <= size_t(-1) / sizeof(T));
|
||||
MOZ_ASSERT(ptr + inc >= ptr);
|
||||
MOZ_ASSERT(ptr + inc > ptr);
|
||||
return create(ptr + inc);
|
||||
}
|
||||
|
||||
RangedPtr<T> operator-(size_t dec) {
|
||||
MOZ_ASSERT(dec <= size_t(-1) / sizeof(T));
|
||||
MOZ_ASSERT(ptr - dec <= ptr);
|
||||
MOZ_ASSERT(ptr - dec < ptr);
|
||||
return create(ptr - dec);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user