mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-08 19:04:45 +00:00
Bug 788293 - Remove e4x support. r=jorendorff,terrence,evilpie.
Ding dong! The witch is dead!
This commit is contained in:
parent
5398a93d05
commit
d9f49c3dc8
@ -1129,10 +1129,7 @@ nsFrameScriptExecutor::InitTabChildGlobalInternal(nsISupports* aScope)
|
||||
|
||||
nsContentUtils::GetSecurityManager()->GetSystemPrincipal(getter_AddRefs(mPrincipal));
|
||||
|
||||
bool allowXML = Preferences::GetBool("javascript.options.xml.chrome");
|
||||
JS_SetOptions(cx, JS_GetOptions(cx) |
|
||||
JSOPTION_PRIVATE_IS_NSISUPPORTS |
|
||||
(allowXML ? JSOPTION_ALLOW_XML : 0));
|
||||
JS_SetOptions(cx, JS_GetOptions(cx) | JSOPTION_PRIVATE_IS_NSISUPPORTS);
|
||||
JS_SetVersion(cx, JSVERSION_LATEST);
|
||||
JS_SetErrorReporter(cx, ContentScriptErrorReporter);
|
||||
|
||||
|
@ -398,20 +398,6 @@ ParseTypeAttribute(const nsAString& aType, JSVersion* aVersion)
|
||||
return false;
|
||||
}
|
||||
|
||||
nsAutoString value;
|
||||
rv = parser.GetParameter("e4x", value);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
if (value.Length() == 1 && value[0] == '1') {
|
||||
// This happens in about 2 web pages. Enable E4X no matter what JS
|
||||
// version number was selected. We do this by turning on the "moar
|
||||
// XML" version bit. This is OK even if version has
|
||||
// JSVERSION_UNKNOWN (-1).
|
||||
*aVersion = js::VersionSetMoarXML(*aVersion, true);
|
||||
}
|
||||
} else if (rv != NS_ERROR_INVALID_ARG) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* vim: set ts=8 sts=4 et sw=4 tw=80: */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
@ -873,30 +874,14 @@ XULContentSinkImpl::OpenScript(const PRUnichar** aAttributes,
|
||||
}
|
||||
|
||||
if (langID != nsIProgrammingLanguage::UNKNOWN) {
|
||||
// Get the version string, and ensure the language supports it.
|
||||
nsAutoString versionName;
|
||||
rv = parser.GetParameter("version", versionName);
|
||||
// Get the version string, and ensure the language supports it.
|
||||
nsAutoString versionName;
|
||||
rv = parser.GetParameter("version", versionName);
|
||||
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
version = nsContentUtils::ParseJavascriptVersion(versionName);
|
||||
} else if (rv != NS_ERROR_INVALID_ARG) {
|
||||
return rv;
|
||||
}
|
||||
}
|
||||
// Some js specifics yet to be abstracted.
|
||||
if (langID == nsIProgrammingLanguage::JAVASCRIPT) {
|
||||
// By default scripts in XUL documents have E4X turned on. This
|
||||
// is still OK if version is JSVERSION_UNKNOWN (-1),
|
||||
version = js::VersionSetMoarXML(JSVersion(version), true);
|
||||
|
||||
nsAutoString value;
|
||||
rv = parser.GetParameter("e4x", value);
|
||||
if (NS_FAILED(rv)) {
|
||||
if (rv != NS_ERROR_INVALID_ARG)
|
||||
return rv;
|
||||
} else {
|
||||
if (value.Length() == 1 && value[0] == '0')
|
||||
version = js::VersionSetMoarXML(JSVersion(version), false);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
version = nsContentUtils::ParseJavascriptVersion(versionName);
|
||||
} else if (rv != NS_ERROR_INVALID_ARG) {
|
||||
return rv;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -907,10 +892,6 @@ XULContentSinkImpl::OpenScript(const PRUnichar** aAttributes,
|
||||
nsAutoString lang(aAttributes[1]);
|
||||
if (nsContentUtils::IsJavaScriptLanguage(lang, &version)) {
|
||||
langID = nsIProgrammingLanguage::JAVASCRIPT;
|
||||
|
||||
// Even when JS version < 1.6 is specified, E4X is
|
||||
// turned on in XUL.
|
||||
version = js::VersionSetMoarXML(JSVersion(version), true);
|
||||
}
|
||||
}
|
||||
aAttributes += 2;
|
||||
|
@ -1906,17 +1906,8 @@ nsGlobalWindow::CreateOuterObject(nsGlobalWindow* aNewInner)
|
||||
{
|
||||
JSContext* cx = mContext->GetNativeContext();
|
||||
|
||||
bool isChrome = IsChromeWindow();
|
||||
if (isChrome) {
|
||||
// Always enable E4X for XUL and other chrome content -- there is no
|
||||
// need to preserve the <!-- script hiding hack from JS-in-HTML daze
|
||||
// (introduced in 1995 for graceful script degradation in Netscape 1,
|
||||
// Mosaic, and other pre-JS browsers).
|
||||
JS_SetOptions(cx, JS_GetOptions(cx) | JSOPTION_MOAR_XML);
|
||||
}
|
||||
|
||||
JSObject* outer = NewOuterWindowProxy(cx, aNewInner->FastGetGlobalJSObject(),
|
||||
isChrome);
|
||||
IsChromeWindow());
|
||||
if (!outer) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
@ -1003,9 +1003,6 @@ nsJSContext::JSOptionChangedCallback(const char *pref, void *data)
|
||||
js_pccounts_content_str);
|
||||
bool useMethodJITAlways = Preferences::GetBool(js_methodjit_always_str);
|
||||
bool useTypeInference = !chromeWindow && contentWindow && Preferences::GetBool(js_typeinfer_str);
|
||||
bool useXML = Preferences::GetBool(chromeWindow || !contentWindow ?
|
||||
"javascript.options.xml.chrome" :
|
||||
"javascript.options.xml.content");
|
||||
bool useHardening = Preferences::GetBool(js_jit_hardening_str);
|
||||
bool useIon = Preferences::GetBool(js_ion_content_str);
|
||||
bool parallelIonCompilation = Preferences::GetBool(js_ion_parallel_compilation_str);
|
||||
@ -1018,7 +1015,6 @@ nsJSContext::JSOptionChangedCallback(const char *pref, void *data)
|
||||
usePCCounts = false;
|
||||
useTypeInference = false;
|
||||
useMethodJITAlways = true;
|
||||
useXML = false;
|
||||
useHardening = false;
|
||||
useIon = false;
|
||||
}
|
||||
@ -1049,11 +1045,6 @@ nsJSContext::JSOptionChangedCallback(const char *pref, void *data)
|
||||
else
|
||||
newDefaultJSOptions &= ~JSOPTION_ION;
|
||||
|
||||
if (useXML)
|
||||
newDefaultJSOptions |= JSOPTION_ALLOW_XML;
|
||||
else
|
||||
newDefaultJSOptions &= ~JSOPTION_ALLOW_XML;
|
||||
|
||||
#ifdef DEBUG
|
||||
// In debug builds, warnings are enabled in chrome context if
|
||||
// javascript.options.strict.debug is true
|
||||
@ -1070,8 +1061,7 @@ nsJSContext::JSOptionChangedCallback(const char *pref, void *data)
|
||||
else
|
||||
newDefaultJSOptions &= ~JSOPTION_WERROR;
|
||||
|
||||
::JS_SetOptions(context->mContext,
|
||||
newDefaultJSOptions & (JSRUNOPTION_MASK | JSOPTION_ALLOW_XML));
|
||||
::JS_SetOptions(context->mContext, newDefaultJSOptions & JSRUNOPTION_MASK);
|
||||
|
||||
::JS_SetParallelCompilationEnabled(context->mContext, parallelIonCompilation);
|
||||
|
||||
@ -1107,7 +1097,7 @@ nsJSContext::nsJSContext(JSRuntime *aRuntime, bool aGCOnDestruction,
|
||||
|
||||
++sContextCount;
|
||||
|
||||
mDefaultJSOptions = JSOPTION_PRIVATE_IS_NSISUPPORTS | JSOPTION_ALLOW_XML;
|
||||
mDefaultJSOptions = JSOPTION_PRIVATE_IS_NSISUPPORTS;
|
||||
|
||||
mContext = ::JS_NewContext(aRuntime, gStackSize);
|
||||
if (mContext) {
|
||||
|
@ -239,9 +239,9 @@ nsJSON::EncodeInternal(JSContext* cx, const JS::Value& aValue, nsJSONWriter* wri
|
||||
return NS_OK;
|
||||
|
||||
// Backward compatibility:
|
||||
// function/xml shall not pass, just "plain" objects and arrays
|
||||
// function shall not pass, just "plain" objects and arrays
|
||||
JSType type = JS_TypeOfValue(cx, val);
|
||||
if (type == JSTYPE_FUNCTION || type == JSTYPE_XML)
|
||||
if (type == JSTYPE_FUNCTION)
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
|
||||
// We're good now; try to stringify
|
||||
|
@ -151,7 +151,6 @@ enum {
|
||||
PREF_methodjit,
|
||||
PREF_methodjit_always,
|
||||
PREF_typeinference,
|
||||
PREF_allow_xml,
|
||||
PREF_jit_hardening,
|
||||
PREF_mem_max,
|
||||
PREF_ion,
|
||||
@ -172,7 +171,6 @@ const char* gPrefsToWatch[] = {
|
||||
JS_OPTIONS_DOT_STR "methodjit.content",
|
||||
JS_OPTIONS_DOT_STR "methodjit_always",
|
||||
JS_OPTIONS_DOT_STR "typeinference",
|
||||
JS_OPTIONS_DOT_STR "allow_xml",
|
||||
JS_OPTIONS_DOT_STR "jit_hardening",
|
||||
JS_OPTIONS_DOT_STR "mem.max",
|
||||
JS_OPTIONS_DOT_STR "ion.content",
|
||||
@ -230,9 +228,6 @@ PrefCallback(const char* aPrefName, void* aClosure)
|
||||
if (Preferences::GetBool(gPrefsToWatch[PREF_ion])) {
|
||||
newOptions |= JSOPTION_ION;
|
||||
}
|
||||
if (Preferences::GetBool(gPrefsToWatch[PREF_allow_xml])) {
|
||||
newOptions |= JSOPTION_ALLOW_XML;
|
||||
}
|
||||
|
||||
RuntimeService::SetDefaultJSContextOptions(newOptions);
|
||||
rts->UpdateAllWorkerJSContextOptions();
|
||||
|
@ -173,8 +173,6 @@ ObjectWrapperChild::jsval_to_JSVariant(JSContext* cx, jsval from, JSVariant* to)
|
||||
case JSTYPE_BOOLEAN:
|
||||
*to = !!JSVAL_TO_BOOLEAN(from);
|
||||
return true;
|
||||
case JSTYPE_XML:
|
||||
// fall through
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
@ -244,8 +244,6 @@ ObjectWrapperParent::jsval_to_JSVariant(JSContext* cx, jsval from,
|
||||
case JSTYPE_BOOLEAN:
|
||||
*to = !!JSVAL_TO_BOOLEAN(from);
|
||||
return true;
|
||||
case JSTYPE_XML:
|
||||
return with_error(cx, false, "CPOWs currently cannot handle JSTYPE_XML");
|
||||
default:
|
||||
return with_error(cx, false, "Bad jsval type");
|
||||
}
|
||||
|
@ -160,9 +160,6 @@ struct CompartmentStats
|
||||
, gcHeapScripts(0)
|
||||
, gcHeapTypeObjects(0)
|
||||
, gcHeapIonCodes(0)
|
||||
#if JS_HAS_XML_SUPPORT
|
||||
, gcHeapXML(0)
|
||||
#endif
|
||||
, objectsExtra()
|
||||
, stringCharsNonHuge(0)
|
||||
, shapesExtraTreeTables(0)
|
||||
@ -199,9 +196,6 @@ struct CompartmentStats
|
||||
, gcHeapScripts(other.gcHeapScripts)
|
||||
, gcHeapTypeObjects(other.gcHeapTypeObjects)
|
||||
, gcHeapIonCodes(other.gcHeapIonCodes)
|
||||
#if JS_HAS_XML_SUPPORT
|
||||
, gcHeapXML(other.gcHeapXML)
|
||||
#endif
|
||||
, objectsExtra(other.objectsExtra)
|
||||
, stringCharsNonHuge(other.stringCharsNonHuge)
|
||||
, shapesExtraTreeTables(other.shapesExtraTreeTables)
|
||||
@ -243,9 +237,6 @@ struct CompartmentStats
|
||||
size_t gcHeapScripts;
|
||||
size_t gcHeapTypeObjects;
|
||||
size_t gcHeapIonCodes;
|
||||
#if JS_HAS_XML_SUPPORT
|
||||
size_t gcHeapXML;
|
||||
#endif
|
||||
ObjectsExtraSizes objectsExtra;
|
||||
|
||||
size_t stringCharsNonHuge;
|
||||
@ -286,9 +277,6 @@ struct CompartmentStats
|
||||
ADD(gcHeapScripts);
|
||||
ADD(gcHeapTypeObjects);
|
||||
ADD(gcHeapIonCodes);
|
||||
#if JS_HAS_XML_SUPPORT
|
||||
ADD(gcHeapXML);
|
||||
#endif
|
||||
objectsExtra.add(cStats.objectsExtra);
|
||||
|
||||
ADD(stringCharsNonHuge);
|
||||
|
@ -119,7 +119,6 @@ CPPSRCS = \
|
||||
Monitor.cpp \
|
||||
ForkJoin.cpp \
|
||||
jswrapper.cpp \
|
||||
jsxml.cpp \
|
||||
prmjtime.cpp \
|
||||
sharkctl.cpp \
|
||||
ArgumentsObject.cpp \
|
||||
|
@ -711,12 +711,6 @@ obj_create(JSContext *cx, unsigned argc, Value *vp)
|
||||
}
|
||||
|
||||
JSObject *proto = v.toObjectOrNull();
|
||||
#if JS_HAS_XML_SUPPORT
|
||||
if (proto && proto->isXML()) {
|
||||
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_XML_PROTO_FORBIDDEN);
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Use the callee's global as the parent of the new object to avoid dynamic
|
||||
|
@ -176,14 +176,6 @@ GetBuildConfiguration(JSContext *cx, unsigned argc, jsval *vp)
|
||||
if (!JS_SetProperty(cx, info, "methodjit", &value))
|
||||
return false;
|
||||
|
||||
#ifdef JS_HAS_XML_SUPPORT
|
||||
value = BooleanValue(true);
|
||||
#else
|
||||
value = BooleanValue(false);
|
||||
#endif
|
||||
if (!JS_SetProperty(cx, info, "e4x", &value))
|
||||
return false;
|
||||
|
||||
*vp = ObjectValue(*info);
|
||||
return true;
|
||||
}
|
||||
@ -638,9 +630,6 @@ static const struct TraceKindPair {
|
||||
{ "all", -1 },
|
||||
{ "object", JSTRACE_OBJECT },
|
||||
{ "string", JSTRACE_STRING },
|
||||
#if JS_HAS_XML_SUPPORT
|
||||
{ "xml", JSTRACE_XML },
|
||||
#endif
|
||||
};
|
||||
|
||||
static JSBool
|
||||
@ -910,8 +899,8 @@ static JSFunctionSpecWithHelp TestingFunctions[] = {
|
||||
"countHeap([start[, kind]])",
|
||||
" Count the number of live GC things in the heap or things reachable from\n"
|
||||
" start when it is given and is not null. kind is either 'all' (default) to\n"
|
||||
" count all things or one of 'object', 'double', 'string', 'function',\n"
|
||||
" 'qname', 'namespace', 'xml' to count only things of that kind."),
|
||||
" count all things or one of 'object', 'double', 'string', 'function'\n"
|
||||
" to count only things of that kind."),
|
||||
|
||||
JS_FN_HELP("makeFinalizeObserver", MakeFinalizeObserver, 0, 0,
|
||||
"makeFinalizeObserver()",
|
||||
@ -937,8 +926,8 @@ static JSFunctionSpecWithHelp TestingFunctions[] = {
|
||||
" 3: Collect when the window paints (browser only)\n"
|
||||
" 4: Verify pre write barriers between instructions\n"
|
||||
" 5: Verify pre write barriers between paints\n"
|
||||
" 6: Verify stack rooting (ignoring XML and Reflect)\n"
|
||||
" 7: Verify stack rooting (all roots)\n"
|
||||
" 6: Verify stack rooting\n"
|
||||
" 7: Verify stack rooting (yes, it's the same as 6)\n"
|
||||
" 8: Incremental GC in two slices: 1) mark roots 2) finish collection\n"
|
||||
" 9: Incremental GC in two slices: 1) mark all 2) new marking and finish\n"
|
||||
" 10: Incremental GC in multiple slices\n"
|
||||
|
@ -3814,15 +3814,6 @@ MOZ_ARG_WITH_STRING(jitreport-granularity,
|
||||
|
||||
AC_DEFINE_UNQUOTED(JS_DEFAULT_JITREPORT_GRANULARITY, $JITREPORT_GRANULARITY)
|
||||
|
||||
dnl ========================================================
|
||||
dnl = E4X support (ECMA-357)
|
||||
dnl ========================================================
|
||||
JS_HAS_XML_SUPPORT=1
|
||||
MOZ_ARG_DISABLE_BOOL(e4x,
|
||||
[ --disable-e4x Disable JS support for XML (ECMA-357)],
|
||||
JS_HAS_XML_SUPPORT=0 )
|
||||
AC_DEFINE_UNQUOTED(JS_HAS_XML_SUPPORT, $JS_HAS_XML_SUPPORT)
|
||||
|
||||
dnl ========================================================
|
||||
dnl =
|
||||
dnl = Misc. Options
|
||||
|
@ -158,13 +158,6 @@ frontend::CompileScript(JSContext *cx, HandleObject scopeChain, AbstractFramePtr
|
||||
}
|
||||
}
|
||||
|
||||
ParseNode *pn;
|
||||
#if JS_HAS_XML_SUPPORT
|
||||
pn = NULL;
|
||||
bool onlyXML;
|
||||
onlyXML = true;
|
||||
#endif
|
||||
|
||||
TokenStream &tokenStream = parser.tokenStream;
|
||||
bool canHaveDirectives = true;
|
||||
for (;;) {
|
||||
@ -176,7 +169,7 @@ frontend::CompileScript(JSContext *cx, HandleObject scopeChain, AbstractFramePtr
|
||||
return UnrootedScript(NULL);
|
||||
}
|
||||
|
||||
pn = parser.statement();
|
||||
ParseNode *pn = parser.statement();
|
||||
if (!pn)
|
||||
return UnrootedScript(NULL);
|
||||
|
||||
@ -193,29 +186,12 @@ frontend::CompileScript(JSContext *cx, HandleObject scopeChain, AbstractFramePtr
|
||||
if (!EmitTree(cx, &bce, pn))
|
||||
return UnrootedScript(NULL);
|
||||
|
||||
#if JS_HAS_XML_SUPPORT
|
||||
if (!pn->isKind(PNK_SEMI) || !pn->pn_kid || !pn->pn_kid->isXMLItem())
|
||||
onlyXML = false;
|
||||
#endif
|
||||
parser.freeTree(pn);
|
||||
}
|
||||
|
||||
if (!SetSourceMap(cx, tokenStream, ss, script))
|
||||
return UnrootedScript(NULL);
|
||||
|
||||
#if JS_HAS_XML_SUPPORT
|
||||
/*
|
||||
* Prevent XML data theft via <script src="http://victim.com/foo.xml">.
|
||||
* For background, see:
|
||||
*
|
||||
* https://bugzilla.mozilla.org/show_bug.cgi?id=336551
|
||||
*/
|
||||
if (pn && onlyXML && !callerFrame) {
|
||||
parser.reportError(NULL, JSMSG_XML_WHOLE_PROGRAM);
|
||||
return UnrootedScript(NULL);
|
||||
}
|
||||
#endif
|
||||
|
||||
// It's an error to use |arguments| in a function that has a rest parameter.
|
||||
if (callerFrame && callerFrame.isFunctionFrame() && callerFrame.fun()->hasRest()) {
|
||||
HandlePropertyName arguments = cx->names().arguments;
|
||||
|
@ -1584,12 +1584,6 @@ CheckSideEffects(JSContext *cx, BytecodeEmitter *bce, ParseNode *pn, bool *answe
|
||||
}
|
||||
/* FALL THROUGH */
|
||||
case PNK_DOT:
|
||||
#if JS_HAS_XML_SUPPORT
|
||||
case PNK_DBLDOT:
|
||||
JS_ASSERT_IF(pn2->getKind() == PNK_DBLDOT, !bce->sc->strict);
|
||||
/* FALL THROUGH */
|
||||
|
||||
#endif
|
||||
case PNK_CALL:
|
||||
case PNK_ELEM:
|
||||
/* All these delete addressing modes have effects too. */
|
||||
@ -1809,31 +1803,6 @@ EmitNameOp(JSContext *cx, BytecodeEmitter *bce, ParseNode *pn, bool callContext)
|
||||
return true;
|
||||
}
|
||||
|
||||
#if JS_HAS_XML_SUPPORT
|
||||
static bool
|
||||
EmitXMLName(JSContext *cx, ParseNode *pn, JSOp op, BytecodeEmitter *bce)
|
||||
{
|
||||
JS_ASSERT(!bce->sc->strict);
|
||||
JS_ASSERT(pn->isKind(PNK_XMLUNARY));
|
||||
JS_ASSERT(pn->isOp(JSOP_XMLNAME));
|
||||
JS_ASSERT(op == JSOP_XMLNAME || op == JSOP_CALLXMLNAME);
|
||||
|
||||
ParseNode *pn2 = pn->pn_kid;
|
||||
bool oldEmittingForInit = bce->emittingForInit;
|
||||
bce->emittingForInit = false;
|
||||
if (!EmitTree(cx, bce, pn2))
|
||||
return false;
|
||||
bce->emittingForInit = oldEmittingForInit;
|
||||
if (NewSrcNote2(cx, bce, SRC_PCBASE, bce->offset() - pn2->pn_offset) < 0)
|
||||
return false;
|
||||
|
||||
if (Emit1(cx, bce, op) < 0)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
static inline bool
|
||||
EmitElemOpBase(JSContext *cx, BytecodeEmitter *bce, JSOp op)
|
||||
{
|
||||
@ -2058,7 +2027,7 @@ EmitElemOp(JSContext *cx, ParseNode *pn, JSOp op, BytecodeEmitter *bce)
|
||||
right = NullaryNode::create(PNK_STRING, bce->parser);
|
||||
if (!right)
|
||||
return false;
|
||||
right->setOp(IsIdentifier(pn->pn_atom) ? JSOP_QNAMEPART : JSOP_STRING);
|
||||
right->setOp(JSOP_STRING);
|
||||
right->pn_pos = pn->pn_pos;
|
||||
right->pn_atom = pn->pn_atom;
|
||||
} else {
|
||||
@ -2078,9 +2047,6 @@ EmitElemOp(JSContext *cx, ParseNode *pn, JSOp op, BytecodeEmitter *bce)
|
||||
if (op == JSOP_CALLELEM && Emit1(cx, bce, JSOP_DUP) < 0)
|
||||
return false;
|
||||
|
||||
/* The right side of the descendant operator is implicitly quoted. */
|
||||
JS_ASSERT(op != JSOP_DESCENDANTS || !right->isKind(PNK_STRING) ||
|
||||
right->isOp(JSOP_QNAMEPART));
|
||||
if (!EmitTree(cx, bce, right))
|
||||
return false;
|
||||
if (NewSrcNote2(cx, bce, SRC_PCBASE, bce->offset() - top) < 0)
|
||||
@ -3475,17 +3441,6 @@ EmitAssignment(JSContext *cx, BytecodeEmitter *bce, ParseNode *lhs, JSOp op, Par
|
||||
JS_ASSERT(lhs->pn_xflags & PNX_SETCALL);
|
||||
offset += 2;
|
||||
break;
|
||||
#if JS_HAS_XML_SUPPORT
|
||||
case PNK_XMLUNARY:
|
||||
JS_ASSERT(!bce->sc->strict);
|
||||
JS_ASSERT(lhs->isOp(JSOP_SETXMLNAME));
|
||||
if (!EmitTree(cx, bce, lhs->pn_kid))
|
||||
return false;
|
||||
if (Emit1(cx, bce, JSOP_BINDXMLNAME) < 0)
|
||||
return false;
|
||||
offset += 2;
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
JS_ASSERT(0);
|
||||
}
|
||||
@ -3535,9 +3490,6 @@ EmitAssignment(JSContext *cx, BytecodeEmitter *bce, ParseNode *lhs, JSOp op, Par
|
||||
}
|
||||
case PNK_ELEM:
|
||||
case PNK_CALL:
|
||||
#if JS_HAS_XML_SUPPORT
|
||||
case PNK_XMLUNARY:
|
||||
#endif
|
||||
if (Emit1(cx, bce, JSOP_DUP2) < 0)
|
||||
return false;
|
||||
if (!EmitElemOpBase(cx, bce, JSOP_GETELEM))
|
||||
@ -3621,13 +3573,6 @@ EmitAssignment(JSContext *cx, BytecodeEmitter *bce, ParseNode *lhs, JSOp op, Par
|
||||
if (!EmitDestructuringOps(cx, bce, SRC_DECL_NONE, lhs))
|
||||
return false;
|
||||
break;
|
||||
#endif
|
||||
#if JS_HAS_XML_SUPPORT
|
||||
case PNK_XMLUNARY:
|
||||
JS_ASSERT(!bce->sc->strict);
|
||||
if (Emit1(cx, bce, JSOP_SETXMLNAME) < 0)
|
||||
return false;
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
JS_ASSERT(0);
|
||||
@ -4316,88 +4261,6 @@ EmitLet(JSContext *cx, BytecodeEmitter *bce, ParseNode *pnLet)
|
||||
}
|
||||
#endif
|
||||
|
||||
#if JS_HAS_XML_SUPPORT
|
||||
/*
|
||||
* Using MOZ_NEVER_INLINE in here is a workaround for llvm.org/pr14047. See
|
||||
* the comment on EmitSwitch.
|
||||
*/
|
||||
MOZ_NEVER_INLINE static bool
|
||||
EmitXMLTag(JSContext *cx, BytecodeEmitter *bce, ParseNode *pn)
|
||||
{
|
||||
JS_ASSERT(!bce->sc->strict);
|
||||
|
||||
if (Emit1(cx, bce, JSOP_STARTXML) < 0)
|
||||
return false;
|
||||
|
||||
{
|
||||
jsatomid index;
|
||||
HandlePropertyName tagAtom = (pn->isKind(PNK_XMLETAGO))
|
||||
? cx->names().etago
|
||||
: cx->names().stago;
|
||||
if (!bce->makeAtomIndex(tagAtom, &index))
|
||||
return false;
|
||||
if (!EmitIndex32(cx, JSOP_STRING, index, bce))
|
||||
return false;
|
||||
}
|
||||
|
||||
JS_ASSERT(pn->pn_count != 0);
|
||||
ParseNode *pn2 = pn->pn_head;
|
||||
if (pn2->isKind(PNK_XMLCURLYEXPR) && Emit1(cx, bce, JSOP_STARTXMLEXPR) < 0)
|
||||
return false;
|
||||
if (!EmitTree(cx, bce, pn2))
|
||||
return false;
|
||||
if (Emit1(cx, bce, JSOP_ADD) < 0)
|
||||
return false;
|
||||
|
||||
uint32_t i;
|
||||
for (pn2 = pn2->pn_next, i = 0; pn2; pn2 = pn2->pn_next, i++) {
|
||||
if (pn2->isKind(PNK_XMLCURLYEXPR) && Emit1(cx, bce, JSOP_STARTXMLEXPR) < 0)
|
||||
return false;
|
||||
if (!EmitTree(cx, bce, pn2))
|
||||
return false;
|
||||
if ((i & 1) && pn2->isKind(PNK_XMLCURLYEXPR)) {
|
||||
if (Emit1(cx, bce, JSOP_TOATTRVAL) < 0)
|
||||
return false;
|
||||
}
|
||||
if (Emit1(cx, bce, (i & 1) ? JSOP_ADDATTRVAL : JSOP_ADDATTRNAME) < 0)
|
||||
return false;
|
||||
}
|
||||
|
||||
{
|
||||
jsatomid index;
|
||||
HandlePropertyName tmp = pn->isKind(PNK_XMLPTAGC)
|
||||
? cx->names().ptagc
|
||||
: cx->names().tagc;
|
||||
if (!bce->makeAtomIndex(tmp, &index))
|
||||
return false;
|
||||
if (!EmitIndex32(cx, JSOP_STRING, index, bce))
|
||||
return false;
|
||||
}
|
||||
if (Emit1(cx, bce, JSOP_ADD) < 0)
|
||||
return false;
|
||||
|
||||
if ((pn->pn_xflags & PNX_XMLROOT) && Emit1(cx, bce, pn->getOp()) < 0)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool
|
||||
EmitXMLProcessingInstruction(JSContext *cx, BytecodeEmitter *bce, XMLProcessingInstruction &pi)
|
||||
{
|
||||
JS_ASSERT(!bce->sc->strict);
|
||||
|
||||
jsatomid index;
|
||||
if (!bce->makeAtomIndex(pi.data(), &index))
|
||||
return false;
|
||||
if (!EmitIndex32(cx, JSOP_QNAMEPART, index, bce))
|
||||
return false;
|
||||
if (!EmitAtomOp(cx, pi.target(), JSOP_XMLPI, bce))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Using MOZ_NEVER_INLINE in here is a workaround for llvm.org/pr14047. See
|
||||
* the comment on EmitSwitch.
|
||||
@ -5254,13 +5117,6 @@ EmitDelete(JSContext *cx, BytecodeEmitter *bce, ParseNode *pn)
|
||||
if (!EmitPropOp(cx, pn2, JSOP_DELPROP, bce, false))
|
||||
return false;
|
||||
break;
|
||||
#if JS_HAS_XML_SUPPORT
|
||||
case PNK_DBLDOT:
|
||||
JS_ASSERT(!bce->sc->strict);
|
||||
if (!EmitElemOp(cx, pn2, JSOP_DELDESC, bce))
|
||||
return false;
|
||||
break;
|
||||
#endif
|
||||
case PNK_ELEM:
|
||||
if (!EmitElemOp(cx, pn2, JSOP_DELELEM, bce))
|
||||
return false;
|
||||
@ -5311,10 +5167,10 @@ EmitCallOrNew(JSContext *cx, BytecodeEmitter *bce, ParseNode *pn, ptrdiff_t top)
|
||||
* First, emit code for the left operand to evaluate the callable or
|
||||
* constructable object expression.
|
||||
*
|
||||
* For operator new applied to other expressions than E4X ones, we emit
|
||||
* JSOP_GETPROP instead of JSOP_CALLPROP, etc. This is necessary to
|
||||
* interpose the lambda-initialized method read barrier -- see the code
|
||||
* in jsinterp.cpp for JSOP_LAMBDA followed by JSOP_{SET,INIT}PROP.
|
||||
* For operator new, we emit JSOP_GETPROP instead of JSOP_CALLPROP, etc.
|
||||
* This is necessary to interpose the lambda-initialized method read
|
||||
* barrier -- see the code in jsinterp.cpp for JSOP_LAMBDA followed by
|
||||
* JSOP_{SET,INIT}PROP.
|
||||
*
|
||||
* Then (or in a call case that has no explicit reference-base
|
||||
* object) we emit JSOP_UNDEFINED to produce the undefined |this|
|
||||
@ -5376,14 +5232,6 @@ EmitCallOrNew(JSContext *cx, BytecodeEmitter *bce, ParseNode *pn, ptrdiff_t top)
|
||||
if (!EmitElemOp(cx, pn2, callop ? JSOP_CALLELEM : JSOP_GETELEM, bce))
|
||||
return false;
|
||||
break;
|
||||
#if JS_HAS_XML_SUPPORT
|
||||
case PNK_XMLUNARY:
|
||||
JS_ASSERT(pn2->isOp(JSOP_XMLNAME));
|
||||
if (!EmitXMLName(cx, pn2, JSOP_CALLXMLNAME, bce))
|
||||
return false;
|
||||
callop = true; /* suppress JSOP_UNDEFINED after */
|
||||
break;
|
||||
#endif
|
||||
case PNK_FUNCTION:
|
||||
/*
|
||||
* Top level lambdas which are immediately invoked should be
|
||||
@ -5562,18 +5410,6 @@ EmitIncOrDec(JSContext *cx, BytecodeEmitter *bce, ParseNode *pn)
|
||||
if (Emit1(cx, bce, JSOP_POP) < 0)
|
||||
return false;
|
||||
break;
|
||||
#if JS_HAS_XML_SUPPORT
|
||||
case PNK_XMLUNARY:
|
||||
JS_ASSERT(!bce->sc->strict);
|
||||
JS_ASSERT(pn2->isOp(JSOP_SETXMLNAME));
|
||||
if (!EmitTree(cx, bce, pn2->pn_kid))
|
||||
return false;
|
||||
if (Emit1(cx, bce, JSOP_BINDXMLNAME) < 0)
|
||||
return false;
|
||||
if (!EmitElemIncDec(cx, NULL, op, bce))
|
||||
return false;
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
JS_ASSERT(pn2->isKind(PNK_NAME));
|
||||
pn2->setOp(op);
|
||||
@ -5946,7 +5782,6 @@ EmitUnary(JSContext *cx, BytecodeEmitter *bce, ParseNode *pn)
|
||||
JSOp op = pn->getOp();
|
||||
ParseNode *pn2 = pn->pn_kid;
|
||||
|
||||
JS_ASSERT(op != JSOP_XMLNAME);
|
||||
if (op == JSOP_TYPEOF && !pn2->isKind(PNK_NAME))
|
||||
op = JSOP_TYPEOFEXPR;
|
||||
|
||||
@ -6181,16 +6016,6 @@ frontend::EmitTree(JSContext *cx, BytecodeEmitter *bce, ParseNode *pn)
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if JS_HAS_XML_SUPPORT
|
||||
case PNK_XMLCURLYEXPR:
|
||||
JS_ASSERT(pn->isArity(PN_UNARY));
|
||||
if (!EmitTree(cx, bce, pn->pn_kid))
|
||||
return false;
|
||||
if (Emit1(cx, bce, pn->getOp()) < 0)
|
||||
return false;
|
||||
break;
|
||||
#endif
|
||||
|
||||
case PNK_STATEMENTLIST:
|
||||
ok = EmitStatementList(cx, bce, pn, top);
|
||||
break;
|
||||
@ -6294,69 +6119,17 @@ frontend::EmitTree(JSContext *cx, BytecodeEmitter *bce, ParseNode *pn)
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
#if JS_HAS_XML_SUPPORT
|
||||
case PNK_DBLCOLON:
|
||||
JS_ASSERT(pn->getOp() != JSOP_XMLNAME);
|
||||
if (pn->isArity(PN_NAME)) {
|
||||
if (!EmitTree(cx, bce, pn->expr()))
|
||||
return false;
|
||||
if (!EmitAtomOp(cx, pn, pn->getOp(), bce))
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
|
||||
/*
|
||||
* Binary :: has a right operand that brackets arbitrary code,
|
||||
* possibly including a let (a = b) ... expression. We must clear
|
||||
* emittingForInit to avoid mis-compiling such beasts.
|
||||
*/
|
||||
bool oldEmittingForInit = bce->emittingForInit;
|
||||
bce->emittingForInit = false;
|
||||
#endif
|
||||
|
||||
/* Binary operators that evaluate both operands unconditionally. */
|
||||
if (!EmitTree(cx, bce, pn->pn_left))
|
||||
return false;
|
||||
if (!EmitTree(cx, bce, pn->pn_right))
|
||||
return false;
|
||||
#if JS_HAS_XML_SUPPORT
|
||||
bce->emittingForInit = oldEmittingForInit;
|
||||
#endif
|
||||
if (Emit1(cx, bce, pn->getOp()) < 0)
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
|
||||
#if JS_HAS_XML_SUPPORT
|
||||
case PNK_FUNCTIONNS:
|
||||
ok = (Emit1(cx, bce, JSOP_GETFUNNS) >= 0);
|
||||
break;
|
||||
|
||||
case PNK_XMLUNARY:
|
||||
if (pn->getOp() == JSOP_XMLNAME) {
|
||||
if (!EmitXMLName(cx, pn, JSOP_XMLNAME, bce))
|
||||
return false;
|
||||
} else {
|
||||
JSOp op = pn->getOp();
|
||||
JS_ASSERT(op == JSOP_BINDXMLNAME || op == JSOP_SETXMLNAME);
|
||||
bool oldEmittingForInit = bce->emittingForInit;
|
||||
bce->emittingForInit = false;
|
||||
if (!EmitTree(cx, bce, pn->pn_kid))
|
||||
return false;
|
||||
bce->emittingForInit = oldEmittingForInit;
|
||||
if (Emit1(cx, bce, op) < 0)
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
|
||||
case PNK_THROW:
|
||||
#if JS_HAS_XML_SUPPORT
|
||||
case PNK_AT:
|
||||
case PNK_DEFXMLNS:
|
||||
JS_ASSERT(pn->isArity(PN_UNARY));
|
||||
/* FALL THROUGH */
|
||||
#endif
|
||||
case PNK_TYPEOF:
|
||||
case PNK_VOID:
|
||||
case PNK_NOT:
|
||||
@ -6377,30 +6150,6 @@ frontend::EmitTree(JSContext *cx, BytecodeEmitter *bce, ParseNode *pn)
|
||||
ok = EmitDelete(cx, bce, pn);
|
||||
break;
|
||||
|
||||
#if JS_HAS_XML_SUPPORT
|
||||
case PNK_FILTER:
|
||||
{
|
||||
JS_ASSERT(!bce->sc->strict);
|
||||
|
||||
if (!EmitTree(cx, bce, pn->pn_left))
|
||||
return false;
|
||||
ptrdiff_t jmp = EmitJump(cx, bce, JSOP_FILTER, 0);
|
||||
if (jmp < 0)
|
||||
return false;
|
||||
top = EmitLoopHead(cx, bce, pn->pn_right);
|
||||
if (top < 0)
|
||||
return false;
|
||||
if (!EmitTree(cx, bce, pn->pn_right))
|
||||
return false;
|
||||
SetJumpOffsetAt(bce, jmp);
|
||||
if (!EmitLoopEntry(cx, bce, NULL))
|
||||
return false;
|
||||
if (EmitJump(cx, bce, JSOP_ENDFILTER, top - bce->offset()) < 0)
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
|
||||
case PNK_DOT:
|
||||
/*
|
||||
* Pop a stack operand, convert it to object, get a property named by
|
||||
@ -6410,12 +6159,6 @@ frontend::EmitTree(JSContext *cx, BytecodeEmitter *bce, ParseNode *pn)
|
||||
ok = EmitPropOp(cx, pn, pn->getOp(), bce, false);
|
||||
break;
|
||||
|
||||
#if JS_HAS_XML_SUPPORT
|
||||
case PNK_DBLDOT:
|
||||
JS_ASSERT(!bce->sc->strict);
|
||||
/* FALL THROUGH */
|
||||
#endif
|
||||
|
||||
case PNK_ELEM:
|
||||
/*
|
||||
* Pop two operands, convert the left one to object and the right one
|
||||
@ -6480,15 +6223,6 @@ frontend::EmitTree(JSContext *cx, BytecodeEmitter *bce, ParseNode *pn)
|
||||
return false;
|
||||
break;
|
||||
|
||||
#if JS_HAS_XML_SUPPORT
|
||||
case PNK_XMLATTR:
|
||||
case PNK_XMLSPACE:
|
||||
case PNK_XMLTEXT:
|
||||
case PNK_XMLCDATA:
|
||||
case PNK_XMLCOMMENT:
|
||||
JS_ASSERT(!bce->sc->strict);
|
||||
/* FALL THROUGH */
|
||||
#endif
|
||||
case PNK_STRING:
|
||||
ok = EmitAtomOp(cx, pn, pn->getOp(), bce);
|
||||
break;
|
||||
@ -6502,9 +6236,6 @@ frontend::EmitTree(JSContext *cx, BytecodeEmitter *bce, ParseNode *pn)
|
||||
ok = EmitRegExp(cx, bce->regexpList.add(pn->pn_objbox), bce);
|
||||
break;
|
||||
|
||||
#if JS_HAS_XML_SUPPORT
|
||||
case PNK_ANYNAME:
|
||||
#endif
|
||||
case PNK_TRUE:
|
||||
case PNK_FALSE:
|
||||
case PNK_THIS:
|
||||
@ -6518,85 +6249,6 @@ frontend::EmitTree(JSContext *cx, BytecodeEmitter *bce, ParseNode *pn)
|
||||
return false;
|
||||
break;
|
||||
|
||||
#if JS_HAS_XML_SUPPORT
|
||||
case PNK_XMLELEM:
|
||||
case PNK_XMLLIST:
|
||||
JS_ASSERT(!bce->sc->strict);
|
||||
JS_ASSERT(pn->isKind(PNK_XMLLIST) || pn->pn_count != 0);
|
||||
|
||||
switch (pn->pn_head ? pn->pn_head->getKind() : PNK_XMLLIST) {
|
||||
case PNK_XMLETAGO:
|
||||
JS_ASSERT(0);
|
||||
/* FALL THROUGH */
|
||||
case PNK_XMLPTAGC:
|
||||
case PNK_XMLSTAGO:
|
||||
break;
|
||||
default:
|
||||
if (Emit1(cx, bce, JSOP_STARTXML) < 0)
|
||||
return false;
|
||||
}
|
||||
|
||||
for (ParseNode *pn2 = pn->pn_head; pn2; pn2 = pn2->pn_next) {
|
||||
if (pn2->isKind(PNK_XMLCURLYEXPR) && Emit1(cx, bce, JSOP_STARTXMLEXPR) < 0)
|
||||
return false;
|
||||
if (!EmitTree(cx, bce, pn2))
|
||||
return false;
|
||||
if (pn2 != pn->pn_head && Emit1(cx, bce, JSOP_ADD) < 0)
|
||||
return false;
|
||||
}
|
||||
|
||||
if (pn->pn_xflags & PNX_XMLROOT) {
|
||||
if (pn->pn_count == 0) {
|
||||
JS_ASSERT(pn->isKind(PNK_XMLLIST));
|
||||
jsatomid index;
|
||||
if (!bce->makeAtomIndex(cx->names().empty, &index))
|
||||
return false;
|
||||
if (!EmitIndex32(cx, JSOP_STRING, index, bce))
|
||||
return false;
|
||||
}
|
||||
if (Emit1(cx, bce, pn->getOp()) < 0)
|
||||
return false;
|
||||
}
|
||||
#ifdef DEBUG
|
||||
else
|
||||
JS_ASSERT(pn->pn_count != 0);
|
||||
#endif
|
||||
break;
|
||||
|
||||
case PNK_XMLPTAGC:
|
||||
case PNK_XMLSTAGO:
|
||||
case PNK_XMLETAGO:
|
||||
if (!EmitXMLTag(cx, bce, pn))
|
||||
return false;
|
||||
break;
|
||||
|
||||
case PNK_XMLNAME:
|
||||
JS_ASSERT(!bce->sc->strict);
|
||||
|
||||
if (pn->isArity(PN_LIST)) {
|
||||
JS_ASSERT(pn->pn_count != 0);
|
||||
for (ParseNode *pn2 = pn->pn_head; pn2; pn2 = pn2->pn_next) {
|
||||
if (pn2->isKind(PNK_XMLCURLYEXPR) && Emit1(cx, bce, JSOP_STARTXMLEXPR) < 0)
|
||||
return false;
|
||||
if (!EmitTree(cx, bce, pn2))
|
||||
return false;
|
||||
if (pn2 != pn->pn_head && Emit1(cx, bce, JSOP_ADD) < 0)
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
JS_ASSERT(pn->isArity(PN_NULLARY));
|
||||
ok = pn->isOp(JSOP_OBJECT)
|
||||
? EmitObjectOp(cx, pn->pn_objbox, pn->getOp(), bce)
|
||||
: EmitAtomOp(cx, pn, pn->getOp(), bce);
|
||||
}
|
||||
break;
|
||||
|
||||
case PNK_XMLPI:
|
||||
if (!EmitXMLProcessingInstruction(cx, bce, pn->as<XMLProcessingInstruction>()))
|
||||
return false;
|
||||
break;
|
||||
#endif /* JS_HAS_XML_SUPPORT */
|
||||
|
||||
case PNK_NOP:
|
||||
JS_ASSERT(pn->getArity() == PN_NULLARY);
|
||||
break;
|
||||
|
@ -8,9 +8,6 @@
|
||||
#include "mozilla/FloatingPoint.h"
|
||||
|
||||
#include "jslibmath.h"
|
||||
#if JS_HAS_XML_SUPPORT
|
||||
#include "jsxml.h"
|
||||
#endif
|
||||
|
||||
#include "frontend/FoldConstants.h"
|
||||
#include "frontend/ParseNode.h"
|
||||
@ -202,171 +199,6 @@ ReplaceNode(ParseNode **pnp, ParseNode *pn)
|
||||
*pnp = pn;
|
||||
}
|
||||
|
||||
#if JS_HAS_XML_SUPPORT
|
||||
|
||||
static bool
|
||||
FoldXMLConstants(JSContext *cx, ParseNode **pnp, Parser *parser)
|
||||
{
|
||||
ParseNode *pn = *pnp;
|
||||
JS_ASSERT(pn->isArity(PN_LIST));
|
||||
ParseNodeKind kind = pn->getKind();
|
||||
ParseNode **listp = &pn->pn_head;
|
||||
ParseNode *pn1 = *listp;
|
||||
RootedString accum(cx);
|
||||
RootedString str(cx);
|
||||
if ((pn->pn_xflags & PNX_CANTFOLD) == 0) {
|
||||
if (kind == PNK_XMLETAGO)
|
||||
accum = cx->names().etago;
|
||||
else if (kind == PNK_XMLSTAGO || kind == PNK_XMLPTAGC)
|
||||
accum = cx->names().stago;
|
||||
}
|
||||
|
||||
/*
|
||||
* GC Rooting here is tricky: for most of the loop, |accum| is safe via
|
||||
* the newborn string root. However, when |pn2->getKind()| is PNK_XMLCDATA,
|
||||
* PNK_XMLCOMMENT, or PNK_XMLPI it is knocked out of the newborn root.
|
||||
* Therefore, we have to add additonal protection from GC nesting under
|
||||
* ConcatString.
|
||||
*/
|
||||
ParseNode *pn2;
|
||||
uint32_t i, j;
|
||||
for (pn2 = pn1, i = j = 0; pn2; pn2 = pn2->pn_next, i++) {
|
||||
/* The parser already rejected end-tags with attributes. */
|
||||
JS_ASSERT(kind != PNK_XMLETAGO || i == 0);
|
||||
switch (pn2->getKind()) {
|
||||
case PNK_XMLATTR:
|
||||
if (!accum)
|
||||
goto cantfold;
|
||||
/* FALL THROUGH */
|
||||
case PNK_XMLNAME:
|
||||
case PNK_XMLSPACE:
|
||||
case PNK_XMLTEXT:
|
||||
case PNK_STRING:
|
||||
if (pn2->isArity(PN_LIST))
|
||||
goto cantfold;
|
||||
str = pn2->pn_atom;
|
||||
break;
|
||||
|
||||
case PNK_XMLCDATA:
|
||||
str = js_MakeXMLCDATAString(cx, pn2->pn_atom);
|
||||
if (!str)
|
||||
return false;
|
||||
break;
|
||||
|
||||
case PNK_XMLCOMMENT:
|
||||
str = js_MakeXMLCommentString(cx, pn2->pn_atom);
|
||||
if (!str)
|
||||
return false;
|
||||
break;
|
||||
|
||||
case PNK_XMLPI: {
|
||||
XMLProcessingInstruction &pi = pn2->as<XMLProcessingInstruction>();
|
||||
str = js_MakeXMLPIString(cx, pi.target(), pi.data());
|
||||
if (!str)
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
|
||||
cantfold:
|
||||
default:
|
||||
JS_ASSERT(*listp == pn1);
|
||||
if ((kind == PNK_XMLSTAGO || kind == PNK_XMLPTAGC) &&
|
||||
(i & 1) ^ (j & 1)) {
|
||||
#ifdef DEBUG_brendanXXX
|
||||
printf("1: %d, %d => ", i, j);
|
||||
if (accum)
|
||||
FileEscapedString(stdout, accum, 0);
|
||||
else
|
||||
fputs("NULL", stdout);
|
||||
fputc('\n', stdout);
|
||||
#endif
|
||||
} else if (accum && pn1 != pn2) {
|
||||
while (pn1->pn_next != pn2) {
|
||||
pn1 = parser->freeTree(pn1);
|
||||
--pn->pn_count;
|
||||
}
|
||||
pn1->setKind(PNK_XMLTEXT);
|
||||
pn1->setOp(JSOP_STRING);
|
||||
pn1->setArity(PN_NULLARY);
|
||||
pn1->pn_atom = AtomizeString<CanGC>(cx, accum);
|
||||
if (!pn1->pn_atom)
|
||||
return false;
|
||||
JS_ASSERT(listp != &pn1->pn_next);
|
||||
*listp = pn1;
|
||||
}
|
||||
listp = &pn2->pn_next;
|
||||
pn1 = *listp;
|
||||
accum = NULL;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (accum) {
|
||||
{
|
||||
str = ((kind == PNK_XMLSTAGO || kind == PNK_XMLPTAGC) && i != 0)
|
||||
? js_AddAttributePart(cx, i & 1, accum, str)
|
||||
: ConcatStrings<CanGC>(cx, accum, str);
|
||||
}
|
||||
if (!str)
|
||||
return false;
|
||||
#ifdef DEBUG_brendanXXX
|
||||
printf("2: %d, %d => ", i, j);
|
||||
FileEscapedString(stdout, str, 0);
|
||||
printf(" (%u)\n", str->length());
|
||||
#endif
|
||||
++j;
|
||||
}
|
||||
accum = str;
|
||||
}
|
||||
|
||||
if (accum) {
|
||||
str = NULL;
|
||||
if ((pn->pn_xflags & PNX_CANTFOLD) == 0) {
|
||||
if (kind == PNK_XMLPTAGC)
|
||||
str = cx->names().ptagc;
|
||||
else if (kind == PNK_XMLSTAGO || kind == PNK_XMLETAGO)
|
||||
str = cx->names().tagc;
|
||||
}
|
||||
if (str) {
|
||||
accum = ConcatStrings<CanGC>(cx, accum, str);
|
||||
if (!accum)
|
||||
return false;
|
||||
}
|
||||
|
||||
JS_ASSERT(*listp == pn1);
|
||||
while (pn1->pn_next) {
|
||||
pn1 = parser->freeTree(pn1);
|
||||
--pn->pn_count;
|
||||
}
|
||||
pn1->setKind(PNK_XMLTEXT);
|
||||
pn1->setOp(JSOP_STRING);
|
||||
pn1->setArity(PN_NULLARY);
|
||||
pn1->pn_atom = AtomizeString<CanGC>(cx, accum);
|
||||
if (!pn1->pn_atom)
|
||||
return false;
|
||||
JS_ASSERT(listp != &pn1->pn_next);
|
||||
*listp = pn1;
|
||||
}
|
||||
|
||||
if (pn1 && pn->pn_count == 1) {
|
||||
/*
|
||||
* Only one node under pn, and it has been folded: move pn1 onto pn
|
||||
* unless pn is an XML root (in which case we need it to tell the code
|
||||
* generator to emit a JSOP_TOXML or JSOP_TOXMLLIST op). If pn is an
|
||||
* XML root *and* it's a point-tag, rewrite it to PNK_XMLELEM to avoid
|
||||
* extra "<" and "/>" bracketing at runtime.
|
||||
*/
|
||||
if (!(pn->pn_xflags & PNX_XMLROOT)) {
|
||||
ReplaceNode(pnp, pn1);
|
||||
} else if (kind == PNK_XMLPTAGC) {
|
||||
pn->setKind(PNK_XMLELEM);
|
||||
pn->setOp(JSOP_TOXML);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
#endif /* JS_HAS_XML_SUPPORT */
|
||||
|
||||
enum Truthiness { Truthy, Falsy, Unknown };
|
||||
|
||||
static Truthiness
|
||||
@ -864,41 +696,6 @@ frontend::FoldConstants(JSContext *cx, ParseNode **pnp, Parser *parser, bool inG
|
||||
}
|
||||
break;
|
||||
|
||||
#if JS_HAS_XML_SUPPORT
|
||||
case PNK_XMLELEM:
|
||||
case PNK_XMLLIST:
|
||||
case PNK_XMLPTAGC:
|
||||
case PNK_XMLSTAGO:
|
||||
case PNK_XMLETAGO:
|
||||
case PNK_XMLNAME:
|
||||
if (pn->isArity(PN_LIST)) {
|
||||
JS_ASSERT(pn->isKind(PNK_XMLLIST) || pn->pn_count != 0);
|
||||
if (!FoldXMLConstants(cx, pnp, parser))
|
||||
return false;
|
||||
pn = *pnp;
|
||||
}
|
||||
break;
|
||||
|
||||
case PNK_AT:
|
||||
if (pn1->isKind(PNK_XMLNAME)) {
|
||||
Value v = StringValue(pn1->pn_atom);
|
||||
if (!js_ToAttributeName(cx, &v))
|
||||
return false;
|
||||
JS_ASSERT(v.isObject());
|
||||
|
||||
ObjectBox *xmlbox = parser->newObjectBox(&v.toObject());
|
||||
if (!xmlbox)
|
||||
return false;
|
||||
|
||||
pn->setKind(PNK_XMLNAME);
|
||||
pn->setOp(JSOP_OBJECT);
|
||||
pn->setArity(PN_NULLARY);
|
||||
pn->pn_objbox = xmlbox;
|
||||
parser->freeTree(pn1);
|
||||
}
|
||||
break;
|
||||
#endif /* JS_HAS_XML_SUPPORT */
|
||||
|
||||
default:;
|
||||
}
|
||||
|
||||
|
@ -4,6 +4,7 @@
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "builtin/Module.h"
|
||||
#include "frontend/ParseNode.h"
|
||||
#include "frontend/Parser.h"
|
||||
@ -176,10 +177,6 @@ PushNodeChildren(ParseNode *pn, NodeStack *stack)
|
||||
stack->pushUnlessNull(pn->pn_kid);
|
||||
break;
|
||||
case PN_NULLARY:
|
||||
/*
|
||||
* E4X function namespace nodes are PN_NULLARY, but can appear on use
|
||||
* lists.
|
||||
*/
|
||||
return !pn->isUsed() && !pn->isDefn();
|
||||
default:
|
||||
;
|
||||
@ -454,7 +451,6 @@ CloneParseTree(ParseNode *opn, Parser *parser)
|
||||
break;
|
||||
|
||||
case PN_NULLARY:
|
||||
// Even PN_NULLARY may have data (xmlpi for E4X -- what a botch).
|
||||
pn->pn_u = opn->pn_u;
|
||||
break;
|
||||
|
||||
|
@ -85,7 +85,6 @@ class UpvarCookie
|
||||
F(ELEM) \
|
||||
F(ARRAY) \
|
||||
F(STATEMENTLIST) \
|
||||
F(XMLCURLYEXPR) \
|
||||
F(OBJECT) \
|
||||
F(CALL) \
|
||||
F(NAME) \
|
||||
@ -121,27 +120,6 @@ class UpvarCookie
|
||||
F(THROW) \
|
||||
F(INSTANCEOF) \
|
||||
F(DEBUGGER) \
|
||||
F(DEFXMLNS) \
|
||||
F(XMLSTAGO) \
|
||||
F(XMLETAGO) \
|
||||
F(XMLPTAGC) \
|
||||
F(XMLTAGC) \
|
||||
F(XMLNAME) \
|
||||
F(XMLATTR) \
|
||||
F(XMLSPACE) \
|
||||
F(XMLTEXT) \
|
||||
F(XMLCOMMENT) \
|
||||
F(XMLCDATA) \
|
||||
F(XMLPI) \
|
||||
F(XMLUNARY) \
|
||||
F(AT) \
|
||||
F(FUNCTIONNS) \
|
||||
F(DBLCOLON) \
|
||||
F(ANYNAME) \
|
||||
F(DBLDOT) \
|
||||
F(FILTER) \
|
||||
F(XMLELEM) \
|
||||
F(XMLLIST) \
|
||||
F(YIELD) \
|
||||
F(GENEXP) \
|
||||
F(ARRAYCOMP) \
|
||||
@ -366,8 +344,8 @@ enum ParseNodeKind {
|
||||
* pn_count: 1 + N (where N is number of args)
|
||||
* ctor is a MEMBER expr
|
||||
* PNK_DELETE unary pn_kid: MEMBER expr
|
||||
* PNK_DOT, name pn_expr: MEMBER expr to left of .
|
||||
* PNK_DBLDOT pn_atom: name to right of .
|
||||
* PNK_DOT name pn_expr: MEMBER expr to left of .
|
||||
* pn_atom: name to right of .
|
||||
* PNK_ELEM binary pn_left: MEMBER expr to left of [
|
||||
* pn_right: expr between [ and ]
|
||||
* PNK_CALL list pn_head: list of call, arg1, arg2, ... argN
|
||||
@ -400,83 +378,16 @@ enum ParseNodeKind {
|
||||
* PNK_NULL,
|
||||
* PNK_THIS
|
||||
*
|
||||
* <E4X node descriptions>
|
||||
* PNK_XMLUNARY unary pn_kid: PNK_AT, PNK_ANYNAME, or PNK_DBLCOLON node
|
||||
* pn_op: JSOP_XMLNAME, JSOP_BINDXMLNAME, or
|
||||
* JSOP_SETXMLNAME
|
||||
* PNK_DEFXMLNS name pn_kid: namespace expr
|
||||
* PNK_FILTER binary pn_left: container expr, pn_right: filter expr
|
||||
* PNK_DBLDOT binary pn_left: container expr, pn_right: selector expr
|
||||
* PNK_ANYNAME nullary pn_op: JSOP_ANYNAME
|
||||
* pn_atom: cx->runtime->atomState.starAtom
|
||||
* PNK_AT unary pn_op: JSOP_TOATTRNAME; pn_kid attribute id/expr
|
||||
* PNK_FUNCTIONNS nullary special E4X "function::" namespace
|
||||
* PNK_DBLCOLON binary pn_op: JSOP_QNAME
|
||||
* pn_left: PNK_ANYNAME or PNK_NAME node
|
||||
* pn_right: PNK_STRING "*" node, or expr within []
|
||||
* name pn_op: JSOP_QNAMECONST
|
||||
* pn_expr: PNK_ANYNAME or PNK_NAME left operand
|
||||
* pn_atom: name on right of ::
|
||||
* PNK_XMLELEM list XML element node
|
||||
* pn_head: start tag, content1, ... contentN, end tag
|
||||
* pn_count: 2 + N where N is number of content nodes
|
||||
* N may be > x.length() if {expr} embedded
|
||||
* After constant folding, these contents may be
|
||||
* concatenated into string nodes.
|
||||
* PNK_XMLLIST list XML list node
|
||||
* pn_head: content1, ... contentN
|
||||
* PNK_XMLSTAGO, list XML start, end, and point tag contents
|
||||
* PNK_XMLETAGO, pn_head: tag name or {expr}, ... XML attrs ...
|
||||
* PNK_XMLPTAGC
|
||||
* PNK_XMLNAME nullary pn_atom: XML name, with no {expr} embedded
|
||||
* PNK_XMLNAME list pn_head: tag name or {expr}, ... name or {expr}
|
||||
* PNK_XMLATTR, nullary pn_atom: attribute value string; pn_op: JSOP_STRING
|
||||
* PNK_XMLCDATA,
|
||||
* PNK_XMLCOMMENT
|
||||
* PNK_XMLPI nullary pn_pitarget: XML processing instruction target
|
||||
* pn_pidata: XML PI data, or null if no data
|
||||
* PNK_XMLTEXT nullary pn_atom: marked-up text, or null if empty string
|
||||
* PNK_XMLCURLYEXPR unary {expr} in XML tag or content; pn_kid is expr
|
||||
*
|
||||
* So an XML tag with no {expr} and three attributes is a list with the form:
|
||||
*
|
||||
* (tagname attrname1 attrvalue1 attrname2 attrvalue2 attrname2 attrvalue3)
|
||||
*
|
||||
* An XML tag with embedded expressions like so:
|
||||
*
|
||||
* <name1{expr1} name2{expr2}name3={expr3}>
|
||||
*
|
||||
* would have the form:
|
||||
*
|
||||
* ((name1 {expr1}) (name2 {expr2} name3) {expr3})
|
||||
*
|
||||
* where () bracket a list with elements separated by spaces, and {expr} is a
|
||||
* PNK_XMLCURLYEXPR unary node with expr as its kid.
|
||||
*
|
||||
* Thus, the attribute name/value pairs occupy successive odd and even list
|
||||
* locations, where pn_head is the PNK_XMLNAME node at list location 0. The
|
||||
* parser builds the same sort of structures for elements:
|
||||
*
|
||||
* <a x={x}>Hi there!<b y={y}>How are you?</b><answer>{x + y}</answer></a>
|
||||
*
|
||||
* translates to:
|
||||
*
|
||||
* ((a x {x}) 'Hi there!' ((b y {y}) 'How are you?') ((answer) {x + y}))
|
||||
*
|
||||
* <Non-E4X node descriptions, continued>
|
||||
*
|
||||
* Label Variant Members
|
||||
* ----- ------- -------
|
||||
* PNK_LEXICALSCOPE name pn_op: JSOP_LEAVEBLOCK or JSOP_LEAVEBLOCKEXPR
|
||||
* pn_objbox: block object in ObjectBox holder
|
||||
* pn_expr: block body
|
||||
* PNK_ARRAYCOMP list pn_count: 1
|
||||
* pn_head: list of 1 element, which is block
|
||||
* enclosing for loop(s) and optionally
|
||||
* if-guarded PNK_ARRAYPUSH
|
||||
* PNK_ARRAYPUSH unary pn_op: JSOP_ARRAYCOMP
|
||||
* pn_kid: array comprehension expression
|
||||
* PNK_NOP nullary
|
||||
* PNK_LEXICALSCOPE name pn_op: JSOP_LEAVEBLOCK or JSOP_LEAVEBLOCKEXPR
|
||||
* pn_objbox: block object in ObjectBox holder
|
||||
* pn_expr: block body
|
||||
* PNK_ARRAYCOMP list pn_count: 1
|
||||
* pn_head: list of 1 element, which is block
|
||||
* enclosing for loop(s) and optionally
|
||||
* if-guarded PNK_ARRAYPUSH
|
||||
* PNK_ARRAYPUSH unary pn_op: JSOP_ARRAYCOMP
|
||||
* pn_kid: array comprehension expression
|
||||
* PNK_NOP nullary
|
||||
*/
|
||||
enum ParseNodeArity {
|
||||
PN_NULLARY, /* 0 kids, only pn_atom/pn_dval/etc. */
|
||||
@ -493,7 +404,6 @@ struct Definition;
|
||||
class LoopControlStatement;
|
||||
class BreakStatement;
|
||||
class ContinueStatement;
|
||||
class XMLProcessingInstruction;
|
||||
class ConditionalExpression;
|
||||
class PropertyAccess;
|
||||
|
||||
@ -548,26 +458,11 @@ struct ParseNode {
|
||||
bool isArity(ParseNodeArity a) const { return getArity() == a; }
|
||||
void setArity(ParseNodeArity a) { pn_arity = a; }
|
||||
|
||||
bool isXMLNameOp() const {
|
||||
ParseNodeKind kind = getKind();
|
||||
return kind == PNK_ANYNAME || kind == PNK_AT || kind == PNK_DBLCOLON;
|
||||
}
|
||||
bool isAssignment() const {
|
||||
ParseNodeKind kind = getKind();
|
||||
return PNK_ASSIGNMENT_START <= kind && kind <= PNK_ASSIGNMENT_LAST;
|
||||
}
|
||||
|
||||
bool isXMLPropertyIdentifier() const {
|
||||
ParseNodeKind kind = getKind();
|
||||
return kind == PNK_ANYNAME || kind == PNK_AT || kind == PNK_DBLCOLON;
|
||||
}
|
||||
|
||||
bool isXMLItem() const {
|
||||
ParseNodeKind kind = getKind();
|
||||
return kind == PNK_XMLCOMMENT || kind == PNK_XMLCDATA || kind == PNK_XMLPI ||
|
||||
kind == PNK_XMLELEM || kind == PNK_XMLLIST;
|
||||
}
|
||||
|
||||
/* Boolean attributes. */
|
||||
bool isInParens() const { return pn_parens; }
|
||||
void setInParens(bool enabled) { pn_parens = enabled; }
|
||||
@ -631,11 +526,6 @@ struct ParseNode {
|
||||
friend class LoopControlStatement;
|
||||
PropertyName *label; /* target of break/continue statement */
|
||||
} loopControl;
|
||||
class { /* E4X <?target data?> XML PI */
|
||||
friend class XMLProcessingInstruction;
|
||||
PropertyName *target; /* non-empty */
|
||||
JSAtom *data; /* may be empty, never null */
|
||||
} xmlpi;
|
||||
} pn_u;
|
||||
|
||||
#define pn_funbox pn_u.name.funbox
|
||||
@ -747,19 +637,18 @@ struct ParseNode {
|
||||
#define PNX_FORINVAR 0x08 /* PNK_VAR is left kid of PNK_FORIN node
|
||||
which is left kid of PNK_FOR */
|
||||
#define PNX_ENDCOMMA 0x10 /* array literal has comma at end */
|
||||
#define PNX_XMLROOT 0x20 /* top-most node in XML literal tree */
|
||||
#define PNX_GROUPINIT 0x40 /* var [a, b] = [c, d]; unit list */
|
||||
#define PNX_NEEDBRACES 0x80 /* braces necessary due to closure */
|
||||
#define PNX_FUNCDEFS 0x100 /* contains top-level function statements */
|
||||
#define PNX_SETCALL 0x100 /* call expression in lvalue context */
|
||||
#define PNX_DESTRUCT 0x200 /* destructuring special cases:
|
||||
#define PNX_GROUPINIT 0x20 /* var [a, b] = [c, d]; unit list */
|
||||
#define PNX_NEEDBRACES 0x40 /* braces necessary due to closure */
|
||||
#define PNX_FUNCDEFS 0x80 /* contains top-level function statements */
|
||||
#define PNX_SETCALL 0x80 /* call expression in lvalue context */
|
||||
#define PNX_DESTRUCT 0x100 /* destructuring special cases:
|
||||
1. shorthand syntax used, at present
|
||||
object destructuring ({x,y}) only;
|
||||
2. code evaluating destructuring
|
||||
arguments occurs before function
|
||||
body */
|
||||
#define PNX_HOLEY 0x400 /* array initialiser has holes */
|
||||
#define PNX_NONCONST 0x800 /* initialiser has non-constants */
|
||||
#define PNX_HOLEY 0x200 /* array initialiser has holes */
|
||||
#define PNX_NONCONST 0x400 /* initialiser has non-constants */
|
||||
|
||||
unsigned frameLevel() const {
|
||||
JS_ASSERT(pn_arity == PN_FUNC || pn_arity == PN_NAME);
|
||||
@ -1138,33 +1027,6 @@ class DebuggerStatement : public ParseNode {
|
||||
{ }
|
||||
};
|
||||
|
||||
#if JS_HAS_XML_SUPPORT
|
||||
class XMLProcessingInstruction : public ParseNode {
|
||||
public:
|
||||
XMLProcessingInstruction(PropertyName *target, JSAtom *data, const TokenPos &pos)
|
||||
: ParseNode(PNK_XMLPI, JSOP_NOP, PN_NULLARY, pos)
|
||||
{
|
||||
pn_u.xmlpi.target = target;
|
||||
pn_u.xmlpi.data = data;
|
||||
}
|
||||
|
||||
static bool test(const ParseNode &node) {
|
||||
bool match = node.isKind(PNK_XMLPI);
|
||||
JS_ASSERT_IF(match, node.isArity(PN_NULLARY));
|
||||
JS_ASSERT_IF(match, node.isOp(JSOP_NOP));
|
||||
return match;
|
||||
}
|
||||
|
||||
PropertyName *target() const {
|
||||
return pn_u.xmlpi.target;
|
||||
}
|
||||
|
||||
JSAtom *data() const {
|
||||
return pn_u.xmlpi.data;
|
||||
}
|
||||
};
|
||||
#endif
|
||||
|
||||
class ConditionalExpression : public ParseNode {
|
||||
public:
|
||||
ConditionalExpression(ParseNode *condition, ParseNode *thenExpr, ParseNode *elseExpr)
|
||||
@ -1216,64 +1078,6 @@ class BooleanLiteral : public ParseNode {
|
||||
{ }
|
||||
};
|
||||
|
||||
class XMLDoubleColonProperty : public ParseNode {
|
||||
public:
|
||||
XMLDoubleColonProperty(ParseNode *lhs, ParseNode *rhs,
|
||||
const TokenPtr &begin, const TokenPtr &end)
|
||||
: ParseNode(PNK_ELEM, JSOP_GETELEM, PN_BINARY, TokenPos::make(begin, end))
|
||||
{
|
||||
JS_ASSERT(rhs->isKind(PNK_DBLCOLON));
|
||||
pn_u.binary.left = lhs;
|
||||
pn_u.binary.right = rhs;
|
||||
}
|
||||
|
||||
ParseNode &left() const {
|
||||
return *pn_u.binary.left;
|
||||
}
|
||||
|
||||
ParseNode &right() const {
|
||||
return *pn_u.binary.right;
|
||||
}
|
||||
};
|
||||
|
||||
class XMLFilterExpression : public ParseNode {
|
||||
public:
|
||||
XMLFilterExpression(ParseNode *lhs, ParseNode *filterExpr,
|
||||
const TokenPtr &begin, const TokenPtr &end)
|
||||
: ParseNode(PNK_FILTER, JSOP_FILTER, PN_BINARY, TokenPos::make(begin, end))
|
||||
{
|
||||
pn_u.binary.left = lhs;
|
||||
pn_u.binary.right = filterExpr;
|
||||
}
|
||||
|
||||
ParseNode &left() const {
|
||||
return *pn_u.binary.left;
|
||||
}
|
||||
|
||||
ParseNode &filter() const {
|
||||
return *pn_u.binary.right;
|
||||
}
|
||||
};
|
||||
|
||||
class XMLProperty : public ParseNode {
|
||||
public:
|
||||
XMLProperty(ParseNode *lhs, ParseNode *propertyId,
|
||||
const TokenPtr &begin, const TokenPtr &end)
|
||||
: ParseNode(PNK_ELEM, JSOP_GETELEM, PN_BINARY, TokenPos::make(begin, end))
|
||||
{
|
||||
pn_u.binary.left = lhs;
|
||||
pn_u.binary.right = propertyId;
|
||||
}
|
||||
|
||||
ParseNode &left() const {
|
||||
return *pn_u.binary.left;
|
||||
}
|
||||
|
||||
ParseNode &right() const {
|
||||
return *pn_u.binary.right;
|
||||
}
|
||||
};
|
||||
|
||||
class PropertyAccess : public ParseNode {
|
||||
public:
|
||||
PropertyAccess(ParseNode *lhs, PropertyName *name,
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -179,9 +179,9 @@ struct ParseContext /* tree context for semantic checks */
|
||||
bool parsingForInit:1; /* true while parsing init expr of for;
|
||||
exclude 'in' */
|
||||
bool parsingWith:1; /* true while we are within a
|
||||
with-statement or E4X filter-expression
|
||||
in the current ParseContext chain
|
||||
(which stops at the top-level or an eval() */
|
||||
with-statement in the current
|
||||
ParseContext chain (which stops at the
|
||||
top-level or an eval() */
|
||||
|
||||
// Set when parsing a declaration-like destructuring pattern. This flag
|
||||
// causes PrimaryExpr to create PN_NAME parse nodes for variable references
|
||||
@ -286,10 +286,6 @@ struct Parser : private AutoGCRooter
|
||||
*/
|
||||
ParseNode *parse(JSObject *chain);
|
||||
|
||||
#if JS_HAS_XML_SUPPORT
|
||||
ParseNode *parseXMLText(JSObject *chain, bool allowList);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Allocate a new parsed object or function container from
|
||||
* cx->tempLifoAlloc.
|
||||
@ -417,7 +413,7 @@ struct Parser : private AutoGCRooter
|
||||
ParseNode *mulExpr1n();
|
||||
ParseNode *unaryExpr();
|
||||
ParseNode *memberExpr(bool allowCallSyntax);
|
||||
ParseNode *primaryExpr(TokenKind tt, bool afterDoubleDot);
|
||||
ParseNode *primaryExpr(TokenKind tt);
|
||||
ParseNode *parenExpr(bool *genexp = NULL);
|
||||
|
||||
/*
|
||||
@ -444,35 +440,11 @@ struct Parser : private AutoGCRooter
|
||||
ParseNode *returnOrYield(bool useAssignExpr);
|
||||
ParseNode *destructuringExpr(BindData *data, TokenKind tt);
|
||||
|
||||
bool checkForFunctionNode(PropertyName *name, ParseNode *node);
|
||||
|
||||
ParseNode *identifierName(bool afterDoubleDot);
|
||||
|
||||
#if JS_HAS_XML_SUPPORT
|
||||
bool allowsXML() const { return tokenStream.allowsXML(); }
|
||||
|
||||
ParseNode *endBracketedExpr();
|
||||
|
||||
ParseNode *propertySelector();
|
||||
ParseNode *qualifiedSuffix(ParseNode *pn);
|
||||
ParseNode *qualifiedIdentifier();
|
||||
ParseNode *attributeIdentifier();
|
||||
ParseNode *xmlExpr(bool inTag);
|
||||
ParseNode *xmlNameExpr();
|
||||
ParseNode *xmlTagContent(ParseNodeKind tagkind, JSAtom **namep);
|
||||
bool xmlElementContent(ParseNode *pn);
|
||||
ParseNode *xmlElementOrList(bool allowList);
|
||||
ParseNode *xmlElementOrListRoot(bool allowList);
|
||||
|
||||
ParseNode *starOrAtPropertyIdentifier(TokenKind tt);
|
||||
ParseNode *propertyQualifiedIdentifier();
|
||||
#endif /* JS_HAS_XML_SUPPORT */
|
||||
ParseNode *identifierName();
|
||||
|
||||
bool allowsForEachIn() {
|
||||
#if !JS_HAS_FOR_EACH_IN
|
||||
return false;
|
||||
#elif JS_HAS_XML_SUPPORT
|
||||
return allowsXML() || tokenStream.hasMoarXML();
|
||||
#else
|
||||
return versionNumber() >= JSVERSION_1_6;
|
||||
#endif
|
||||
|
@ -196,8 +196,7 @@ class FunctionBox : public ObjectBox, public SharedContext
|
||||
size_t bufStart;
|
||||
size_t bufEnd;
|
||||
uint16_t ndefaults;
|
||||
bool inWith:1; /* some enclosing scope is a with-statement
|
||||
or E4X filter-expression */
|
||||
bool inWith:1; /* some enclosing scope is a with-statement */
|
||||
bool inGenexpLambda:1; /* lambda from generator expression */
|
||||
|
||||
FunctionContextFlags funCxFlags;
|
||||
|
@ -39,10 +39,6 @@
|
||||
|
||||
#include "jsscriptinlines.h"
|
||||
|
||||
#if JS_HAS_XML_SUPPORT
|
||||
#include "jsxml.h"
|
||||
#endif
|
||||
|
||||
using namespace js;
|
||||
using namespace js::frontend;
|
||||
using namespace js::unicode;
|
||||
@ -132,8 +128,6 @@ TokenStream::TokenStream(JSContext *cx, const CompileOptions &options,
|
||||
listenerTSData(),
|
||||
tokenbuf(cx),
|
||||
version(options.version),
|
||||
banXML(VersionHasAllowXML(options.version) ? 0 : 1),
|
||||
moarXML(VersionHasMoarXML(options.version)),
|
||||
cx(cx),
|
||||
originPrincipals(JSScript::normalizeOriginPrincipals(options.principals,
|
||||
options.originPrincipals)),
|
||||
@ -620,475 +614,6 @@ TokenStream::reportStrictWarningErrorNumberVA(ParseNode *pn, unsigned errorNumbe
|
||||
return reportCompileErrorNumberVA(NULL, JSREPORT_STRICT | JSREPORT_WARNING, errorNumber, args);
|
||||
}
|
||||
|
||||
#if JS_HAS_XML_SUPPORT
|
||||
|
||||
bool
|
||||
TokenStream::getXMLEntity()
|
||||
{
|
||||
ptrdiff_t offset, length, i;
|
||||
int c, d;
|
||||
bool ispair;
|
||||
jschar *bp, digit;
|
||||
char *bytes;
|
||||
JSErrNum msg;
|
||||
|
||||
CharBuffer &tb = tokenbuf;
|
||||
|
||||
/* Put the entity, including the '&' already scanned, in tokenbuf. */
|
||||
offset = tb.length();
|
||||
if (!tb.append('&'))
|
||||
return false;
|
||||
while ((c = getChar()) != ';') {
|
||||
if (c == EOF || c == '\n') {
|
||||
reportError(JSMSG_END_OF_XML_ENTITY);
|
||||
return false;
|
||||
}
|
||||
if (!tb.append(c))
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Let length be the number of jschars after the '&', including the ';'. */
|
||||
length = tb.length() - offset;
|
||||
bp = tb.begin() + offset;
|
||||
c = d = 0;
|
||||
ispair = false;
|
||||
if (length > 2 && bp[1] == '#') {
|
||||
/* Match a well-formed XML Character Reference. */
|
||||
i = 2;
|
||||
if (length > 3 && (bp[i] == 'x' || bp[i] == 'X')) {
|
||||
if (length > 9) /* at most 6 hex digits allowed */
|
||||
goto badncr;
|
||||
while (++i < length) {
|
||||
digit = bp[i];
|
||||
if (!JS7_ISHEX(digit))
|
||||
goto badncr;
|
||||
c = (c << 4) + JS7_UNHEX(digit);
|
||||
}
|
||||
} else {
|
||||
while (i < length) {
|
||||
digit = bp[i++];
|
||||
if (!JS7_ISDEC(digit))
|
||||
goto badncr;
|
||||
c = (c * 10) + JS7_UNDEC(digit);
|
||||
if (c < 0)
|
||||
goto badncr;
|
||||
}
|
||||
}
|
||||
|
||||
if (0x10000 <= c && c <= 0x10FFFF) {
|
||||
/* Form a surrogate pair (c, d) -- c is the high surrogate. */
|
||||
d = 0xDC00 + (c & 0x3FF);
|
||||
c = 0xD7C0 + (c >> 10);
|
||||
ispair = true;
|
||||
} else {
|
||||
/* Enforce the http://www.w3.org/TR/REC-xml/#wf-Legalchar WFC. */
|
||||
if (c != 0x9 && c != 0xA && c != 0xD &&
|
||||
!(0x20 <= c && c <= 0xD7FF) &&
|
||||
!(0xE000 <= c && c <= 0xFFFD)) {
|
||||
goto badncr;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
/* Try to match one of the five XML 1.0 predefined entities. */
|
||||
switch (length) {
|
||||
case 3:
|
||||
if (bp[2] == 't') {
|
||||
if (bp[1] == 'l')
|
||||
c = '<';
|
||||
else if (bp[1] == 'g')
|
||||
c = '>';
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
if (bp[1] == 'a' && bp[2] == 'm' && bp[3] == 'p')
|
||||
c = '&';
|
||||
break;
|
||||
case 5:
|
||||
if (bp[3] == 'o') {
|
||||
if (bp[1] == 'a' && bp[2] == 'p' && bp[4] == 's')
|
||||
c = '\'';
|
||||
else if (bp[1] == 'q' && bp[2] == 'u' && bp[4] == 't')
|
||||
c = '"';
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (c == 0) {
|
||||
msg = JSMSG_UNKNOWN_XML_ENTITY;
|
||||
goto bad;
|
||||
}
|
||||
}
|
||||
|
||||
/* If we matched, retract tokenbuf and store the entity's value. */
|
||||
*bp++ = (jschar) c;
|
||||
if (ispair)
|
||||
*bp++ = (jschar) d;
|
||||
tb.shrinkBy(tb.end() - bp);
|
||||
return true;
|
||||
|
||||
badncr:
|
||||
msg = JSMSG_BAD_XML_NCR;
|
||||
bad:
|
||||
/* No match: throw a TypeError per ECMA-357 10.3.2.1 step 8(a). */
|
||||
JS_ASSERT((tb.end() - bp) >= 1);
|
||||
TwoByteChars tbchars(bp + 1, (tb.end() - bp) - 1);
|
||||
bytes = LossyTwoByteCharsToNewLatin1CharsZ(cx, tbchars).c_str();
|
||||
if (bytes) {
|
||||
reportError(msg, bytes);
|
||||
js_free(bytes);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool
|
||||
TokenStream::getXMLTextOrTag(TokenKind *ttp, Token **tpp)
|
||||
{
|
||||
TokenKind tt;
|
||||
int c, qc;
|
||||
Token *tp;
|
||||
JSAtom *atom;
|
||||
|
||||
/*
|
||||
* Look for XML text.
|
||||
*/
|
||||
if (flags & TSF_XMLTEXTMODE) {
|
||||
tt = TOK_XMLSPACE; /* veto if non-space, return TOK_XMLTEXT */
|
||||
tp = newToken(0);
|
||||
tokenbuf.clear();
|
||||
qc = (flags & TSF_XMLONLYMODE) ? '<' : '{';
|
||||
|
||||
while ((c = getChar()) != qc && c != '<' && c != EOF) {
|
||||
if (c == '&' && qc == '<') {
|
||||
if (!getXMLEntity())
|
||||
goto error;
|
||||
tt = TOK_XMLTEXT;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!IsXMLSpace(c))
|
||||
tt = TOK_XMLTEXT;
|
||||
if (!tokenbuf.append(c))
|
||||
goto error;
|
||||
}
|
||||
ungetChar(c);
|
||||
|
||||
if (tokenbuf.empty()) {
|
||||
atom = NULL;
|
||||
} else {
|
||||
atom = atomize(cx, tokenbuf);
|
||||
if (!atom)
|
||||
goto error;
|
||||
}
|
||||
tp->pos.end.lineno = lineno;
|
||||
tp->setAtom(JSOP_STRING, atom);
|
||||
goto out;
|
||||
}
|
||||
|
||||
/*
|
||||
* XML tags.
|
||||
*/
|
||||
else {
|
||||
JS_ASSERT(flags & TSF_XMLTAGMODE);
|
||||
tp = newToken(0);
|
||||
c = getChar();
|
||||
if (c != EOF && IsXMLSpace(c)) {
|
||||
do {
|
||||
c = getChar();
|
||||
if (c == EOF)
|
||||
break;
|
||||
} while (IsXMLSpace(c));
|
||||
ungetChar(c);
|
||||
tp->pos.end.lineno = lineno;
|
||||
tt = TOK_XMLSPACE;
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (c == EOF) {
|
||||
tt = TOK_EOF;
|
||||
goto out;
|
||||
}
|
||||
|
||||
tokenbuf.clear();
|
||||
if (IsXMLNamespaceStart(c)) {
|
||||
bool sawColon = false;
|
||||
|
||||
if (!tokenbuf.append(c))
|
||||
goto error;
|
||||
while ((c = getChar()) != EOF && IsXMLNamePart(c)) {
|
||||
if (c == ':') {
|
||||
int nextc;
|
||||
|
||||
if (sawColon ||
|
||||
(nextc = peekChar(),
|
||||
((flags & TSF_XMLONLYMODE) || nextc != '{') &&
|
||||
!IsXMLNamePart(nextc))) {
|
||||
reportError(JSMSG_BAD_XML_QNAME);
|
||||
goto error;
|
||||
}
|
||||
sawColon = true;
|
||||
}
|
||||
|
||||
if (!tokenbuf.append(c))
|
||||
goto error;
|
||||
}
|
||||
|
||||
ungetChar(c);
|
||||
atom = atomize(cx, tokenbuf);
|
||||
if (!atom)
|
||||
goto error;
|
||||
tp->setAtom(JSOP_STRING, atom);
|
||||
tt = TOK_XMLNAME;
|
||||
goto out;
|
||||
}
|
||||
|
||||
switch (c) {
|
||||
case '{':
|
||||
if (flags & TSF_XMLONLYMODE)
|
||||
goto bad_xml_char;
|
||||
tt = TOK_LC;
|
||||
goto out;
|
||||
|
||||
case '=':
|
||||
tt = TOK_ASSIGN;
|
||||
goto out;
|
||||
|
||||
case '"':
|
||||
case '\'':
|
||||
qc = c;
|
||||
while ((c = getChar()) != qc) {
|
||||
if (c == EOF) {
|
||||
reportError(JSMSG_UNTERMINATED_STRING);
|
||||
goto error;
|
||||
}
|
||||
|
||||
/*
|
||||
* XML attribute values are double-quoted when pretty-printed,
|
||||
* so escape " if it is expressed directly in a single-quoted
|
||||
* attribute value.
|
||||
*/
|
||||
if (c == '"' && !(flags & TSF_XMLONLYMODE)) {
|
||||
JS_ASSERT(qc == '\'');
|
||||
if (!tokenbuf.append(js_quot_entity_str,
|
||||
strlen(js_quot_entity_str)))
|
||||
goto error;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (c == '&' && (flags & TSF_XMLONLYMODE)) {
|
||||
if (!getXMLEntity())
|
||||
goto error;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!tokenbuf.append(c))
|
||||
goto error;
|
||||
}
|
||||
atom = atomize(cx, tokenbuf);
|
||||
if (!atom)
|
||||
goto error;
|
||||
tp->pos.end.lineno = lineno;
|
||||
tp->setAtom(JSOP_STRING, atom);
|
||||
tt = TOK_XMLATTR;
|
||||
goto out;
|
||||
|
||||
case '>':
|
||||
tt = TOK_XMLTAGC;
|
||||
goto out;
|
||||
|
||||
case '/':
|
||||
if (matchChar('>')) {
|
||||
tt = TOK_XMLPTAGC;
|
||||
goto out;
|
||||
}
|
||||
/* FALL THROUGH */
|
||||
|
||||
bad_xml_char:
|
||||
default:
|
||||
reportError(JSMSG_BAD_XML_CHARACTER);
|
||||
goto error;
|
||||
}
|
||||
JS_NOT_REACHED("getXMLTextOrTag 1");
|
||||
}
|
||||
JS_NOT_REACHED("getXMLTextOrTag 2");
|
||||
|
||||
out:
|
||||
*ttp = tt;
|
||||
*tpp = tp;
|
||||
return true;
|
||||
|
||||
error:
|
||||
*ttp = TOK_ERROR;
|
||||
*tpp = tp;
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
* After much testing, it's clear that Postel's advice to protocol designers
|
||||
* ("be liberal in what you accept, and conservative in what you send") invites
|
||||
* a natural-law repercussion for JS as "protocol":
|
||||
*
|
||||
* "If you are liberal in what you accept, others will utterly fail to be
|
||||
* conservative in what they send."
|
||||
*
|
||||
* Which means you will get <!-- comments to end of line in the middle of .js
|
||||
* files, and after if conditions whose then statements are on the next line,
|
||||
* and other wonders. See at least the following bugs:
|
||||
* - https://bugzilla.mozilla.org/show_bug.cgi?id=309242
|
||||
* - https://bugzilla.mozilla.org/show_bug.cgi?id=309712
|
||||
* - https://bugzilla.mozilla.org/show_bug.cgi?id=310993
|
||||
*
|
||||
* So without JSOPTION_MOAR_XML, we changed around Firefox 1.5 never to scan an
|
||||
* XML comment or CDATA literal. Instead, we always scan <! as the start of an
|
||||
* HTML comment hack to end of line, used since Netscape 2 to hide script tag
|
||||
* content from script-unaware browsers.
|
||||
*
|
||||
* But this still leaves XML resources with certain internal structure
|
||||
* vulnerable to being loaded as script cross-origin, and some internal data
|
||||
* stolen, so for Firefox 3.5 and beyond, we reject programs whose source
|
||||
* consists only of XML literals. See:
|
||||
*
|
||||
* https://bugzilla.mozilla.org/show_bug.cgi?id=336551
|
||||
*
|
||||
* The check for this is in js::frontend::CompileScript.
|
||||
*/
|
||||
bool
|
||||
TokenStream::getXMLMarkup(TokenKind *ttp, Token **tpp)
|
||||
{
|
||||
TokenKind tt;
|
||||
int c;
|
||||
Token *tp = *tpp;
|
||||
|
||||
/* Check for XML comment or CDATA section. */
|
||||
if (matchChar('!')) {
|
||||
tokenbuf.clear();
|
||||
|
||||
/* Scan XML comment. */
|
||||
if (matchChar('-')) {
|
||||
if (!matchChar('-'))
|
||||
goto bad_xml_markup;
|
||||
while ((c = getChar()) != '-' || !matchChar('-')) {
|
||||
if (c == EOF)
|
||||
goto bad_xml_markup;
|
||||
if (!tokenbuf.append(c))
|
||||
goto error;
|
||||
}
|
||||
if (!matchChar('>'))
|
||||
goto bad_xml_markup;
|
||||
|
||||
JSAtom *commentText = atomize(cx, tokenbuf);
|
||||
if (!commentText)
|
||||
goto error;
|
||||
tp->setAtom(JSOP_XMLCOMMENT, commentText);
|
||||
tp->pos.end.lineno = lineno;
|
||||
tt = TOK_XMLCOMMENT;
|
||||
goto out;
|
||||
}
|
||||
|
||||
/* Scan CDATA section. */
|
||||
if (matchChar('[')) {
|
||||
jschar cp[6];
|
||||
if (peekChars(6, cp) &&
|
||||
cp[0] == 'C' &&
|
||||
cp[1] == 'D' &&
|
||||
cp[2] == 'A' &&
|
||||
cp[3] == 'T' &&
|
||||
cp[4] == 'A' &&
|
||||
cp[5] == '[') {
|
||||
skipChars(6);
|
||||
while ((c = getChar()) != ']' ||
|
||||
!peekChars(2, cp) ||
|
||||
cp[0] != ']' ||
|
||||
cp[1] != '>') {
|
||||
if (c == EOF)
|
||||
goto bad_xml_markup;
|
||||
if (!tokenbuf.append(c))
|
||||
goto error;
|
||||
}
|
||||
consumeKnownChar(']');
|
||||
consumeKnownChar('>');
|
||||
|
||||
JSAtom *cdataContent = atomize(cx, tokenbuf);
|
||||
if (!cdataContent)
|
||||
goto error;
|
||||
|
||||
tp->setAtom(JSOP_XMLCDATA, cdataContent);
|
||||
tp->pos.end.lineno = lineno;
|
||||
tt = TOK_XMLCDATA;
|
||||
goto out;
|
||||
}
|
||||
goto bad_xml_markup;
|
||||
}
|
||||
}
|
||||
|
||||
/* Check for processing instruction. */
|
||||
if (matchChar('?')) {
|
||||
bool inTarget = true;
|
||||
size_t targetLength = 0;
|
||||
ptrdiff_t contentIndex = -1;
|
||||
|
||||
tokenbuf.clear();
|
||||
while ((c = getChar()) != '?' || peekChar() != '>') {
|
||||
if (c == EOF)
|
||||
goto bad_xml_markup;
|
||||
if (inTarget) {
|
||||
if (IsXMLSpace(c)) {
|
||||
if (tokenbuf.empty())
|
||||
goto bad_xml_markup;
|
||||
inTarget = false;
|
||||
} else {
|
||||
if (!(tokenbuf.empty()
|
||||
? IsXMLNamespaceStart(c)
|
||||
: IsXMLNamespacePart(c))) {
|
||||
goto bad_xml_markup;
|
||||
}
|
||||
++targetLength;
|
||||
}
|
||||
} else {
|
||||
if (contentIndex < 0 && !IsXMLSpace(c))
|
||||
contentIndex = tokenbuf.length();
|
||||
}
|
||||
if (!tokenbuf.append(c))
|
||||
goto error;
|
||||
}
|
||||
if (targetLength == 0)
|
||||
goto bad_xml_markup;
|
||||
|
||||
JSAtom *data;
|
||||
if (contentIndex < 0) {
|
||||
data = cx->names().empty;
|
||||
} else {
|
||||
data = AtomizeChars<CanGC>(cx, tokenbuf.begin() + contentIndex,
|
||||
tokenbuf.length() - contentIndex);
|
||||
if (!data)
|
||||
goto error;
|
||||
}
|
||||
tokenbuf.shrinkBy(tokenbuf.length() - targetLength);
|
||||
consumeKnownChar('>');
|
||||
JSAtom *target = atomize(cx, tokenbuf);
|
||||
if (!target)
|
||||
goto error;
|
||||
tp->setProcessingInstruction(target->asPropertyName(), data);
|
||||
tp->pos.end.lineno = lineno;
|
||||
tt = TOK_XMLPI;
|
||||
goto out;
|
||||
}
|
||||
|
||||
/* An XML start-of-tag character. */
|
||||
tt = matchChar('/') ? TOK_XMLETAGO : TOK_XMLSTAGO;
|
||||
|
||||
out:
|
||||
*ttp = tt;
|
||||
*tpp = tp;
|
||||
return true;
|
||||
|
||||
bad_xml_markup:
|
||||
reportError(JSMSG_BAD_XML_MARKUP);
|
||||
error:
|
||||
*ttp = TOK_ERROR;
|
||||
*tpp = tp;
|
||||
return false;
|
||||
}
|
||||
#endif /* JS_HAS_XML_SUPPORT */
|
||||
|
||||
/*
|
||||
* We have encountered a '\': check for a Unicode escape sequence after it.
|
||||
* Return 'true' and the character code value (by value) if we found a
|
||||
@ -1302,19 +827,9 @@ IsTokenSane(Token *tp)
|
||||
if (tp->pos.begin.index > tp->pos.end.index)
|
||||
return false;
|
||||
} else {
|
||||
/* Only certain token kinds can be multi-line. */
|
||||
switch (tp->type) {
|
||||
case TOK_STRING:
|
||||
case TOK_XMLATTR:
|
||||
case TOK_XMLSPACE:
|
||||
case TOK_XMLTEXT:
|
||||
case TOK_XMLCOMMENT:
|
||||
case TOK_XMLCDATA:
|
||||
case TOK_XMLPI:
|
||||
break;
|
||||
default:
|
||||
/* Only string tokens can be multi-line. */
|
||||
if (tp->type != TOK_STRING)
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@ -1444,17 +959,6 @@ TokenStream::getTokenInternal()
|
||||
const jschar *identStart;
|
||||
bool hadUnicodeEscape;
|
||||
|
||||
#if JS_HAS_XML_SUPPORT
|
||||
/*
|
||||
* Look for XML text and tags.
|
||||
*/
|
||||
if (flags & (TSF_XMLTEXTMODE|TSF_XMLTAGMODE)) {
|
||||
if (!getXMLTextOrTag(&tt, &tp))
|
||||
goto error;
|
||||
goto out;
|
||||
}
|
||||
#endif
|
||||
|
||||
retry:
|
||||
if (JS_UNLIKELY(!userbuf.hasRawChars())) {
|
||||
tp = newToken(0);
|
||||
@ -1606,10 +1110,6 @@ TokenStream::getTokenInternal()
|
||||
goto out;
|
||||
}
|
||||
ungetCharIgnoreEOL(qc);
|
||||
#if JS_HAS_XML_SUPPORT
|
||||
tt = TOK_DBLDOT;
|
||||
goto out;
|
||||
#endif
|
||||
}
|
||||
ungetCharIgnoreEOL(c);
|
||||
tt = TOK_DOT;
|
||||
@ -1796,12 +1296,6 @@ TokenStream::getTokenInternal()
|
||||
}
|
||||
|
||||
if (c1kind == Colon) {
|
||||
#if JS_HAS_XML_SUPPORT
|
||||
if (matchChar(':')) {
|
||||
tt = TOK_DBLCOLON;
|
||||
goto out;
|
||||
}
|
||||
#endif
|
||||
tp->t_op = JSOP_NOP;
|
||||
tt = TOK_COLON;
|
||||
goto out;
|
||||
@ -1939,21 +1433,7 @@ TokenStream::getTokenInternal()
|
||||
}
|
||||
break;
|
||||
|
||||
#if JS_HAS_XML_SUPPORT
|
||||
case '@':
|
||||
tt = TOK_AT;
|
||||
break;
|
||||
#endif
|
||||
|
||||
case '<':
|
||||
#if JS_HAS_XML_SUPPORT
|
||||
if ((flags & TSF_OPERAND) && allowsXML() && (hasMoarXML() || peekChar() != '!')) {
|
||||
if (!getXMLMarkup(&tt, &tp))
|
||||
goto error;
|
||||
goto out;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* NB: treat HTML begin-comment as comment-till-end-of-line */
|
||||
if (matchChar('!')) {
|
||||
if (matchChar('-')) {
|
||||
@ -2280,23 +1760,6 @@ TokenKindToString(TokenKind tt)
|
||||
case TOK_THROW: return "TOK_THROW";
|
||||
case TOK_INSTANCEOF: return "TOK_INSTANCEOF";
|
||||
case TOK_DEBUGGER: return "TOK_DEBUGGER";
|
||||
case TOK_XMLSTAGO: return "TOK_XMLSTAGO";
|
||||
case TOK_XMLETAGO: return "TOK_XMLETAGO";
|
||||
case TOK_XMLPTAGC: return "TOK_XMLPTAGC";
|
||||
case TOK_XMLTAGC: return "TOK_XMLTAGC";
|
||||
case TOK_XMLNAME: return "TOK_XMLNAME";
|
||||
case TOK_XMLATTR: return "TOK_XMLATTR";
|
||||
case TOK_XMLSPACE: return "TOK_XMLSPACE";
|
||||
case TOK_XMLTEXT: return "TOK_XMLTEXT";
|
||||
case TOK_XMLCOMMENT: return "TOK_XMLCOMMENT";
|
||||
case TOK_XMLCDATA: return "TOK_XMLCDATA";
|
||||
case TOK_XMLPI: return "TOK_XMLPI";
|
||||
case TOK_AT: return "TOK_AT";
|
||||
case TOK_DBLCOLON: return "TOK_DBLCOLON";
|
||||
case TOK_DBLDOT: return "TOK_DBLDOT";
|
||||
case TOK_FILTER: return "TOK_FILTER";
|
||||
case TOK_XMLELEM: return "TOK_XMLELEM";
|
||||
case TOK_XMLLIST: return "TOK_XMLLIST";
|
||||
case TOK_YIELD: return "TOK_YIELD";
|
||||
case TOK_LEXICALSCOPE: return "TOK_LEXICALSCOPE";
|
||||
case TOK_LET: return "TOK_LET";
|
||||
|
@ -82,23 +82,6 @@ enum TokenKind {
|
||||
TOK_THROW, /* throw keyword */
|
||||
TOK_INSTANCEOF, /* instanceof keyword */
|
||||
TOK_DEBUGGER, /* debugger keyword */
|
||||
TOK_XMLSTAGO, /* XML start tag open (<) */
|
||||
TOK_XMLETAGO, /* XML end tag open (</) */
|
||||
TOK_XMLPTAGC, /* XML point tag close (/>) */
|
||||
TOK_XMLTAGC, /* XML start or end tag close (>) */
|
||||
TOK_XMLNAME, /* XML start-tag non-final fragment */
|
||||
TOK_XMLATTR, /* XML quoted attribute value */
|
||||
TOK_XMLSPACE, /* XML whitespace */
|
||||
TOK_XMLTEXT, /* XML text */
|
||||
TOK_XMLCOMMENT, /* XML comment */
|
||||
TOK_XMLCDATA, /* XML CDATA section */
|
||||
TOK_XMLPI, /* XML processing instruction */
|
||||
TOK_AT, /* XML attribute op (@) */
|
||||
TOK_DBLCOLON, /* namespace qualified name op (::) */
|
||||
TOK_DBLDOT, /* XML descendant op (..) */
|
||||
TOK_FILTER, /* XML filtering predicate op (.()) */
|
||||
TOK_XMLELEM, /* XML element node type (no token) */
|
||||
TOK_XMLLIST, /* XML list node type (no token) */
|
||||
TOK_YIELD, /* yield from generator function */
|
||||
TOK_LEXICALSCOPE, /* block scope AST node label */
|
||||
TOK_LET, /* let keyword */
|
||||
@ -292,10 +275,6 @@ struct Token {
|
||||
|
||||
private:
|
||||
friend struct Token;
|
||||
struct { /* pair for <?target data?> XML PI */
|
||||
PropertyName *target; /* non-empty */
|
||||
JSAtom *data; /* maybe empty, never null */
|
||||
} xmlpi;
|
||||
struct {
|
||||
double value; /* floating point number */
|
||||
DecimalPoint decimalPoint; /* literal contains . or exponent */
|
||||
@ -319,22 +298,12 @@ struct Token {
|
||||
}
|
||||
|
||||
void setAtom(JSOp op, JSAtom *atom) {
|
||||
JS_ASSERT(op == JSOP_STRING || op == JSOP_XMLCOMMENT || JSOP_XMLCDATA);
|
||||
JS_ASSERT(op == JSOP_STRING);
|
||||
JS_ASSERT(!IsPoisonedPtr(atom));
|
||||
u.s.op = op;
|
||||
u.s.n.atom = atom;
|
||||
}
|
||||
|
||||
void setProcessingInstruction(PropertyName *target, JSAtom *data) {
|
||||
JS_ASSERT(target);
|
||||
JS_ASSERT(data);
|
||||
JS_ASSERT(!target->empty());
|
||||
JS_ASSERT(!IsPoisonedPtr(target));
|
||||
JS_ASSERT(!IsPoisonedPtr(data));
|
||||
u.xmlpi.target = target;
|
||||
u.xmlpi.data = data;
|
||||
}
|
||||
|
||||
void setRegExpFlags(js::RegExpFlag flags) {
|
||||
JS_ASSERT((flags & AllFlags) == flags);
|
||||
u.reflags = flags;
|
||||
@ -353,25 +322,10 @@ struct Token {
|
||||
}
|
||||
|
||||
JSAtom *atom() const {
|
||||
JS_ASSERT(type == TOK_STRING ||
|
||||
type == TOK_XMLNAME ||
|
||||
type == TOK_XMLATTR ||
|
||||
type == TOK_XMLTEXT ||
|
||||
type == TOK_XMLCDATA ||
|
||||
type == TOK_XMLSPACE ||
|
||||
type == TOK_XMLCOMMENT);
|
||||
JS_ASSERT(type == TOK_STRING);
|
||||
return u.s.n.atom;
|
||||
}
|
||||
|
||||
PropertyName *xmlPITarget() const {
|
||||
JS_ASSERT(type == TOK_XMLPI);
|
||||
return u.xmlpi.target;
|
||||
}
|
||||
JSAtom *xmlPIData() const {
|
||||
JS_ASSERT(type == TOK_XMLPI);
|
||||
return u.xmlpi.data;
|
||||
}
|
||||
|
||||
js::RegExpFlag regExpFlags() const {
|
||||
JS_ASSERT(type == TOK_REGEXP);
|
||||
JS_ASSERT((u.reflags & AllFlags) == u.reflags);
|
||||
@ -400,11 +354,8 @@ enum TokenStreamFlags
|
||||
TSF_KEYWORD_IS_NAME = 0x20, /* Ignore keywords and return TOK_NAME instead to the parser. */
|
||||
TSF_DIRTYLINE = 0x40, /* non-whitespace since start of line */
|
||||
TSF_OWNFILENAME = 0x80, /* ts->filename is malloc'd */
|
||||
TSF_XMLTAGMODE = 0x100, /* scanning within an XML tag in E4X */
|
||||
TSF_XMLTEXTMODE = 0x200, /* scanning XMLText terminal from E4X */
|
||||
TSF_XMLONLYMODE = 0x400, /* don't scan {expr} within text/tag */
|
||||
TSF_OCTAL_CHAR = 0x800, /* observed a octal character escape */
|
||||
TSF_HAD_ERROR = 0x1000, /* returned TOK_ERROR from getToken */
|
||||
TSF_OCTAL_CHAR = 0x100, /* observed a octal character escape */
|
||||
TSF_HAD_ERROR = 0x200, /* returned TOK_ERROR from getToken */
|
||||
|
||||
/*
|
||||
* To handle the hard case of contiguous HTML comments, we want to clear the
|
||||
@ -504,14 +455,8 @@ class TokenStream
|
||||
const CharBuffer &getTokenbuf() const { return tokenbuf; }
|
||||
const char *getFilename() const { return filename; }
|
||||
unsigned getLineno() const { return lineno; }
|
||||
/* Note that the version and hasMoarXML can get out of sync via setMoarXML. */
|
||||
JSVersion versionNumber() const { return VersionNumber(version); }
|
||||
JSVersion versionWithFlags() const { return version; }
|
||||
bool allowsXML() const { return banXML == 0 && !strictMode(); }
|
||||
bool hasMoarXML() const { return moarXML || VersionShouldParseXML(versionNumber()); }
|
||||
void setMoarXML(bool enabled) { moarXML = enabled; }
|
||||
void incBanXML() { banXML++; }
|
||||
void decBanXML() { JS_ASSERT(banXML); banXML--; }
|
||||
bool hadError() const { return !!(flags & TSF_HAD_ERROR); }
|
||||
|
||||
bool isCurrentTokenEquality() const {
|
||||
@ -531,12 +476,8 @@ class TokenStream
|
||||
}
|
||||
|
||||
/* Flag methods. */
|
||||
void setXMLTagMode(bool enabled = true) { setFlag(enabled, TSF_XMLTAGMODE); }
|
||||
void setXMLOnlyMode(bool enabled = true) { setFlag(enabled, TSF_XMLONLYMODE); }
|
||||
void setUnexpectedEOF(bool enabled = true) { setFlag(enabled, TSF_UNEXPECTED_EOF); }
|
||||
|
||||
bool isXMLTagMode() const { return !!(flags & TSF_XMLTAGMODE); }
|
||||
bool isXMLOnlyMode() const { return !!(flags & TSF_XMLONLYMODE); }
|
||||
bool isUnexpectedEOF() const { return !!(flags & TSF_UNEXPECTED_EOF); }
|
||||
bool isEOF() const { return !!(flags & TSF_EOF); }
|
||||
bool sawOctalEscape() const { return !!(flags & TSF_OCTAL_CHAR); }
|
||||
@ -595,7 +536,6 @@ class TokenStream
|
||||
TokenKind getToken() {
|
||||
/* Check for a pushed-back token resulting from mismatching lookahead. */
|
||||
if (lookahead != 0) {
|
||||
JS_ASSERT(!(flags & TSF_XMLTEXTMODE));
|
||||
lookahead--;
|
||||
cursor = (cursor + 1) & ntokensMask;
|
||||
TokenKind tt = currentToken().type;
|
||||
@ -831,10 +771,6 @@ class TokenStream
|
||||
bool getAtLine();
|
||||
bool getAtSourceMappingURL();
|
||||
|
||||
bool getXMLEntity();
|
||||
bool getXMLTextOrTag(TokenKind *ttp, Token **tpp);
|
||||
bool getXMLMarkup(TokenKind *ttp, Token **tpp);
|
||||
|
||||
bool matchChar(int32_t expect) {
|
||||
int32_t c = getChar();
|
||||
if (c == expect)
|
||||
@ -878,8 +814,6 @@ class TokenStream
|
||||
bool maybeEOL[256]; /* probabilistic EOL lookup table */
|
||||
bool maybeStrSpecial[256];/* speeds up string scanning */
|
||||
JSVersion version; /* (i.e. to identify keywords) */
|
||||
unsigned banXML; /* see JSOPTION_ALLOW_XML */
|
||||
bool moarXML; /* see JSOPTION_MOAR_XML */
|
||||
JSContext *const cx;
|
||||
JSPrincipals *const originPrincipals;
|
||||
StrictModeGetter *strictModeGetter; /* used to test for strict mode */
|
||||
|
@ -115,8 +115,6 @@
|
||||
* assigned for the first time.
|
||||
*/
|
||||
|
||||
struct JSXML;
|
||||
|
||||
namespace js {
|
||||
|
||||
template<class T, typename Unioned = uintptr_t>
|
||||
@ -337,7 +335,6 @@ typedef HeapPtr<JSScript> HeapPtrScript;
|
||||
typedef HeapPtr<Shape> HeapPtrShape;
|
||||
typedef HeapPtr<BaseShape> HeapPtrBaseShape;
|
||||
typedef HeapPtr<types::TypeObject> HeapPtrTypeObject;
|
||||
typedef HeapPtr<JSXML> HeapPtrXML;
|
||||
|
||||
/* Useful for hashtables with a HeapPtr as key. */
|
||||
template<class T>
|
||||
|
@ -53,9 +53,6 @@ enum AllocKind {
|
||||
FINALIZE_SHAPE,
|
||||
FINALIZE_BASE_SHAPE,
|
||||
FINALIZE_TYPE_OBJECT,
|
||||
#if JS_HAS_XML_SUPPORT
|
||||
FINALIZE_XML,
|
||||
#endif
|
||||
FINALIZE_SHORT_STRING,
|
||||
FINALIZE_STRING,
|
||||
FINALIZE_EXTERNAL_STRING,
|
||||
|
@ -9,7 +9,6 @@
|
||||
|
||||
#include "jsprf.h"
|
||||
#include "jsstr.h"
|
||||
#include "jsxml.h"
|
||||
|
||||
#include "gc/Marking.h"
|
||||
#include "methodjit/MethodJIT.h"
|
||||
@ -58,11 +57,6 @@ void * const js::NullPtr::constNullValue = NULL;
|
||||
* scanning functions, but they don't push onto an explicit stack.
|
||||
*/
|
||||
|
||||
#if JS_HAS_XML_SUPPORT
|
||||
static inline void
|
||||
PushMarkStack(GCMarker *gcmarker, JSXML *thing);
|
||||
#endif
|
||||
|
||||
static inline void
|
||||
PushMarkStack(GCMarker *gcmarker, JSObject *thing);
|
||||
|
||||
@ -90,9 +84,6 @@ static void MarkChildren(JSTracer *trc, UnrootedShape shape);
|
||||
static void MarkChildren(JSTracer *trc, UnrootedBaseShape base);
|
||||
static void MarkChildren(JSTracer *trc, types::TypeObject *type);
|
||||
static void MarkChildren(JSTracer *trc, ion::IonCode *code);
|
||||
#if JS_HAS_XML_SUPPORT
|
||||
static void MarkChildren(JSTracer *trc, JSXML *xml);
|
||||
#endif
|
||||
|
||||
} /* namespace gc */
|
||||
} /* namespace js */
|
||||
@ -348,9 +339,6 @@ DeclMarkerImpl(String, JSFlatString)
|
||||
DeclMarkerImpl(String, JSLinearString)
|
||||
DeclMarkerImpl(String, PropertyName)
|
||||
DeclMarkerImpl(TypeObject, js::types::TypeObject)
|
||||
#if JS_HAS_XML_SUPPORT
|
||||
DeclMarkerImpl(XML, JSXML)
|
||||
#endif
|
||||
|
||||
} /* namespace gc */
|
||||
} /* namespace js */
|
||||
@ -385,11 +373,6 @@ gc::MarkKind(JSTracer *trc, void **thingp, JSGCTraceKind kind)
|
||||
case JSTRACE_IONCODE:
|
||||
MarkInternal(trc, reinterpret_cast<ion::IonCode **>(thingp));
|
||||
break;
|
||||
#if JS_HAS_XML_SUPPORT
|
||||
case JSTRACE_XML:
|
||||
MarkInternal(trc, reinterpret_cast<JSXML **>(thingp));
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@ -735,17 +718,6 @@ gc::IsCellAboutToBeFinalized(Cell **thingp)
|
||||
JS_ASSERT((thing)->zone()->isGCMarking() || \
|
||||
(thing)->compartment() == (rt)->atomsCompartment);
|
||||
|
||||
#if JS_HAS_XML_SUPPORT
|
||||
static void
|
||||
PushMarkStack(GCMarker *gcmarker, JSXML *thing)
|
||||
{
|
||||
JS_COMPARTMENT_ASSERT(gcmarker->runtime, thing);
|
||||
|
||||
if (thing->markIfUnmarked(gcmarker->getMarkColor()))
|
||||
gcmarker->pushXML(thing);
|
||||
}
|
||||
#endif
|
||||
|
||||
static void
|
||||
PushMarkStack(GCMarker *gcmarker, JSObject *thing)
|
||||
{
|
||||
@ -1118,14 +1090,6 @@ gc::MarkChildren(JSTracer *trc, ion::IonCode *code)
|
||||
#endif
|
||||
}
|
||||
|
||||
#if JS_HAS_XML_SUPPORT
|
||||
static void
|
||||
gc::MarkChildren(JSTracer *trc, JSXML *xml)
|
||||
{
|
||||
js_TraceXML(trc, xml);
|
||||
}
|
||||
#endif
|
||||
|
||||
template<typename T>
|
||||
static void
|
||||
PushArenaTyped(GCMarker *gcmarker, ArenaHeader *aheader)
|
||||
@ -1165,12 +1129,6 @@ gc::PushArena(GCMarker *gcmarker, ArenaHeader *aheader)
|
||||
case JSTRACE_IONCODE:
|
||||
PushArenaTyped<js::ion::IonCode>(gcmarker, aheader);
|
||||
break;
|
||||
|
||||
#if JS_HAS_XML_SUPPORT
|
||||
case JSTRACE_XML:
|
||||
PushArenaTyped<JSXML>(gcmarker, aheader);
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@ -1326,13 +1284,6 @@ GCMarker::processMarkStackOther(SliceBudget &budget, uintptr_t tag, uintptr_t ad
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#if JS_HAS_XML_SUPPORT
|
||||
else {
|
||||
JS_ASSERT(tag == XmlTag);
|
||||
MarkChildren(this, reinterpret_cast<JSXML *>(addr));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
inline void
|
||||
@ -1526,12 +1477,6 @@ js::TraceChildren(JSTracer *trc, void *thing, JSGCTraceKind kind)
|
||||
case JSTRACE_TYPE_OBJECT:
|
||||
MarkChildren(trc, (types::TypeObject *)thing);
|
||||
break;
|
||||
|
||||
#if JS_HAS_XML_SUPPORT
|
||||
case JSTRACE_XML:
|
||||
MarkChildren(trc, static_cast<JSXML *>(thing));
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -106,9 +106,6 @@ DeclMarker(String, JSFlatString)
|
||||
DeclMarker(String, JSLinearString)
|
||||
DeclMarker(String, PropertyName)
|
||||
DeclMarker(TypeObject, types::TypeObject)
|
||||
#if JS_HAS_XML_SUPPORT
|
||||
DeclMarker(XML, JSXML)
|
||||
#endif
|
||||
|
||||
#undef DeclMarker
|
||||
|
||||
@ -269,14 +266,6 @@ Mark(JSTracer *trc, EncapsulatedPtrScript *o, const char *name)
|
||||
MarkScript(trc, o, name);
|
||||
}
|
||||
|
||||
#if JS_HAS_XML_SUPPORT
|
||||
inline void
|
||||
Mark(JSTracer *trc, HeapPtr<JSXML> *xml, const char *name)
|
||||
{
|
||||
MarkXML(trc, xml, name);
|
||||
}
|
||||
#endif
|
||||
|
||||
inline void
|
||||
Mark(JSTracer *trc, HeapPtr<ion::IonCode> *code, const char *name)
|
||||
{
|
||||
|
@ -423,19 +423,6 @@ AutoGCRooter::trace(JSTracer *trc)
|
||||
return;
|
||||
}
|
||||
|
||||
#if JS_HAS_XML_SUPPORT
|
||||
case NAMESPACES: {
|
||||
JSXMLArray<JSObject> &array = static_cast<AutoNamespaceArray *>(this)->array;
|
||||
MarkObjectRange(trc, array.length, array.vector, "JSXMLArray.vector");
|
||||
js_XMLArrayCursorTrace(trc, array.cursors);
|
||||
return;
|
||||
}
|
||||
|
||||
case XML:
|
||||
js_TraceXML(trc, static_cast<AutoXMLRooter *>(this)->xml);
|
||||
return;
|
||||
#endif
|
||||
|
||||
case OBJECT:
|
||||
if (static_cast<AutoObjectRooter *>(this)->obj)
|
||||
MarkObjectRoot(trc, &static_cast<AutoObjectRooter *>(this)->obj,
|
||||
|
@ -12,9 +12,6 @@
|
||||
#ifndef JSGC_USE_EXACT_ROOTING
|
||||
# error "Generational GC requires exact rooting."
|
||||
#endif
|
||||
#ifdef JSGC_HAS_XML_SUPPORT
|
||||
# error "E4X must be disabled to enable generational GC."
|
||||
#endif
|
||||
|
||||
#include "jsgc.h"
|
||||
#include "jsalloc.h"
|
||||
|
@ -201,9 +201,7 @@ JS::CheckStackRoots(JSContext *cx)
|
||||
{
|
||||
JSRuntime *rt = cx->runtime;
|
||||
|
||||
if (rt->gcZeal_ != ZealStackRootingSafeValue && rt->gcZeal_ != ZealStackRootingValue)
|
||||
return;
|
||||
if (rt->gcZeal_ == ZealStackRootingSafeValue && !rt->gcExactScanningEnabled)
|
||||
if (rt->gcZeal_ != ZealStackRootingValue)
|
||||
return;
|
||||
|
||||
// If this assertion fails, it means that an AutoAssertNoGC was placed
|
||||
@ -648,8 +646,7 @@ void
|
||||
gc::StartVerifyPostBarriers(JSRuntime *rt)
|
||||
{
|
||||
#ifdef JSGC_GENERATIONAL
|
||||
if (!rt->gcExactScanningEnabled ||
|
||||
rt->gcVerifyPostData ||
|
||||
if (rt->gcVerifyPostData ||
|
||||
rt->gcIncrementalState != NO_INCREMENTAL)
|
||||
{
|
||||
return;
|
||||
@ -734,9 +731,6 @@ js::gc::EndVerifyPostBarriers(JSRuntime *rt)
|
||||
JS_TracerInit(trc, rt, PostVerifierVisitEdge);
|
||||
trc->count = 0;
|
||||
|
||||
if (!rt->gcExactScanningEnabled)
|
||||
goto oom;
|
||||
|
||||
for (CompartmentsIter c(rt); !c.done(); c.next()) {
|
||||
if (c->gcStoreBuffer.hasOverflowed())
|
||||
continue;
|
||||
|
@ -18,7 +18,6 @@ class jsid(object):
|
||||
TYPE_INT = 0x1
|
||||
TYPE_VOID = 0x2
|
||||
TYPE_OBJECT = 0x4
|
||||
TYPE_DEFAULT_XML_NAMESPACE = 0x6
|
||||
TYPE_MASK = 0x7
|
||||
|
||||
def __init__(self, value, cache):
|
||||
@ -49,8 +48,6 @@ class jsid(object):
|
||||
elif tag == jsid.TYPE_OBJECT:
|
||||
body = ((bits & ~jsid.TYPE_MASK)
|
||||
.cast(self.cache.JSObject_ptr_t))
|
||||
elif tag == jsid.TYPE_DEFAULT_XML_NAMESPACE:
|
||||
return "JS_DEFAULT_XML_NAMESPACE_ID"
|
||||
else:
|
||||
body = "<unrecognized>"
|
||||
return '$jsid(%s)' % (body,)
|
||||
|
@ -7,7 +7,6 @@ FRAGMENT(jsid, simple) {
|
||||
jsid int_id = INT_TO_JSID(1729);
|
||||
jsid void_id = JSID_VOID;
|
||||
js::Rooted<jsid> object_id(cx, OBJECT_TO_JSID(JS_GetGlobalObject(cx)));
|
||||
jsid xml_id = JS_DEFAULT_XML_NAMESPACE_ID;
|
||||
|
||||
breakpoint();
|
||||
|
||||
@ -17,5 +16,4 @@ FRAGMENT(jsid, simple) {
|
||||
(void) int_id;
|
||||
(void) void_id;
|
||||
(void) object_id;
|
||||
(void) xml_id;
|
||||
}
|
||||
|
@ -8,4 +8,3 @@ assert_pretty('string_id', '$jsid("moon")')
|
||||
assert_pretty('int_id', '$jsid(1729)')
|
||||
assert_pretty('void_id', 'JSID_VOID')
|
||||
assert_pretty('object_id', '$jsid((JSObject *) [object global] delegate)')
|
||||
assert_pretty('xml_id', 'JS_DEFAULT_XML_NAMESPACE_ID')
|
||||
|
@ -999,7 +999,7 @@ js::ion::GetPropertyCache(JSContext *cx, size_t cacheIndex, HandleObject obj, Mu
|
||||
|
||||
RootedId id(cx, NameToId(name));
|
||||
if (obj->getOps()->getProperty) {
|
||||
if (!GetPropertyGenericMaybeCallXML(cx, JSOp(*pc), obj, id, vp))
|
||||
if (!JSObject::getGeneric(cx, obj, obj, id, vp))
|
||||
return false;
|
||||
} else {
|
||||
if (!GetPropertyHelper(cx, obj, id, 0, vp))
|
||||
|
@ -62,7 +62,4 @@
|
||||
correct. */
|
||||
#undef JS_METHODJIT
|
||||
|
||||
/* Define to 1 to enable support for E4X (ECMA-357), 0 to disable it. */
|
||||
#undef JS_HAS_XML_SUPPORT
|
||||
|
||||
#endif /* js_config_h___ */
|
||||
|
@ -129,7 +129,7 @@ MSG_DEF(JSMSG_PAREN_AFTER_COND, 75, 0, JSEXN_SYNTAXERR, "missing ) after
|
||||
MSG_DEF(JSMSG_BAD_DUP_ARGS, 76, 0, JSEXN_SYNTAXERR, "duplicate argument names not allowed in this context")
|
||||
MSG_DEF(JSMSG_NAME_AFTER_DOT, 77, 0, JSEXN_SYNTAXERR, "missing name after . operator")
|
||||
MSG_DEF(JSMSG_BRACKET_IN_INDEX, 78, 0, JSEXN_SYNTAXERR, "missing ] in index expression")
|
||||
MSG_DEF(JSMSG_XML_WHOLE_PROGRAM, 79, 0, JSEXN_SYNTAXERR, "XML can't be the whole program")
|
||||
MSG_DEF(JSMSG_UNUSED79, 79, 0, JSEXN_NONE, "")
|
||||
MSG_DEF(JSMSG_PAREN_BEFORE_SWITCH, 80, 0, JSEXN_SYNTAXERR, "missing ( before switch expression")
|
||||
MSG_DEF(JSMSG_PAREN_AFTER_SWITCH, 81, 0, JSEXN_SYNTAXERR, "missing ) after switch expression")
|
||||
MSG_DEF(JSMSG_CURLY_BEFORE_SWITCH, 82, 0, JSEXN_SYNTAXERR, "missing { before switch body")
|
||||
@ -220,35 +220,35 @@ MSG_DEF(JSMSG_RESERVED_SLOT_RANGE, 166, 0, JSEXN_RANGEERR, "reserved slot ind
|
||||
MSG_DEF(JSMSG_CANT_DECODE_PRINCIPALS, 167, 0, JSEXN_INTERNALERR, "can't decode JSPrincipals")
|
||||
MSG_DEF(JSMSG_CANT_SEAL_OBJECT, 168, 1, JSEXN_ERR, "can't seal {0} objects")
|
||||
MSG_DEF(JSMSG_TOO_MANY_CATCH_VARS, 169, 0, JSEXN_SYNTAXERR, "too many catch variables")
|
||||
MSG_DEF(JSMSG_BAD_XML_MARKUP, 170, 0, JSEXN_SYNTAXERR, "invalid XML markup")
|
||||
MSG_DEF(JSMSG_BAD_XML_CHARACTER, 171, 0, JSEXN_SYNTAXERR, "illegal XML character")
|
||||
MSG_DEF(JSMSG_BAD_DEFAULT_XML_NAMESPACE,172,0,JSEXN_SYNTAXERR, "invalid default XML namespace")
|
||||
MSG_DEF(JSMSG_BAD_XML_NAME_SYNTAX, 173, 0, JSEXN_SYNTAXERR, "invalid XML name")
|
||||
MSG_DEF(JSMSG_BRACKET_AFTER_ATTR_EXPR,174, 0, JSEXN_SYNTAXERR, "missing ] after attribute expression")
|
||||
MSG_DEF(JSMSG_UNUSED170, 170, 0, JSEXN_NONE, "")
|
||||
MSG_DEF(JSMSG_UNUSED171, 171, 0, JSEXN_NONE, "")
|
||||
MSG_DEF(JSMSG_UNUSED172, 172, 0, JSEXN_NONE, "")
|
||||
MSG_DEF(JSMSG_UNUSED173, 173, 0, JSEXN_NONE, "")
|
||||
MSG_DEF(JSMSG_UNUSED174, 174, 0, JSEXN_NONE, "")
|
||||
MSG_DEF(JSMSG_NESTING_GENERATOR, 175, 0, JSEXN_TYPEERR, "already executing generator")
|
||||
MSG_DEF(JSMSG_CURLY_IN_XML_EXPR, 176, 0, JSEXN_SYNTAXERR, "missing } in XML expression")
|
||||
MSG_DEF(JSMSG_BAD_XML_NAMESPACE, 177, 1, JSEXN_TYPEERR, "invalid XML namespace {0}")
|
||||
MSG_DEF(JSMSG_BAD_XML_ATTR_NAME, 178, 1, JSEXN_TYPEERR, "invalid XML attribute name {0}")
|
||||
MSG_DEF(JSMSG_BAD_XML_NAME, 179, 1, JSEXN_TYPEERR, "invalid XML name {0}")
|
||||
MSG_DEF(JSMSG_BAD_XML_CONVERSION, 180, 1, JSEXN_TYPEERR, "can't convert {0} to XML")
|
||||
MSG_DEF(JSMSG_BAD_XMLLIST_CONVERSION, 181, 1, JSEXN_TYPEERR, "can't convert {0} to XMLList")
|
||||
MSG_DEF(JSMSG_UNUSED176, 176, 0, JSEXN_NONE, "")
|
||||
MSG_DEF(JSMSG_UNUSED177, 177, 0, JSEXN_NONE, "")
|
||||
MSG_DEF(JSMSG_UNUSED178, 178, 0, JSEXN_NONE, "")
|
||||
MSG_DEF(JSMSG_UNUSED179, 179, 0, JSEXN_NONE, "")
|
||||
MSG_DEF(JSMSG_UNUSED180, 180, 0, JSEXN_NONE, "")
|
||||
MSG_DEF(JSMSG_UNUSED181, 181, 0, JSEXN_NONE, "")
|
||||
MSG_DEF(JSMSG_BAD_GENERATOR_SEND, 182, 1, JSEXN_TYPEERR, "attempt to send {0} to newborn generator")
|
||||
MSG_DEF(JSMSG_NO_ASSIGN_IN_XML_ATTR, 183, 0, JSEXN_SYNTAXERR, "missing = in XML attribute")
|
||||
MSG_DEF(JSMSG_BAD_XML_ATTR_VALUE, 184, 0, JSEXN_SYNTAXERR, "invalid XML attribute value")
|
||||
MSG_DEF(JSMSG_XML_TAG_NAME_MISMATCH, 185, 1, JSEXN_SYNTAXERR, "XML tag name mismatch (expected {0})")
|
||||
MSG_DEF(JSMSG_BAD_XML_TAG_SYNTAX, 186, 0, JSEXN_SYNTAXERR, "invalid XML tag syntax")
|
||||
MSG_DEF(JSMSG_BAD_XML_LIST_SYNTAX, 187, 0, JSEXN_SYNTAXERR, "invalid XML list syntax")
|
||||
MSG_DEF(JSMSG_UNUSED183, 183, 0, JSEXN_NONE, "")
|
||||
MSG_DEF(JSMSG_UNUSED184, 184, 0, JSEXN_NONE, "")
|
||||
MSG_DEF(JSMSG_UNUSED185, 185, 0, JSEXN_NONE, "")
|
||||
MSG_DEF(JSMSG_UNUSED186, 186, 0, JSEXN_NONE, "")
|
||||
MSG_DEF(JSMSG_UNUSED187, 187, 0, JSEXN_NONE, "")
|
||||
MSG_DEF(JSMSG_INCOMPATIBLE_METHOD, 188, 3, JSEXN_TYPEERR, "{0} {1} called on incompatible {2}")
|
||||
MSG_DEF(JSMSG_CANT_SET_XML_ATTRS, 189, 0, JSEXN_INTERNALERR, "can't set XML property attributes")
|
||||
MSG_DEF(JSMSG_END_OF_XML_SOURCE, 190, 0, JSEXN_SYNTAXERR, "unexpected end of XML source")
|
||||
MSG_DEF(JSMSG_END_OF_XML_ENTITY, 191, 0, JSEXN_SYNTAXERR, "unexpected end of XML entity")
|
||||
MSG_DEF(JSMSG_BAD_XML_QNAME, 192, 0, JSEXN_SYNTAXERR, "invalid XML qualified name")
|
||||
MSG_DEF(JSMSG_UNUSED189, 189, 0, JSEXN_NONE, "")
|
||||
MSG_DEF(JSMSG_UNUSED190, 190, 0, JSEXN_NONE, "")
|
||||
MSG_DEF(JSMSG_UNUSED191, 191, 0, JSEXN_NONE, "")
|
||||
MSG_DEF(JSMSG_UNUSED192, 192, 0, JSEXN_NONE, "")
|
||||
MSG_DEF(JSMSG_BAD_FOR_EACH_LOOP, 193, 0, JSEXN_SYNTAXERR, "invalid for each loop")
|
||||
MSG_DEF(JSMSG_BAD_XMLLIST_PUT, 194, 1, JSEXN_TYPEERR, "can't set property {0} in XMLList")
|
||||
MSG_DEF(JSMSG_UNKNOWN_XML_ENTITY, 195, 1, JSEXN_TYPEERR, "unknown XML entity {0}")
|
||||
MSG_DEF(JSMSG_BAD_XML_NCR, 196, 1, JSEXN_TYPEERR, "malformed XML character {0}")
|
||||
MSG_DEF(JSMSG_UNDEFINED_XML_NAME, 197, 1, JSEXN_REFERENCEERR, "reference to undefined XML name {0}")
|
||||
MSG_DEF(JSMSG_DUPLICATE_XML_ATTR, 198, 1, JSEXN_TYPEERR, "duplicate XML attribute {0}")
|
||||
MSG_DEF(JSMSG_UNUSED194, 194, 0, JSEXN_NONE, "")
|
||||
MSG_DEF(JSMSG_UNUSED195, 195, 0, JSEXN_NONE, "")
|
||||
MSG_DEF(JSMSG_UNUSED196, 196, 0, JSEXN_NONE, "")
|
||||
MSG_DEF(JSMSG_UNUSED197, 197, 0, JSEXN_NONE, "")
|
||||
MSG_DEF(JSMSG_UNUSED198, 198, 0, JSEXN_NONE, "")
|
||||
MSG_DEF(JSMSG_TOO_MANY_LOCALS, 199, 0, JSEXN_SYNTAXERR, "too many local variables")
|
||||
MSG_DEF(JSMSG_ARRAY_INIT_TOO_BIG, 200, 0, JSEXN_INTERNALERR, "array initialiser too large")
|
||||
MSG_DEF(JSMSG_REGEXP_TOO_COMPLEX, 201, 0, JSEXN_INTERNALERR, "regular expression too complex")
|
||||
@ -263,13 +263,13 @@ MSG_DEF(JSMSG_BAD_ANON_GENERATOR_RETURN, 209, 0, JSEXN_TYPEERR, "anonymous gener
|
||||
MSG_DEF(JSMSG_NAME_AFTER_FOR_PAREN, 210, 0, JSEXN_SYNTAXERR, "missing name after for (")
|
||||
MSG_DEF(JSMSG_IN_AFTER_FOR_NAME, 211, 0, JSEXN_SYNTAXERR, "missing 'in' or 'of' after for")
|
||||
MSG_DEF(JSMSG_BAD_TRAP_RETURN_VALUE, 212, 2, JSEXN_TYPEERR,"trap {1} for {0} returned a primitive value")
|
||||
MSG_DEF(JSMSG_KEYWORD_NOT_NS, 213, 0, JSEXN_SYNTAXERR, "keyword is used as namespace")
|
||||
MSG_DEF(JSMSG_UNUSED213, 213, 0, JSEXN_NONE, "")
|
||||
MSG_DEF(JSMSG_BAD_GENERATOR_YIELD, 214, 1, JSEXN_TYPEERR, "yield from closing generator {0}")
|
||||
MSG_DEF(JSMSG_BAD_GENERATOR_SYNTAX, 215, 1, JSEXN_SYNTAXERR, "{0} expression must be parenthesized")
|
||||
MSG_DEF(JSMSG_ARRAY_COMP_LEFTSIDE, 216, 0, JSEXN_SYNTAXERR, "invalid array comprehension left-hand side")
|
||||
MSG_DEF(JSMSG_NON_XML_FILTER, 217, 1, JSEXN_TYPEERR, "XML filter is applied to non-XML value {0}")
|
||||
MSG_DEF(JSMSG_UNUSED217, 217, 0, JSEXN_NONE, "")
|
||||
MSG_DEF(JSMSG_EMPTY_ARRAY_REDUCE, 218, 0, JSEXN_TYPEERR, "reduce of empty array with no initial value")
|
||||
MSG_DEF(JSMSG_NON_LIST_XML_METHOD, 219, 2, JSEXN_TYPEERR, "can't call {0} method on an XML list with {1} elements")
|
||||
MSG_DEF(JSMSG_UNUSED219, 219, 0, JSEXN_NONE, "")
|
||||
MSG_DEF(JSMSG_BAD_DELETE_OPERAND, 220, 0, JSEXN_REFERENCEERR, "invalid delete operand")
|
||||
MSG_DEF(JSMSG_BAD_INCOP_OPERAND, 221, 0, JSEXN_REFERENCEERR, "invalid increment/decrement operand")
|
||||
MSG_DEF(JSMSG_UNEXPECTED_TYPE, 222, 2, JSEXN_TYPEERR, "{0} is {1}")
|
||||
@ -313,7 +313,7 @@ MSG_DEF(JSMSG_CANT_CHANGE_EXTENSIBILITY, 259, 0, JSEXN_TYPEERR, "can't change ob
|
||||
MSG_DEF(JSMSG_SC_BAD_SERIALIZED_DATA, 260, 1, JSEXN_INTERNALERR, "bad serialized structured data ({0})")
|
||||
MSG_DEF(JSMSG_SC_UNSUPPORTED_TYPE, 261, 0, JSEXN_TYPEERR, "unsupported type for structured data")
|
||||
MSG_DEF(JSMSG_SC_RECURSION, 262, 0, JSEXN_INTERNALERR, "recursive object")
|
||||
MSG_DEF(JSMSG_CANT_WRAP_XML_OBJECT, 263, 0, JSEXN_TYPEERR, "can't wrap XML objects")
|
||||
MSG_DEF(JSMSG_UNUSED263, 263, 0, JSEXN_NONE, "")
|
||||
MSG_DEF(JSMSG_BAD_CLONE_VERSION, 264, 0, JSEXN_ERR, "unsupported structured clone version")
|
||||
MSG_DEF(JSMSG_CANT_CLONE_OBJECT, 265, 0, JSEXN_TYPEERR, "can't clone object")
|
||||
MSG_DEF(JSMSG_UNUSED266, 266, 0, JSEXN_NONE, "")
|
||||
@ -322,7 +322,7 @@ MSG_DEF(JSMSG_INVALID_FOR_IN_INIT, 268, 0, JSEXN_SYNTAXERR, "for-in loop let
|
||||
MSG_DEF(JSMSG_CLEARED_SCOPE, 269, 0, JSEXN_TYPEERR, "attempt to run compile-and-go script on a cleared scope")
|
||||
MSG_DEF(JSMSG_MALFORMED_ESCAPE, 270, 1, JSEXN_SYNTAXERR, "malformed {0} character escape sequence")
|
||||
MSG_DEF(JSMSG_BAD_GENEXP_BODY, 271, 1, JSEXN_SYNTAXERR, "illegal use of {0} in generator expression")
|
||||
MSG_DEF(JSMSG_XML_PROTO_FORBIDDEN, 272, 0, JSEXN_TYPEERR, "can't set prototype of an object to an XML value")
|
||||
MSG_DEF(JSMSG_UNUSED272, 272, 0, JSEXN_NONE, "")
|
||||
MSG_DEF(JSMSG_UNNAMED_FUNCTION_STMT, 273, 0, JSEXN_SYNTAXERR, "function statement requires a name")
|
||||
MSG_DEF(JSMSG_CCW_REQUIRED, 274, 1, JSEXN_TYPEERR, "{0}: argument must be an object from a different compartment")
|
||||
MSG_DEF(JSMSG_DEBUG_BAD_RESUMPTION, 275, 0, JSEXN_TYPEERR, "debugger resumption value must be undefined, {throw: val}, {return: val}, or null")
|
||||
|
@ -310,10 +310,6 @@ ScriptAnalysis::analyzeBytecode(JSContext *cx)
|
||||
isJaegerInlineable = isIonInlineable = false;
|
||||
break;
|
||||
|
||||
case JSOP_QNAMEPART:
|
||||
case JSOP_QNAMECONST:
|
||||
isJaegerCompileable = false;
|
||||
/* FALL THROUGH */
|
||||
case JSOP_NAME:
|
||||
case JSOP_CALLNAME:
|
||||
case JSOP_BINDNAME:
|
||||
@ -874,7 +870,7 @@ ScriptAnalysis::analyzeLifetimes(JSContext *cx)
|
||||
|
||||
jsbytecode *entrypc = script_->code + entry;
|
||||
|
||||
if (JSOp(*entrypc) == JSOP_GOTO || JSOp(*entrypc) == JSOP_FILTER)
|
||||
if (JSOp(*entrypc) == JSOP_GOTO)
|
||||
loop->entry = entry + GET_JUMP_OFFSET(entrypc);
|
||||
else
|
||||
loop->entry = targetOffset;
|
||||
|
@ -183,8 +183,6 @@ GetDefCount(UnrootedScript script, unsigned offset)
|
||||
case JSOP_OR:
|
||||
case JSOP_AND:
|
||||
return 1;
|
||||
case JSOP_FILTER:
|
||||
return 2;
|
||||
case JSOP_PICK:
|
||||
/*
|
||||
* Pick pops and pushes how deep it looks in the stack + 1
|
||||
@ -247,7 +245,6 @@ BytecodeNoFallThrough(JSOp op)
|
||||
case JSOP_RETRVAL:
|
||||
case JSOP_THROW:
|
||||
case JSOP_TABLESWITCH:
|
||||
case JSOP_FILTER:
|
||||
return true;
|
||||
case JSOP_GOSUB:
|
||||
/* These fall through indirectly, after executing a 'finally'. */
|
||||
|
@ -52,7 +52,6 @@
|
||||
#include "jsworkers.h"
|
||||
#include "jswrapper.h"
|
||||
#include "jstypedarray.h"
|
||||
#include "jsxml.h"
|
||||
|
||||
#include "builtin/Eval.h"
|
||||
#include "builtin/Intl.h"
|
||||
@ -149,11 +148,6 @@ class AutoVersionAPI
|
||||
, oldCompileOptions(cx->getCompileOptions())
|
||||
#endif
|
||||
{
|
||||
#if JS_HAS_XML_SUPPORT
|
||||
// For backward compatibility, AutoVersionAPI clobbers the
|
||||
// JSOPTION_MOAR_XML bit in cx, but not the JSOPTION_ALLOW_XML bit.
|
||||
newVersion = JSVersion(newVersion | (oldDefaultVersion & VersionFlags::ALLOW_XML));
|
||||
#endif
|
||||
this->newVersion = newVersion;
|
||||
cx->clearVersionOverride();
|
||||
cx->setDefaultVersion(newVersion);
|
||||
@ -179,7 +173,6 @@ class AutoVersionAPI
|
||||
#endif
|
||||
|
||||
#ifdef JS_USE_JSID_STRUCT_TYPES
|
||||
jsid JS_DEFAULT_XML_NAMESPACE_ID = { size_t(JSID_TYPE_DEFAULT_XML_NAMESPACE) };
|
||||
jsid JSID_VOID = { size_t(JSID_TYPE_VOID) };
|
||||
jsid JSID_EMPTY = { size_t(JSID_TYPE_OBJECT) };
|
||||
#endif
|
||||
@ -817,7 +810,6 @@ JSRuntime::JSRuntime(JSUseHelperThreads useHelperThreads)
|
||||
gcInterFrameGC(0),
|
||||
gcSliceBudget(SliceBudget::Unlimited),
|
||||
gcIncrementalEnabled(true),
|
||||
gcExactScanningEnabled(true),
|
||||
gcManipulatingDeadCompartments(false),
|
||||
gcObjectsMarkedInDeadCompartments(0),
|
||||
gcPoke(false),
|
||||
@ -1793,11 +1785,6 @@ static JSStdName standard_class_atoms[] = {
|
||||
{js_InitStringClass, EAGER_ATOM_AND_CLASP(String)},
|
||||
{js_InitExceptionClasses, EAGER_ATOM_AND_CLASP(Error)},
|
||||
{js_InitRegExpClass, EAGER_ATOM_AND_CLASP(RegExp)},
|
||||
#if JS_HAS_XML_SUPPORT
|
||||
{js_InitXMLClass, EAGER_ATOM_AND_CLASP(XML)},
|
||||
{js_InitNamespaceClass, EAGER_ATOM_AND_CLASP(Namespace)},
|
||||
{js_InitQNameClass, EAGER_ATOM_AND_CLASP(QName)},
|
||||
#endif
|
||||
#if JS_HAS_GENERATORS
|
||||
{js_InitIteratorClasses, EAGER_ATOM_AND_CLASP(StopIteration)},
|
||||
#endif
|
||||
@ -1851,11 +1838,6 @@ static JSStdName standard_class_names[] = {
|
||||
{js_InitExceptionClasses, EAGER_CLASS_ATOM(TypeError), CLASP(Error)},
|
||||
{js_InitExceptionClasses, EAGER_CLASS_ATOM(URIError), CLASP(Error)},
|
||||
|
||||
#if JS_HAS_XML_SUPPORT
|
||||
{js_InitXMLClass, EAGER_ATOM(XMLList), CLASP(XML)},
|
||||
{js_InitXMLClass, EAGER_ATOM(isXMLName), CLASP(XML)},
|
||||
#endif
|
||||
|
||||
{js_InitIteratorClasses, EAGER_CLASS_ATOM(Iterator), &PropertyIteratorObject::class_},
|
||||
|
||||
/* Typed Arrays */
|
||||
@ -1989,16 +1971,6 @@ JS_ResolveStandardClass(JSContext *cx, JSObject *objArg, jsid id, JSBool *resolv
|
||||
if (IsStandardClassResolved(obj, stdnm->clasp))
|
||||
return true;
|
||||
|
||||
#if JS_HAS_XML_SUPPORT
|
||||
if ((stdnm->init == js_InitXMLClass ||
|
||||
stdnm->init == js_InitNamespaceClass ||
|
||||
stdnm->init == js_InitQNameClass) &&
|
||||
!VersionHasAllowXML(cx->findVersion()))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!stdnm->init(cx, obj))
|
||||
return false;
|
||||
*resolved = true;
|
||||
@ -2030,15 +2002,7 @@ JS_EnumerateStandardClasses(JSContext *cx, JSObject *objArg)
|
||||
/* Initialize any classes that have not been initialized yet. */
|
||||
for (unsigned i = 0; standard_class_atoms[i].init; i++) {
|
||||
const JSStdName &stdnm = standard_class_atoms[i];
|
||||
if (!js::IsStandardClassResolved(obj, stdnm.clasp)
|
||||
#if JS_HAS_XML_SUPPORT
|
||||
&& ((stdnm.init != js_InitXMLClass &&
|
||||
stdnm.init != js_InitNamespaceClass &&
|
||||
stdnm.init != js_InitQNameClass) ||
|
||||
VersionHasAllowXML(cx->findVersion()))
|
||||
#endif
|
||||
)
|
||||
{
|
||||
if (!js::IsStandardClassResolved(obj, stdnm.clasp)) {
|
||||
if (!stdnm.init(cx, obj))
|
||||
return false;
|
||||
}
|
||||
@ -2526,12 +2490,6 @@ JS_GetTraceThingInfo(char *buf, size_t bufsize, JSTracer *trc, void *thing,
|
||||
case JSTRACE_TYPE_OBJECT:
|
||||
name = "type_object";
|
||||
break;
|
||||
|
||||
#if JS_HAS_XML_SUPPORT
|
||||
case JSTRACE_XML:
|
||||
name = "xml";
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
|
||||
n = strlen(name);
|
||||
@ -2593,17 +2551,6 @@ JS_GetTraceThingInfo(char *buf, size_t bufsize, JSTracer *trc, void *thing,
|
||||
case JSTRACE_BASE_SHAPE:
|
||||
case JSTRACE_TYPE_OBJECT:
|
||||
break;
|
||||
|
||||
#if JS_HAS_XML_SUPPORT
|
||||
case JSTRACE_XML:
|
||||
{
|
||||
extern const char *js_xml_class_str[];
|
||||
JSXML *xml = (JSXML *)thing;
|
||||
|
||||
JS_snprintf(buf, bufsize, " %s", js_xml_class_str[xml->xml_class]);
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
buf[bufsize - 1] = '\0';
|
||||
|
@ -1068,8 +1068,8 @@ class JS_PUBLIC_API(AutoGCRooter) {
|
||||
SHAPEVECTOR = -4, /* js::AutoShapeVector */
|
||||
IDARRAY = -6, /* js::AutoIdArray */
|
||||
DESCRIPTORS = -7, /* js::AutoPropDescArrayRooter */
|
||||
NAMESPACES = -8, /* js::AutoNamespaceArray */
|
||||
XML = -9, /* js::AutoXMLRooter */
|
||||
// UNUSED -8
|
||||
// UNUSED -9
|
||||
OBJECT = -10, /* js::AutoObjectRooter */
|
||||
ID = -11, /* js::AutoIdRooter */
|
||||
VALVECTOR = -12, /* js::AutoValueVector */
|
||||
@ -2384,11 +2384,9 @@ JS_NumberValue(double d)
|
||||
|
||||
/*
|
||||
* A jsid is an identifier for a property or method of an object which is
|
||||
* either a 31-bit signed integer, interned string or object. If XML is
|
||||
* enabled, there is an additional singleton jsid value; see
|
||||
* JS_DEFAULT_XML_NAMESPACE_ID below. Finally, there is an additional jsid
|
||||
* value, JSID_VOID, which does not occur in JS scripts but may be used to
|
||||
* indicate the absence of a valid jsid.
|
||||
* either a 31-bit signed integer, interned string or object. Also, there is
|
||||
* an additional jsid value, JSID_VOID, which does not occur in JS scripts but
|
||||
* may be used to indicate the absence of a valid jsid.
|
||||
*
|
||||
* A jsid is not implicitly convertible to or from a jsval; JS_ValueToId or
|
||||
* JS_IdToValue must be used instead.
|
||||
@ -2398,7 +2396,6 @@ JS_NumberValue(double d)
|
||||
#define JSID_TYPE_INT 0x1
|
||||
#define JSID_TYPE_VOID 0x2
|
||||
#define JSID_TYPE_OBJECT 0x4
|
||||
#define JSID_TYPE_DEFAULT_XML_NAMESPACE 0x6
|
||||
#define JSID_TYPE_MASK 0x7
|
||||
|
||||
/*
|
||||
@ -2506,25 +2503,6 @@ JSID_TO_GCTHING(jsid id)
|
||||
return (void *)(JSID_BITS(id) & ~(size_t)JSID_TYPE_MASK);
|
||||
}
|
||||
|
||||
/*
|
||||
* The magic XML namespace id is not a valid jsid. Global object classes in
|
||||
* embeddings that enable JS_HAS_XML_SUPPORT (E4X) should handle this id.
|
||||
*/
|
||||
|
||||
static JS_ALWAYS_INLINE JSBool
|
||||
JSID_IS_DEFAULT_XML_NAMESPACE(jsid id)
|
||||
{
|
||||
JS_ASSERT_IF(((size_t)JSID_BITS(id) & JSID_TYPE_MASK) == JSID_TYPE_DEFAULT_XML_NAMESPACE,
|
||||
JSID_BITS(id) == JSID_TYPE_DEFAULT_XML_NAMESPACE);
|
||||
return ((size_t)JSID_BITS(id) == JSID_TYPE_DEFAULT_XML_NAMESPACE);
|
||||
}
|
||||
|
||||
#ifdef JS_USE_JSID_STRUCT_TYPES
|
||||
extern JS_PUBLIC_DATA(jsid) JS_DEFAULT_XML_NAMESPACE_ID;
|
||||
#else
|
||||
# define JS_DEFAULT_XML_NAMESPACE_ID ((jsid)JSID_TYPE_DEFAULT_XML_NAMESPACE)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* A void jsid is not a valid id and only arises as an exceptional API return
|
||||
* value, such as in JS_NextProperty. Embeddings must not pass JSID_VOID into
|
||||
@ -3165,16 +3143,11 @@ JS_StringToVersion(const char *string);
|
||||
option supported for the
|
||||
XUL preprocessor and kindred
|
||||
beasts. */
|
||||
#define JSOPTION_ALLOW_XML JS_BIT(6) /* enable E4X syntax (deprecated)
|
||||
and define the E4X-related
|
||||
globals: XML, XMLList,
|
||||
Namespace, etc. */
|
||||
#define JSOPTION_MOAR_XML JS_BIT(7) /* enable E4X even in versions
|
||||
that don't normally get it;
|
||||
parse <!-- --> as a token,
|
||||
not backward compatible with
|
||||
the comment-hiding hack used
|
||||
in HTML script tags. */
|
||||
|
||||
/* JS_BIT(6) is currently unused. */
|
||||
|
||||
/* JS_BIT(7) is currently unused. */
|
||||
|
||||
#define JSOPTION_DONT_REPORT_UNCAUGHT \
|
||||
JS_BIT(8) /* When returning from the
|
||||
outermost API call, prevent
|
||||
@ -3216,7 +3189,7 @@ JS_StringToVersion(const char *string);
|
||||
#define JSOPTION_ION JS_BIT(20) /* IonMonkey */
|
||||
|
||||
/* Options which reflect compile-time properties of scripts. */
|
||||
#define JSCOMPILEOPTION_MASK (JSOPTION_ALLOW_XML | JSOPTION_MOAR_XML)
|
||||
#define JSCOMPILEOPTION_MASK 0
|
||||
|
||||
#define JSRUNOPTION_MASK (JS_BITMASK(21) & ~JSCOMPILEOPTION_MASK)
|
||||
#define JSALLOPTION_MASK (JSCOMPILEOPTION_MASK | JSRUNOPTION_MASK)
|
||||
|
@ -93,7 +93,7 @@ js::GetLengthProperty(JSContext *cx, HandleObject obj, uint32_t *lengthp)
|
||||
}
|
||||
|
||||
/*
|
||||
* Determine if the id represents an array index or an XML property index.
|
||||
* Determine if the id represents an array index.
|
||||
*
|
||||
* An id is an array index according to ECMA by (15.4):
|
||||
*
|
||||
|
@ -66,23 +66,4 @@ ASTDEF(AST_ARRAY_PATT, "ArrayPattern", "arrayPatter
|
||||
ASTDEF(AST_OBJECT_PATT, "ObjectPattern", "objectPattern")
|
||||
ASTDEF(AST_PROP_PATT, "Property", "propertyPattern")
|
||||
|
||||
ASTDEF(AST_XMLANYNAME, "XMLAnyName", "xmlAnyName")
|
||||
ASTDEF(AST_XMLATTR_SEL, "XMLAttributeSelector", "xmlAttributeSelector")
|
||||
ASTDEF(AST_XMLESCAPE, "XMLEscape", "xmlEscape")
|
||||
ASTDEF(AST_XMLFILTER, "XMLFilterExpression", "xmlFilterExpression")
|
||||
ASTDEF(AST_XMLDEFAULT, "XMLDefaultDeclaration", "xmlDefaultDeclaration")
|
||||
ASTDEF(AST_XMLQUAL, "XMLQualifiedIdentifier", "xmlQualifiedIdentifier")
|
||||
ASTDEF(AST_XMLFUNCQUAL, "XMLFunctionQualifiedIdentifier", "xmlFunctionQualifiedIdentifier")
|
||||
ASTDEF(AST_XMLELEM, "XMLElement", "xmlElement")
|
||||
ASTDEF(AST_XMLTEXT, "XMLText", "xmlText")
|
||||
ASTDEF(AST_XMLLIST, "XMLList", "xmlList")
|
||||
ASTDEF(AST_XMLSTART, "XMLStartTag", "xmlStartTag")
|
||||
ASTDEF(AST_XMLEND, "XMLEndTag", "xmlEndTag")
|
||||
ASTDEF(AST_XMLPOINT, "XMLPointTag", "xmlPointTag")
|
||||
ASTDEF(AST_XMLNAME, "XMLName", "xmlName")
|
||||
ASTDEF(AST_XMLATTR, "XMLAttribute", "xmlAttribute")
|
||||
ASTDEF(AST_XMLCDATA, "XMLCdata", "xmlCdata")
|
||||
ASTDEF(AST_XMLCOMMENT, "XMLComment", "xmlComment")
|
||||
ASTDEF(AST_XMLPI, "XMLProcessingInstruction", "xmlProcessingInstruction")
|
||||
|
||||
/* AST_LIMIT = last + 1 */
|
||||
|
@ -24,7 +24,6 @@
|
||||
#include "jsnum.h"
|
||||
#include "jsstr.h"
|
||||
#include "jsversion.h"
|
||||
#include "jsxml.h"
|
||||
|
||||
#include "frontend/Parser.h"
|
||||
#include "gc/Marking.h"
|
||||
@ -57,7 +56,6 @@ const char * js::TypeStrings[] = {
|
||||
js_number_str,
|
||||
js_boolean_str,
|
||||
js_null_str,
|
||||
js_xml_str,
|
||||
};
|
||||
|
||||
#define DEFINE_PROTO_STRING(name,code,init) const char js_##name##_str[] = #name;
|
||||
@ -452,32 +450,6 @@ js::InternNonIntElementId(JSContext *cx, JSObject *obj, const Value &idval,
|
||||
typename MaybeRooted<jsid, allowGC>::MutableHandleType idp,
|
||||
typename MaybeRooted<Value, allowGC>::MutableHandleType vp)
|
||||
{
|
||||
#if JS_HAS_XML_SUPPORT
|
||||
if (idval.isObject()) {
|
||||
JSObject *idobj = &idval.toObject();
|
||||
|
||||
if (obj && obj->isXML()) {
|
||||
idp.set(OBJECT_TO_JSID(idobj));
|
||||
vp.set(idval);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!allowGC)
|
||||
return false;
|
||||
|
||||
if (js_GetLocalNameFromFunctionQName(idobj, idp.address(), cx)) {
|
||||
vp.set(IdToValue(idp));
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!obj && idobj->isXMLId()) {
|
||||
idp.set(OBJECT_TO_JSID(idobj));
|
||||
vp.set(idval);
|
||||
return JS_TRUE;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
JSAtom *atom = ToAtom<allowGC>(cx, idval);
|
||||
if (!atom)
|
||||
return false;
|
||||
|
@ -33,10 +33,10 @@ SPECIALID_TO_JSID(const SpecialId &sid);
|
||||
* (PropertyName, see vm/String.h); and by various special values.
|
||||
*
|
||||
* Special values are encoded using SpecialId, which is layout-compatible but
|
||||
* non-interconvertible with jsid. A SpecialId may be: an object (used by E4X
|
||||
* and perhaps eventually by Harmony-proposed private names); JSID_VOID, which
|
||||
* non-interconvertible with jsid. A SpecialId is used for JSID_VOID, which
|
||||
* does not occur in JS scripts but may be used to indicate the absence of a
|
||||
* valid identifier; or JS_DEFAULT_XML_NAMESPACE_ID, if E4X is enabled.
|
||||
* valid identifier. In the future, a SpecialId may also be an object used by
|
||||
* Harmony-proposed private names.
|
||||
*/
|
||||
class SpecialId
|
||||
{
|
||||
@ -48,7 +48,6 @@ class SpecialId
|
||||
|
||||
static const uintptr_t TYPE_VOID = JSID_TYPE_VOID;
|
||||
static const uintptr_t TYPE_OBJECT = JSID_TYPE_OBJECT;
|
||||
static const uintptr_t TYPE_DEFAULT_XML_NAMESPACE = JSID_TYPE_DEFAULT_XML_NAMESPACE;
|
||||
static const uintptr_t TYPE_MASK = JSID_TYPE_MASK;
|
||||
|
||||
SpecialId(uintptr_t bits) : bits(bits) { }
|
||||
@ -97,18 +96,6 @@ class SpecialId
|
||||
bool isVoid() const {
|
||||
return bits == TYPE_VOID;
|
||||
}
|
||||
|
||||
/* Default XML namespace */
|
||||
|
||||
static SpecialId defaultXMLNamespace() {
|
||||
SpecialId sid(TYPE_DEFAULT_XML_NAMESPACE);
|
||||
JS_ASSERT(sid.isDefaultXMLNamespace());
|
||||
return sid;
|
||||
}
|
||||
|
||||
bool isDefaultXMLNamespace() const {
|
||||
return bits == TYPE_DEFAULT_XML_NAMESPACE;
|
||||
}
|
||||
};
|
||||
|
||||
static JS_ALWAYS_INLINE jsid
|
||||
@ -119,15 +106,13 @@ SPECIALID_TO_JSID(const SpecialId &sid)
|
||||
JS_ASSERT_IF(sid.isObject(), JSID_IS_OBJECT(id) && JSID_TO_OBJECT(id) == sid.toObject());
|
||||
JS_ASSERT_IF(sid.isVoid(), JSID_IS_VOID(id));
|
||||
JS_ASSERT_IF(sid.isEmpty(), JSID_IS_EMPTY(id));
|
||||
JS_ASSERT_IF(sid.isDefaultXMLNamespace(), JSID_IS_DEFAULT_XML_NAMESPACE(id));
|
||||
return id;
|
||||
}
|
||||
|
||||
static JS_ALWAYS_INLINE bool
|
||||
JSID_IS_SPECIAL(jsid id)
|
||||
{
|
||||
return JSID_IS_OBJECT(id) || JSID_IS_EMPTY(id) || JSID_IS_VOID(id) ||
|
||||
JSID_IS_DEFAULT_XML_NAMESPACE(id);
|
||||
return JSID_IS_OBJECT(id) || JSID_IS_EMPTY(id) || JSID_IS_VOID(id);
|
||||
}
|
||||
|
||||
static JS_ALWAYS_INLINE SpecialId
|
||||
@ -138,10 +123,8 @@ JSID_TO_SPECIALID(jsid id)
|
||||
return SpecialId(*JSID_TO_OBJECT(id));
|
||||
if (JSID_IS_EMPTY(id))
|
||||
return SpecialId::empty();
|
||||
if (JSID_IS_VOID(id))
|
||||
return SpecialId::voidId();
|
||||
JS_ASSERT(JSID_IS_DEFAULT_XML_NAMESPACE(id));
|
||||
return SpecialId::defaultXMLNamespace();
|
||||
JS_ASSERT(JSID_IS_VOID(id));
|
||||
return SpecialId::voidId();
|
||||
}
|
||||
|
||||
typedef JS::Handle<SpecialId> HandleSpecialId;
|
||||
|
@ -878,14 +878,6 @@ struct JSRuntime : js::RuntimeFriendFields,
|
||||
*/
|
||||
bool gcGenerationalEnabled;
|
||||
|
||||
/*
|
||||
* Whether exact stack scanning is enabled for this runtime. This is
|
||||
* currently only used for dynamic root analysis. Exact scanning starts out
|
||||
* enabled, and is disabled if e4x has been used.
|
||||
*/
|
||||
bool gcExactScanningEnabled;
|
||||
|
||||
|
||||
/*
|
||||
* This is true if we are in the middle of a brain transplant (e.g.,
|
||||
* JS_TransplantObject) or some other operation that can manipulate
|
||||
@ -1289,25 +1281,6 @@ namespace js {
|
||||
|
||||
struct AutoResolving;
|
||||
|
||||
static inline bool
|
||||
OptionsHasAllowXML(uint32_t options)
|
||||
{
|
||||
return !!(options & JSOPTION_ALLOW_XML);
|
||||
}
|
||||
|
||||
static inline bool
|
||||
OptionsHasMoarXML(uint32_t options)
|
||||
{
|
||||
return !!(options & JSOPTION_MOAR_XML);
|
||||
}
|
||||
|
||||
static inline bool
|
||||
OptionsSameVersionFlags(uint32_t self, uint32_t other)
|
||||
{
|
||||
static const uint32_t mask = JSOPTION_MOAR_XML;
|
||||
return !((self & mask) ^ (other & mask));
|
||||
}
|
||||
|
||||
/*
|
||||
* Flags accompany script version data so that a) dynamically created scripts
|
||||
* can inherit their caller's compile-time properties and b) scripts can be
|
||||
@ -1318,9 +1291,7 @@ OptionsSameVersionFlags(uint32_t self, uint32_t other)
|
||||
*/
|
||||
namespace VersionFlags {
|
||||
static const unsigned MASK = 0x0FFF; /* see JSVersion in jspubtd.h */
|
||||
static const unsigned ALLOW_XML = 0x1000; /* flag induced by JSOPTION_ALLOW_XML */
|
||||
static const unsigned MOAR_XML = 0x2000; /* flag induced by JSOPTION_MOAR_XML */
|
||||
static const unsigned FULL_MASK = 0x3FFF;
|
||||
static const unsigned FULL_MASK = 0x0FFF;
|
||||
} /* namespace VersionFlags */
|
||||
|
||||
static inline JSVersion
|
||||
@ -1329,25 +1300,6 @@ VersionNumber(JSVersion version)
|
||||
return JSVersion(uint32_t(version) & VersionFlags::MASK);
|
||||
}
|
||||
|
||||
static inline bool
|
||||
VersionHasAllowXML(JSVersion version)
|
||||
{
|
||||
return !!(version & VersionFlags::ALLOW_XML);
|
||||
}
|
||||
|
||||
static inline bool
|
||||
VersionHasMoarXML(JSVersion version)
|
||||
{
|
||||
return !!(version & VersionFlags::MOAR_XML);
|
||||
}
|
||||
|
||||
/* @warning This is a distinct condition from having the XML flag set. */
|
||||
static inline bool
|
||||
VersionShouldParseXML(JSVersion version)
|
||||
{
|
||||
return VersionHasMoarXML(version) || VersionNumber(version) >= JSVERSION_1_6;
|
||||
}
|
||||
|
||||
static inline JSVersion
|
||||
VersionExtractFlags(JSVersion version)
|
||||
{
|
||||
@ -1369,8 +1321,7 @@ VersionHasFlags(JSVersion version)
|
||||
static inline unsigned
|
||||
VersionFlagsToOptions(JSVersion version)
|
||||
{
|
||||
unsigned copts = (VersionHasAllowXML(version) ? JSOPTION_ALLOW_XML : 0) |
|
||||
(VersionHasMoarXML(version) ? JSOPTION_MOAR_XML : 0);
|
||||
unsigned copts = 0;
|
||||
JS_ASSERT((copts & JSCOMPILEOPTION_MASK) == copts);
|
||||
return copts;
|
||||
}
|
||||
@ -1378,13 +1329,7 @@ VersionFlagsToOptions(JSVersion version)
|
||||
static inline JSVersion
|
||||
OptionFlagsToVersion(unsigned options, JSVersion version)
|
||||
{
|
||||
uint32_t v = version;
|
||||
v &= ~(VersionFlags::ALLOW_XML | VersionFlags::MOAR_XML);
|
||||
if (OptionsHasAllowXML(options))
|
||||
v |= VersionFlags::ALLOW_XML;
|
||||
if (OptionsHasMoarXML(options))
|
||||
v |= VersionFlags::MOAR_XML;
|
||||
return JSVersion(v);
|
||||
return version;
|
||||
}
|
||||
|
||||
static inline bool
|
||||
@ -1789,25 +1734,6 @@ struct AutoResolving {
|
||||
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
|
||||
};
|
||||
|
||||
#if JS_HAS_XML_SUPPORT
|
||||
class AutoXMLRooter : private AutoGCRooter {
|
||||
public:
|
||||
AutoXMLRooter(JSContext *cx, JSXML *xml
|
||||
MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
|
||||
: AutoGCRooter(cx, XML), xml(xml)
|
||||
{
|
||||
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
|
||||
JS_ASSERT(xml);
|
||||
}
|
||||
|
||||
friend void AutoGCRooter::trace(JSTracer *trc);
|
||||
|
||||
private:
|
||||
JSXML * const xml;
|
||||
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
|
||||
};
|
||||
#endif /* JS_HAS_XML_SUPPORT */
|
||||
|
||||
#ifdef JS_THREADSAFE
|
||||
# define JS_LOCK_GC(rt) PR_Lock((rt)->gcLock)
|
||||
# define JS_UNLOCK_GC(rt) PR_Unlock((rt)->gcLock)
|
||||
|
@ -13,7 +13,6 @@
|
||||
#include "jsfriendapi.h"
|
||||
#include "jsinterp.h"
|
||||
#include "jsprobes.h"
|
||||
#include "jsxml.h"
|
||||
#include "jsgc.h"
|
||||
|
||||
#include "builtin/Object.h" // For js::obj_construct
|
||||
@ -135,31 +134,6 @@ struct PreserveRegsGuard
|
||||
FrameRegs ®s_;
|
||||
};
|
||||
|
||||
#if JS_HAS_XML_SUPPORT
|
||||
|
||||
class AutoNamespaceArray : protected AutoGCRooter {
|
||||
public:
|
||||
AutoNamespaceArray(JSContext *cx)
|
||||
: AutoGCRooter(cx, NAMESPACES), context(cx) {
|
||||
array.init();
|
||||
}
|
||||
|
||||
~AutoNamespaceArray() {
|
||||
array.finish(context->runtime->defaultFreeOp());
|
||||
}
|
||||
|
||||
uint32_t length() const { return array.length; }
|
||||
|
||||
private:
|
||||
JSContext *context;
|
||||
friend void AutoGCRooter::trace(JSTracer *trc);
|
||||
|
||||
public:
|
||||
JSXMLArray<JSObject> array;
|
||||
};
|
||||
|
||||
#endif /* JS_HAS_XML_SUPPORT */
|
||||
|
||||
#ifdef JS_CRASH_DIAGNOSTICS
|
||||
class CompartmentChecker
|
||||
{
|
||||
|
@ -501,15 +501,6 @@ js::SetPreserveWrapperCallback(JSRuntime *rt, PreserveWrapperCallback callback)
|
||||
* sufficient data has been harvested.
|
||||
*/
|
||||
|
||||
// Defined in jsxml.cpp.
|
||||
extern size_t sE4XObjectsCreated;
|
||||
|
||||
JS_FRIEND_API(size_t)
|
||||
JS_GetE4XObjectsCreated(JSContext *)
|
||||
{
|
||||
return sE4XObjectsCreated;
|
||||
}
|
||||
|
||||
namespace js {
|
||||
// Defined in vm/GlobalObject.cpp.
|
||||
extern size_t sSetProtoCalled;
|
||||
@ -718,13 +709,6 @@ js::GetContextStructuredCloneCallbacks(JSContext *cx)
|
||||
return cx->runtime->structuredCloneCallbacks;
|
||||
}
|
||||
|
||||
JS_FRIEND_API(JSVersion)
|
||||
js::VersionSetMoarXML(JSVersion version, bool enable)
|
||||
{
|
||||
return enable ? JSVersion(uint32_t(version) | VersionFlags::MOAR_XML)
|
||||
: JSVersion(uint32_t(version) & ~VersionFlags::MOAR_XML);
|
||||
}
|
||||
|
||||
JS_FRIEND_API(bool)
|
||||
js::CanCallContextDebugHandler(JSContext *cx)
|
||||
{
|
||||
|
@ -50,9 +50,6 @@ JS_NewObjectWithUniqueType(JSContext *cx, JSClass *clasp, JSObject *proto, JSObj
|
||||
extern JS_FRIEND_API(uint32_t)
|
||||
JS_ObjectCountDynamicSlots(JSHandleObject obj);
|
||||
|
||||
extern JS_FRIEND_API(size_t)
|
||||
JS_GetE4XObjectsCreated(JSContext *cx);
|
||||
|
||||
extern JS_FRIEND_API(size_t)
|
||||
JS_SetProtoCalled(JSContext *cx);
|
||||
|
||||
@ -355,17 +352,12 @@ struct Atom {
|
||||
|
||||
} /* namespace shadow */
|
||||
|
||||
extern JS_FRIEND_DATA(js::Class) AnyNameClass;
|
||||
extern JS_FRIEND_DATA(js::Class) AttributeNameClass;
|
||||
extern JS_FRIEND_DATA(js::Class) CallClass;
|
||||
extern JS_FRIEND_DATA(js::Class) DeclEnvClass;
|
||||
extern JS_FRIEND_DATA(js::Class) FunctionClass;
|
||||
extern JS_FRIEND_DATA(js::Class) FunctionProxyClass;
|
||||
extern JS_FRIEND_DATA(js::Class) NamespaceClass;
|
||||
extern JS_FRIEND_DATA(js::Class) OuterWindowProxyClass;
|
||||
extern JS_FRIEND_DATA(js::Class) ObjectProxyClass;
|
||||
extern JS_FRIEND_DATA(js::Class) QNameClass;
|
||||
extern JS_FRIEND_DATA(js::Class) XMLClass;
|
||||
extern JS_FRIEND_DATA(js::Class) ObjectClass;
|
||||
|
||||
inline js::Class *
|
||||
@ -712,9 +704,6 @@ SetActivityCallback(JSRuntime *rt, ActivityCallback cb, void *arg);
|
||||
extern JS_FRIEND_API(const JSStructuredCloneCallbacks *)
|
||||
GetContextStructuredCloneCallbacks(JSContext *cx);
|
||||
|
||||
extern JS_FRIEND_API(JSVersion)
|
||||
VersionSetMoarXML(JSVersion version, bool enable);
|
||||
|
||||
extern JS_FRIEND_API(bool)
|
||||
CanCallContextDebugHandler(JSContext *cx);
|
||||
|
||||
@ -1362,7 +1351,7 @@ IdToValue(jsid id)
|
||||
return Int32Value(JSID_TO_INT(id));
|
||||
if (JS_LIKELY(JSID_IS_OBJECT(id)))
|
||||
return ObjectValue(*JSID_TO_OBJECT(id));
|
||||
JS_ASSERT(JSID_IS_DEFAULT_XML_NAMESPACE(id) || JSID_IS_VOID(id));
|
||||
JS_ASSERT(JSID_IS_VOID(id));
|
||||
return UndefinedValue();
|
||||
}
|
||||
|
||||
|
@ -68,9 +68,6 @@
|
||||
#include "jsscript.h"
|
||||
#include "jswatchpoint.h"
|
||||
#include "jsweakmap.h"
|
||||
#if JS_HAS_XML_SUPPORT
|
||||
#include "jsxml.h"
|
||||
#endif
|
||||
|
||||
#include "builtin/MapObject.h"
|
||||
#include "frontend/Parser.h"
|
||||
@ -148,9 +145,6 @@ const uint32_t Arena::ThingSizes[] = {
|
||||
sizeof(Shape), /* FINALIZE_SHAPE */
|
||||
sizeof(BaseShape), /* FINALIZE_BASE_SHAPE */
|
||||
sizeof(types::TypeObject), /* FINALIZE_TYPE_OBJECT */
|
||||
#if JS_HAS_XML_SUPPORT
|
||||
sizeof(JSXML), /* FINALIZE_XML */
|
||||
#endif
|
||||
sizeof(JSShortString), /* FINALIZE_SHORT_STRING */
|
||||
sizeof(JSString), /* FINALIZE_STRING */
|
||||
sizeof(JSExternalString), /* FINALIZE_EXTERNAL_STRING */
|
||||
@ -176,9 +170,6 @@ const uint32_t Arena::FirstThingOffsets[] = {
|
||||
OFFSET(Shape), /* FINALIZE_SHAPE */
|
||||
OFFSET(BaseShape), /* FINALIZE_BASE_SHAPE */
|
||||
OFFSET(types::TypeObject), /* FINALIZE_TYPE_OBJECT */
|
||||
#if JS_HAS_XML_SUPPORT
|
||||
OFFSET(JSXML), /* FINALIZE_XML */
|
||||
#endif
|
||||
OFFSET(JSShortString), /* FINALIZE_SHORT_STRING */
|
||||
OFFSET(JSString), /* FINALIZE_STRING */
|
||||
OFFSET(JSExternalString), /* FINALIZE_EXTERNAL_STRING */
|
||||
@ -464,10 +455,6 @@ FinalizeArenas(FreeOp *fop,
|
||||
return FinalizeTypedArenas<BaseShape>(fop, src, dest, thingKind, budget);
|
||||
case FINALIZE_TYPE_OBJECT:
|
||||
return FinalizeTypedArenas<types::TypeObject>(fop, src, dest, thingKind, budget);
|
||||
#if JS_HAS_XML_SUPPORT
|
||||
case FINALIZE_XML:
|
||||
return FinalizeTypedArenas<JSXML>(fop, src, dest, thingKind, budget);
|
||||
#endif
|
||||
case FINALIZE_STRING:
|
||||
return FinalizeTypedArenas<JSString>(fop, src, dest, thingKind, budget);
|
||||
case FINALIZE_SHORT_STRING:
|
||||
@ -933,8 +920,8 @@ InitGCZeal(JSRuntime *rt)
|
||||
" 3: GC when the window paints (browser only)\n"
|
||||
" 4: Verify pre write barriers between instructions\n"
|
||||
" 5: Verify pre write barriers between paints\n"
|
||||
" 6: Verify stack rooting (ignoring XML)\n"
|
||||
" 7: Verify stack rooting (all roots)\n"
|
||||
" 6: Verify stack rooting\n"
|
||||
" 7: Verify stack rooting (yes, it's the same as 6)\n"
|
||||
" 8: Incremental GC in two slices: 1) mark roots 2) finish collection\n"
|
||||
" 9: Incremental GC in two slices: 1) mark all 2) new marking and finish\n"
|
||||
" 10: Incremental GC in multiple slices\n"
|
||||
@ -1446,10 +1433,6 @@ ArenaLists::queueObjectsForSweep(FreeOp *fop)
|
||||
queueForBackgroundSweep(fop, FINALIZE_OBJECT8_BACKGROUND);
|
||||
queueForBackgroundSweep(fop, FINALIZE_OBJECT12_BACKGROUND);
|
||||
queueForBackgroundSweep(fop, FINALIZE_OBJECT16_BACKGROUND);
|
||||
|
||||
#if JS_HAS_XML_SUPPORT
|
||||
finalizeNow(fop, FINALIZE_XML);
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
@ -4926,16 +4909,3 @@ AutoMaybeTouchDeadCompartments::~AutoMaybeTouchDeadCompartments()
|
||||
|
||||
runtime->gcManipulatingDeadCompartments = manipulatingDeadCompartments;
|
||||
}
|
||||
|
||||
#if JS_HAS_XML_SUPPORT
|
||||
extern size_t sE4XObjectsCreated;
|
||||
|
||||
JSXML *
|
||||
js_NewGCXML(JSContext *cx)
|
||||
{
|
||||
if (!cx->runningWithTrustedPrincipals())
|
||||
++sE4XObjectsCreated;
|
||||
|
||||
return NewGCThing<JSXML, CanGC>(cx, js::gc::FINALIZE_XML, sizeof(JSXML));
|
||||
}
|
||||
#endif
|
||||
|
@ -108,9 +108,6 @@ MapAllocToTraceKind(AllocKind kind)
|
||||
JSTRACE_SHAPE, /* FINALIZE_SHAPE */
|
||||
JSTRACE_BASE_SHAPE, /* FINALIZE_BASE_SHAPE */
|
||||
JSTRACE_TYPE_OBJECT,/* FINALIZE_TYPE_OBJECT */
|
||||
#if JS_HAS_XML_SUPPORT /* FINALIZE_XML */
|
||||
JSTRACE_XML,
|
||||
#endif
|
||||
JSTRACE_STRING, /* FINALIZE_SHORT_STRING */
|
||||
JSTRACE_STRING, /* FINALIZE_STRING */
|
||||
JSTRACE_STRING, /* FINALIZE_EXTERNAL_STRING */
|
||||
@ -142,9 +139,6 @@ IsNurseryAllocable(AllocKind kind)
|
||||
false, /* FINALIZE_SHAPE */
|
||||
false, /* FINALIZE_BASE_SHAPE */
|
||||
false, /* FINALIZE_TYPE_OBJECT */
|
||||
#if JS_HAS_XML_SUPPORT
|
||||
false, /* FINALIZE_XML */
|
||||
#endif
|
||||
true, /* FINALIZE_SHORT_STRING */
|
||||
true, /* FINALIZE_STRING */
|
||||
false, /* FINALIZE_EXTERNAL_STRING */
|
||||
@ -176,9 +170,6 @@ IsBackgroundFinalized(AllocKind kind)
|
||||
false, /* FINALIZE_SHAPE */
|
||||
false, /* FINALIZE_BASE_SHAPE */
|
||||
false, /* FINALIZE_TYPE_OBJECT */
|
||||
#if JS_HAS_XML_SUPPORT
|
||||
false, /* FINALIZE_XML */
|
||||
#endif
|
||||
true, /* FINALIZE_SHORT_STRING */
|
||||
true, /* FINALIZE_STRING */
|
||||
false, /* FINALIZE_EXTERNAL_STRING */
|
||||
@ -1004,13 +995,6 @@ struct GCMarker : public JSTracer {
|
||||
pushTaggedPtr(TypeTag, type);
|
||||
}
|
||||
|
||||
#if JS_HAS_XML_SUPPORT
|
||||
void pushXML(JSXML *xml) {
|
||||
pushTaggedPtr(XmlTag, xml);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
void pushIonCode(ion::IonCode *code) {
|
||||
pushTaggedPtr(IonCodeTag, code);
|
||||
}
|
||||
@ -1115,7 +1099,7 @@ struct GCMarker : public JSTracer {
|
||||
|
||||
void appendGrayRoot(void *thing, JSGCTraceKind kind);
|
||||
|
||||
/* The color is only applied to objects, functions and xml. */
|
||||
/* The color is only applied to objects and functions. */
|
||||
uint32_t color;
|
||||
|
||||
mozilla::DebugOnly<bool> started;
|
||||
@ -1197,8 +1181,10 @@ const int ZealAllocValue = 2;
|
||||
const int ZealFrameGCValue = 3;
|
||||
const int ZealVerifierPreValue = 4;
|
||||
const int ZealFrameVerifierPreValue = 5;
|
||||
const int ZealStackRootingSafeValue = 6;
|
||||
const int ZealStackRootingValue = 7;
|
||||
// These two values used to be distinct. They no longer are, but both were
|
||||
// kept to avoid breaking fuzz tests. Avoid using ZealStackRootingValue__2.
|
||||
const int ZealStackRootingValue = 6;
|
||||
const int ZealStackRootingValue__2 = 7;
|
||||
const int ZealIncrementalRootsThenFinish = 8;
|
||||
const int ZealIncrementalMarkAllThenFinish = 9;
|
||||
const int ZealIncrementalMultipleSlices = 10;
|
||||
|
@ -11,7 +11,6 @@
|
||||
#include "jscntxt.h"
|
||||
#include "jscompartment.h"
|
||||
#include "jslock.h"
|
||||
#include "jsxml.h"
|
||||
|
||||
#include "gc/Root.h"
|
||||
#include "js/TemplateLib.h"
|
||||
@ -604,9 +603,4 @@ js_NewGCBaseShape(JSContext *cx)
|
||||
return js::gc::NewGCThing<js::BaseShape, allowGC>(cx, js::gc::FINALIZE_BASE_SHAPE, sizeof(js::BaseShape));
|
||||
}
|
||||
|
||||
#if JS_HAS_XML_SUPPORT
|
||||
extern JSXML *
|
||||
js_NewGCXML(JSContext *cx);
|
||||
#endif
|
||||
|
||||
#endif /* jsgcinlines_h___ */
|
||||
|
@ -45,10 +45,6 @@
|
||||
|
||||
#include "vm/Stack-inl.h"
|
||||
|
||||
#ifdef JS_HAS_XML_SUPPORT
|
||||
#include "jsxml.h"
|
||||
#endif
|
||||
|
||||
#ifdef __SUNPRO_CC
|
||||
#include <alloca.h>
|
||||
#endif
|
||||
@ -3991,9 +3987,6 @@ ScriptAnalysis::analyzeTypesBytecode(JSContext *cx, unsigned offset, TypeInferen
|
||||
case JSOP_CONDSWITCH:
|
||||
case JSOP_DEFAULT:
|
||||
case JSOP_POPN:
|
||||
case JSOP_STARTXML:
|
||||
case JSOP_STARTXMLEXPR:
|
||||
case JSOP_DEFXMLNS:
|
||||
case JSOP_POPV:
|
||||
case JSOP_DEBUGGER:
|
||||
case JSOP_SETCALL:
|
||||
@ -4035,7 +4028,6 @@ ScriptAnalysis::analyzeTypesBytecode(JSContext *cx, unsigned offset, TypeInferen
|
||||
case JSOP_STRICTNE:
|
||||
case JSOP_IN:
|
||||
case JSOP_INSTANCEOF:
|
||||
case JSOP_DELDESC:
|
||||
pushed[0].addType(cx, Type::BooleanType());
|
||||
break;
|
||||
case JSOP_DOUBLE:
|
||||
@ -4044,12 +4036,6 @@ ScriptAnalysis::analyzeTypesBytecode(JSContext *cx, unsigned offset, TypeInferen
|
||||
case JSOP_STRING:
|
||||
case JSOP_TYPEOF:
|
||||
case JSOP_TYPEOFEXPR:
|
||||
case JSOP_QNAMEPART:
|
||||
case JSOP_XMLTAGEXPR:
|
||||
case JSOP_TOATTRVAL:
|
||||
case JSOP_ADDATTRNAME:
|
||||
case JSOP_ADDATTRVAL:
|
||||
case JSOP_XMLELTEXPR:
|
||||
pushed[0].addType(cx, Type::StringType());
|
||||
break;
|
||||
case JSOP_NULL:
|
||||
@ -4639,39 +4625,6 @@ ScriptAnalysis::analyzeTypesBytecode(JSContext *cx, unsigned offset, TypeInferen
|
||||
pushed[0].addType(cx, Type::UnknownType());
|
||||
break;
|
||||
|
||||
case JSOP_CALLXMLNAME:
|
||||
pushed[1].addType(cx, Type::UnknownType());
|
||||
/* FALLTHROUGH */
|
||||
|
||||
case JSOP_XMLNAME:
|
||||
pushed[0].addType(cx, Type::UnknownType());
|
||||
break;
|
||||
|
||||
case JSOP_SETXMLNAME:
|
||||
cx->compartment->types.monitorBytecode(cx, script, offset);
|
||||
poppedTypes(pc, 0)->addSubset(cx, &pushed[0]);
|
||||
break;
|
||||
|
||||
case JSOP_BINDXMLNAME:
|
||||
break;
|
||||
|
||||
case JSOP_TOXML:
|
||||
case JSOP_TOXMLLIST:
|
||||
case JSOP_XMLPI:
|
||||
case JSOP_XMLCDATA:
|
||||
case JSOP_XMLCOMMENT:
|
||||
case JSOP_DESCENDANTS:
|
||||
case JSOP_TOATTRNAME:
|
||||
case JSOP_QNAMECONST:
|
||||
case JSOP_QNAME:
|
||||
case JSOP_ANYNAME:
|
||||
case JSOP_GETFUNNS:
|
||||
case JSOP_FILTER:
|
||||
/* Note: the second value pushed by filter is a hole, and not modelled. */
|
||||
case JSOP_ENDFILTER:
|
||||
pushed[0].addType(cx, Type::UnknownType());
|
||||
break;
|
||||
|
||||
case JSOP_CALLEE:
|
||||
pushed[0].addType(cx, Type::AnyObjectType());
|
||||
break;
|
||||
@ -5719,7 +5672,6 @@ IgnorePushed(const jsbytecode *pc, unsigned index)
|
||||
case JSOP_BINDNAME:
|
||||
case JSOP_BINDGNAME:
|
||||
case JSOP_BINDINTRINSIC:
|
||||
case JSOP_BINDXMLNAME:
|
||||
return true;
|
||||
|
||||
/* Stack not consistent in TRY_BRANCH_AFTER_COND. */
|
||||
@ -5740,8 +5692,6 @@ IgnorePushed(const jsbytecode *pc, unsigned index)
|
||||
/* Holes tracked separately. */
|
||||
case JSOP_HOLE:
|
||||
return (index == 0);
|
||||
case JSOP_FILTER:
|
||||
return (index == 1);
|
||||
|
||||
/* Storage for 'with' and 'let' blocks not monitored. */
|
||||
case JSOP_ENTERWITH:
|
||||
@ -6066,15 +6016,6 @@ JSObject::makeLazyType(JSContext *cx)
|
||||
if (self->lastProperty()->hasObjectFlag(BaseShape::ITERATED_SINGLETON))
|
||||
type->flags |= OBJECT_FLAG_ITERATED;
|
||||
|
||||
#if JS_HAS_XML_SUPPORT
|
||||
/*
|
||||
* XML objects do not have equality hooks but are treated special by EQ/NE
|
||||
* ops. Just mark the type as totally unknown.
|
||||
*/
|
||||
if (self->isXML() && !type->unknownProperties())
|
||||
type->markUnknown(cx);
|
||||
#endif
|
||||
|
||||
if (self->getClass()->ext.equality)
|
||||
type->flags |= OBJECT_FLAG_SPECIAL_EQUALITY;
|
||||
if (self->getClass()->emulatesUndefined())
|
||||
@ -6215,12 +6156,6 @@ JSCompartment::getNewType(JSContext *cx, Class *clasp, TaggedProto proto_, JSFun
|
||||
if (fun)
|
||||
CheckNewScriptProperties(cx, type, fun);
|
||||
|
||||
#if JS_HAS_XML_SUPPORT
|
||||
/* Special case for XML object equality, see makeLazyType(). */
|
||||
if (obj->isXML() && !type->unknownProperties())
|
||||
type->flags |= OBJECT_FLAG_UNKNOWN_MASK;
|
||||
#endif
|
||||
|
||||
if (obj->isRegExp()) {
|
||||
AddTypeProperty(cx, type, "source", types::Type::StringType());
|
||||
AddTypeProperty(cx, type, "global", types::Type::BooleanType());
|
||||
|
@ -66,10 +66,6 @@
|
||||
#include "vm/Stack-inl.h"
|
||||
#include "vm/String-inl.h"
|
||||
|
||||
#if JS_HAS_XML_SUPPORT
|
||||
#include "jsxml.h"
|
||||
#endif
|
||||
|
||||
#include "jsautooplen.h"
|
||||
|
||||
#if defined(JS_METHODJIT) && defined(JS_MONOIC)
|
||||
@ -205,15 +201,6 @@ js::OnUnknownMethod(JSContext *cx, HandleObject obj, Value idval_, MutableHandle
|
||||
if (value.get().isPrimitive()) {
|
||||
vp.set(value);
|
||||
} else {
|
||||
#if JS_HAS_XML_SUPPORT
|
||||
/* Extract the function name from function::name qname. */
|
||||
if (idval.get().isObject()) {
|
||||
JSObject *obj = &idval.get().toObject();
|
||||
if (js_GetLocalNameFromFunctionQName(obj, id.address(), cx))
|
||||
idval = IdToValue(id);
|
||||
}
|
||||
#endif
|
||||
|
||||
JSObject *obj = NewObjectWithClassProto(cx, &js_NoSuchMethodClass, NULL, NULL);
|
||||
if (!obj)
|
||||
return false;
|
||||
@ -592,17 +579,6 @@ js::HasInstance(JSContext *cx, HandleObject obj, HandleValue v, JSBool *bp)
|
||||
bool
|
||||
js::LooselyEqual(JSContext *cx, const Value &lval, const Value &rval, bool *result)
|
||||
{
|
||||
#if JS_HAS_XML_SUPPORT
|
||||
if (JS_UNLIKELY(lval.isObject() && lval.toObject().isXML()) ||
|
||||
(rval.isObject() && rval.toObject().isXML())) {
|
||||
JSBool res;
|
||||
if (!js_TestXMLEquality(cx, lval, rval, &res))
|
||||
return false;
|
||||
*result = !!res;
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (SameType(lval, rval)) {
|
||||
if (lval.isString()) {
|
||||
JSString *l = lval.toString();
|
||||
@ -966,7 +942,6 @@ js::AssertValidPropertyCacheHit(JSContext *cx, JSObject *start,
|
||||
JS_STATIC_ASSERT(JSOP_NAME_LENGTH == JSOP_CALLNAME_LENGTH);
|
||||
JS_STATIC_ASSERT(JSOP_GETARG_LENGTH == JSOP_CALLARG_LENGTH);
|
||||
JS_STATIC_ASSERT(JSOP_GETLOCAL_LENGTH == JSOP_CALLLOCAL_LENGTH);
|
||||
JS_STATIC_ASSERT(JSOP_XMLNAME_LENGTH == JSOP_CALLXMLNAME_LENGTH);
|
||||
|
||||
/*
|
||||
* Same for JSOP_SETNAME and JSOP_SETPROP, which differ only slightly but
|
||||
@ -1346,6 +1321,29 @@ ADD_EMPTY_CASE(JSOP_UNUSED107)
|
||||
ADD_EMPTY_CASE(JSOP_UNUSED132)
|
||||
ADD_EMPTY_CASE(JSOP_UNUSED147)
|
||||
ADD_EMPTY_CASE(JSOP_UNUSED148)
|
||||
ADD_EMPTY_CASE(JSOP_UNUSED161)
|
||||
ADD_EMPTY_CASE(JSOP_UNUSED162)
|
||||
ADD_EMPTY_CASE(JSOP_UNUSED163)
|
||||
ADD_EMPTY_CASE(JSOP_UNUSED164)
|
||||
ADD_EMPTY_CASE(JSOP_UNUSED165)
|
||||
ADD_EMPTY_CASE(JSOP_UNUSED166)
|
||||
ADD_EMPTY_CASE(JSOP_UNUSED167)
|
||||
ADD_EMPTY_CASE(JSOP_UNUSED168)
|
||||
ADD_EMPTY_CASE(JSOP_UNUSED169)
|
||||
ADD_EMPTY_CASE(JSOP_UNUSED170)
|
||||
ADD_EMPTY_CASE(JSOP_UNUSED171)
|
||||
ADD_EMPTY_CASE(JSOP_UNUSED172)
|
||||
ADD_EMPTY_CASE(JSOP_UNUSED173)
|
||||
ADD_EMPTY_CASE(JSOP_UNUSED174)
|
||||
ADD_EMPTY_CASE(JSOP_UNUSED175)
|
||||
ADD_EMPTY_CASE(JSOP_UNUSED176)
|
||||
ADD_EMPTY_CASE(JSOP_UNUSED177)
|
||||
ADD_EMPTY_CASE(JSOP_UNUSED178)
|
||||
ADD_EMPTY_CASE(JSOP_UNUSED179)
|
||||
ADD_EMPTY_CASE(JSOP_UNUSED180)
|
||||
ADD_EMPTY_CASE(JSOP_UNUSED181)
|
||||
ADD_EMPTY_CASE(JSOP_UNUSED182)
|
||||
ADD_EMPTY_CASE(JSOP_UNUSED183)
|
||||
ADD_EMPTY_CASE(JSOP_UNUSED188)
|
||||
ADD_EMPTY_CASE(JSOP_UNUSED189)
|
||||
ADD_EMPTY_CASE(JSOP_UNUSED190)
|
||||
@ -1361,10 +1359,6 @@ ADD_EMPTY_CASE(JSOP_UNUSED222)
|
||||
ADD_EMPTY_CASE(JSOP_UNUSED223)
|
||||
ADD_EMPTY_CASE(JSOP_CONDSWITCH)
|
||||
ADD_EMPTY_CASE(JSOP_TRY)
|
||||
#if JS_HAS_XML_SUPPORT
|
||||
ADD_EMPTY_CASE(JSOP_STARTXML)
|
||||
ADD_EMPTY_CASE(JSOP_STARTXMLEXPR)
|
||||
#endif
|
||||
END_EMPTY_CASES
|
||||
|
||||
BEGIN_CASE(JSOP_LOOPHEAD)
|
||||
@ -1616,12 +1610,6 @@ BEGIN_CASE(JSOP_AND)
|
||||
}
|
||||
END_CASE(JSOP_AND)
|
||||
|
||||
/*
|
||||
* If the index value at sp[n] is not an int that fits in a jsval, it could
|
||||
* be an object (an XML QName, AttributeName, or AnyName), but only if we are
|
||||
* compiling with JS_HAS_XML_SUPPORT. Otherwise convert the index value to a
|
||||
* string atom id.
|
||||
*/
|
||||
#define FETCH_ELEMENT_ID(obj, n, id) \
|
||||
JS_BEGIN_MACRO \
|
||||
const Value &idval_ = regs.sp[n]; \
|
||||
@ -2139,10 +2127,9 @@ END_CASE(JSOP_DELELEM)
|
||||
BEGIN_CASE(JSOP_TOID)
|
||||
{
|
||||
/*
|
||||
* Increment or decrement requires use to lookup the same property twice, but we need to avoid
|
||||
* the oberservable stringification the second time.
|
||||
* There must be an object value below the id, which will not be popped
|
||||
* but is necessary in interning the id for XML.
|
||||
* Increment or decrement requires use to lookup the same property twice,
|
||||
* but we need to avoid the observable stringification the second time.
|
||||
* There must be an object value below the id, which will not be popped.
|
||||
*/
|
||||
RootedValue &objval = rootValue0, &idval = rootValue1;
|
||||
objval = regs.sp[-2];
|
||||
@ -3126,339 +3113,6 @@ BEGIN_CASE(JSOP_DEBUGGER)
|
||||
}
|
||||
END_CASE(JSOP_DEBUGGER)
|
||||
|
||||
#if JS_HAS_XML_SUPPORT
|
||||
BEGIN_CASE(JSOP_DEFXMLNS)
|
||||
{
|
||||
JS_ASSERT(!script->strict);
|
||||
|
||||
if (!js_SetDefaultXMLNamespace(cx, regs.sp[-1]))
|
||||
goto error;
|
||||
regs.sp--;
|
||||
}
|
||||
END_CASE(JSOP_DEFXMLNS)
|
||||
|
||||
BEGIN_CASE(JSOP_ANYNAME)
|
||||
{
|
||||
JS_ASSERT(!script->strict);
|
||||
|
||||
cx->runtime->gcExactScanningEnabled = false;
|
||||
|
||||
jsid id;
|
||||
if (!js_GetAnyName(cx, &id))
|
||||
goto error;
|
||||
PUSH_COPY(IdToValue(id));
|
||||
}
|
||||
END_CASE(JSOP_ANYNAME)
|
||||
#endif
|
||||
|
||||
BEGIN_CASE(JSOP_QNAMEPART)
|
||||
/*
|
||||
* We do not JS_ASSERT(!script->strict) here because JSOP_QNAMEPART
|
||||
* is used for __proto__ and (in contexts where we favor JSOP_*ELEM instead
|
||||
* of JSOP_*PROP) obj.prop compiled as obj['prop'].
|
||||
*/
|
||||
PUSH_STRING(script->getAtom(regs.pc));
|
||||
END_CASE(JSOP_QNAMEPART)
|
||||
|
||||
#if JS_HAS_XML_SUPPORT
|
||||
BEGIN_CASE(JSOP_QNAMECONST)
|
||||
{
|
||||
JS_ASSERT(!script->strict);
|
||||
Value rval = StringValue(script->getAtom(regs.pc));
|
||||
Value lval = regs.sp[-1];
|
||||
JSObject *obj = js_ConstructXMLQNameObject(cx, lval, rval);
|
||||
if (!obj)
|
||||
goto error;
|
||||
regs.sp[-1].setObject(*obj);
|
||||
}
|
||||
END_CASE(JSOP_QNAMECONST)
|
||||
|
||||
BEGIN_CASE(JSOP_QNAME)
|
||||
{
|
||||
JS_ASSERT(!script->strict);
|
||||
|
||||
Value rval = regs.sp[-1];
|
||||
Value lval = regs.sp[-2];
|
||||
JSObject *obj = js_ConstructXMLQNameObject(cx, lval, rval);
|
||||
if (!obj)
|
||||
goto error;
|
||||
regs.sp--;
|
||||
regs.sp[-1].setObject(*obj);
|
||||
}
|
||||
END_CASE(JSOP_QNAME)
|
||||
|
||||
BEGIN_CASE(JSOP_TOATTRNAME)
|
||||
{
|
||||
JS_ASSERT(!script->strict);
|
||||
|
||||
Value rval;
|
||||
rval = regs.sp[-1];
|
||||
if (!js_ToAttributeName(cx, &rval))
|
||||
goto error;
|
||||
regs.sp[-1] = rval;
|
||||
}
|
||||
END_CASE(JSOP_TOATTRNAME)
|
||||
|
||||
BEGIN_CASE(JSOP_TOATTRVAL)
|
||||
{
|
||||
JS_ASSERT(!script->strict);
|
||||
|
||||
Value rval;
|
||||
rval = regs.sp[-1];
|
||||
JS_ASSERT(rval.isString());
|
||||
JSString *str = js_EscapeAttributeValue(cx, rval.toString(), JS_FALSE);
|
||||
if (!str)
|
||||
goto error;
|
||||
regs.sp[-1].setString(str);
|
||||
}
|
||||
END_CASE(JSOP_TOATTRVAL)
|
||||
|
||||
BEGIN_CASE(JSOP_ADDATTRNAME)
|
||||
BEGIN_CASE(JSOP_ADDATTRVAL)
|
||||
{
|
||||
JS_ASSERT(!script->strict);
|
||||
|
||||
Value rval = regs.sp[-1];
|
||||
Value lval = regs.sp[-2];
|
||||
JSString *str = lval.toString();
|
||||
JSString *str2 = rval.toString();
|
||||
str = js_AddAttributePart(cx, op == JSOP_ADDATTRNAME, str, str2);
|
||||
if (!str)
|
||||
goto error;
|
||||
regs.sp--;
|
||||
regs.sp[-1].setString(str);
|
||||
}
|
||||
END_CASE(JSOP_ADDATTRNAME)
|
||||
|
||||
BEGIN_CASE(JSOP_BINDXMLNAME)
|
||||
{
|
||||
JS_ASSERT(!script->strict);
|
||||
|
||||
Value lval;
|
||||
lval = regs.sp[-1];
|
||||
RootedObject &obj = rootObject0;
|
||||
jsid id;
|
||||
if (!js_FindXMLProperty(cx, lval, &obj, &id))
|
||||
goto error;
|
||||
regs.sp[-1].setObjectOrNull(obj);
|
||||
PUSH_COPY(IdToValue(id));
|
||||
}
|
||||
END_CASE(JSOP_BINDXMLNAME)
|
||||
|
||||
BEGIN_CASE(JSOP_SETXMLNAME)
|
||||
{
|
||||
JS_ASSERT(!script->strict);
|
||||
|
||||
RootedObject &obj = rootObject0;
|
||||
obj = ®s.sp[-3].toObject();
|
||||
RootedValue &rval = rootValue0;
|
||||
rval = regs.sp[-1];
|
||||
RootedId &id = rootId0;
|
||||
FETCH_ELEMENT_ID(obj, -2, id);
|
||||
if (!JSObject::setGeneric(cx, obj, obj, id, &rval, script->strict))
|
||||
goto error;
|
||||
rval = regs.sp[-1];
|
||||
regs.sp -= 2;
|
||||
regs.sp[-1] = rval;
|
||||
}
|
||||
END_CASE(JSOP_SETXMLNAME)
|
||||
|
||||
BEGIN_CASE(JSOP_CALLXMLNAME)
|
||||
BEGIN_CASE(JSOP_XMLNAME)
|
||||
{
|
||||
JS_ASSERT(!script->strict);
|
||||
|
||||
Value lval = regs.sp[-1];
|
||||
RootedObject &obj = rootObject0;
|
||||
RootedId &id = rootId0;
|
||||
if (!js_FindXMLProperty(cx, lval, &obj, id.address()))
|
||||
goto error;
|
||||
RootedValue &rval = rootValue0;
|
||||
if (!JSObject::getGeneric(cx, obj, obj, id, &rval))
|
||||
goto error;
|
||||
regs.sp[-1] = rval;
|
||||
if (op == JSOP_CALLXMLNAME) {
|
||||
Value v;
|
||||
if (!ComputeImplicitThis(cx, obj, &v))
|
||||
goto error;
|
||||
PUSH_COPY(v);
|
||||
}
|
||||
}
|
||||
END_CASE(JSOP_XMLNAME)
|
||||
|
||||
BEGIN_CASE(JSOP_DESCENDANTS)
|
||||
BEGIN_CASE(JSOP_DELDESC)
|
||||
{
|
||||
JS_ASSERT(!script->strict);
|
||||
|
||||
JSObject *obj;
|
||||
FETCH_OBJECT(cx, -2, obj);
|
||||
jsval rval = regs.sp[-1];
|
||||
if (!js_GetXMLDescendants(cx, obj, rval, &rval))
|
||||
goto error;
|
||||
|
||||
if (op == JSOP_DELDESC) {
|
||||
regs.sp[-1] = rval; /* set local root */
|
||||
if (!js_DeleteXMLListElements(cx, JSVAL_TO_OBJECT(rval)))
|
||||
goto error;
|
||||
rval = JSVAL_TRUE; /* always succeed */
|
||||
}
|
||||
|
||||
regs.sp--;
|
||||
regs.sp[-1] = rval;
|
||||
}
|
||||
END_CASE(JSOP_DESCENDANTS)
|
||||
|
||||
BEGIN_CASE(JSOP_FILTER)
|
||||
{
|
||||
JS_ASSERT(!script->strict);
|
||||
|
||||
/*
|
||||
* We push the hole value before jumping to [enditer] so we can detect the
|
||||
* first iteration and direct js_StepXMLListFilter to initialize filter's
|
||||
* state.
|
||||
*/
|
||||
PUSH_HOLE();
|
||||
len = GET_JUMP_OFFSET(regs.pc);
|
||||
JS_ASSERT(len > 0);
|
||||
}
|
||||
END_VARLEN_CASE
|
||||
|
||||
BEGIN_CASE(JSOP_ENDFILTER)
|
||||
{
|
||||
JS_ASSERT(!script->strict);
|
||||
|
||||
bool cond = !regs.sp[-1].isMagic();
|
||||
if (cond) {
|
||||
/* Exit the "with" block left from the previous iteration. */
|
||||
regs.fp()->popWith(cx);
|
||||
}
|
||||
if (!js_StepXMLListFilter(cx, cond))
|
||||
goto error;
|
||||
if (!regs.sp[-1].isNull()) {
|
||||
/*
|
||||
* Decrease sp after EnterWith returns as we use sp[-1] there to root
|
||||
* temporaries.
|
||||
*/
|
||||
JS_ASSERT(IsXML(regs.sp[-1]));
|
||||
if (!EnterWith(cx, -2))
|
||||
goto error;
|
||||
regs.sp--;
|
||||
len = GET_JUMP_OFFSET(regs.pc);
|
||||
JS_ASSERT(len < 0);
|
||||
BRANCH(len);
|
||||
}
|
||||
regs.sp--;
|
||||
}
|
||||
END_CASE(JSOP_ENDFILTER);
|
||||
|
||||
BEGIN_CASE(JSOP_TOXML)
|
||||
{
|
||||
JS_ASSERT(!script->strict);
|
||||
|
||||
cx->runtime->gcExactScanningEnabled = false;
|
||||
|
||||
Value rval = regs.sp[-1];
|
||||
JSObject *obj = js_ValueToXMLObject(cx, rval);
|
||||
if (!obj)
|
||||
goto error;
|
||||
regs.sp[-1].setObject(*obj);
|
||||
}
|
||||
END_CASE(JSOP_TOXML)
|
||||
|
||||
BEGIN_CASE(JSOP_TOXMLLIST)
|
||||
{
|
||||
JS_ASSERT(!script->strict);
|
||||
|
||||
Value rval = regs.sp[-1];
|
||||
JSObject *obj = js_ValueToXMLListObject(cx, rval);
|
||||
if (!obj)
|
||||
goto error;
|
||||
regs.sp[-1].setObject(*obj);
|
||||
}
|
||||
END_CASE(JSOP_TOXMLLIST)
|
||||
|
||||
BEGIN_CASE(JSOP_XMLTAGEXPR)
|
||||
{
|
||||
JS_ASSERT(!script->strict);
|
||||
|
||||
Value rval = regs.sp[-1];
|
||||
JSString *str = ToString<CanGC>(cx, rval);
|
||||
if (!str)
|
||||
goto error;
|
||||
regs.sp[-1].setString(str);
|
||||
}
|
||||
END_CASE(JSOP_XMLTAGEXPR)
|
||||
|
||||
BEGIN_CASE(JSOP_XMLELTEXPR)
|
||||
{
|
||||
JS_ASSERT(!script->strict);
|
||||
|
||||
Value rval = regs.sp[-1];
|
||||
JSString *str;
|
||||
if (IsXML(rval)) {
|
||||
str = js_ValueToXMLString(cx, rval);
|
||||
} else {
|
||||
str = ToString<CanGC>(cx, rval);
|
||||
if (str)
|
||||
str = js_EscapeElementValue(cx, str);
|
||||
}
|
||||
if (!str)
|
||||
goto error;
|
||||
regs.sp[-1].setString(str);
|
||||
}
|
||||
END_CASE(JSOP_XMLELTEXPR)
|
||||
|
||||
BEGIN_CASE(JSOP_XMLCDATA)
|
||||
{
|
||||
JS_ASSERT(!script->strict);
|
||||
|
||||
JSAtom *atom = script->getAtom(regs.pc);
|
||||
JSObject *obj = js_NewXMLSpecialObject(cx, JSXML_CLASS_TEXT, NULL, atom);
|
||||
if (!obj)
|
||||
goto error;
|
||||
PUSH_OBJECT(*obj);
|
||||
}
|
||||
END_CASE(JSOP_XMLCDATA)
|
||||
|
||||
BEGIN_CASE(JSOP_XMLCOMMENT)
|
||||
{
|
||||
JS_ASSERT(!script->strict);
|
||||
|
||||
JSAtom *atom = script->getAtom(regs.pc);
|
||||
JSObject *obj = js_NewXMLSpecialObject(cx, JSXML_CLASS_COMMENT, NULL, atom);
|
||||
if (!obj)
|
||||
goto error;
|
||||
PUSH_OBJECT(*obj);
|
||||
}
|
||||
END_CASE(JSOP_XMLCOMMENT)
|
||||
|
||||
BEGIN_CASE(JSOP_XMLPI)
|
||||
{
|
||||
JS_ASSERT(!script->strict);
|
||||
|
||||
JSAtom *atom = script->getAtom(regs.pc);
|
||||
Value rval = regs.sp[-1];
|
||||
JSString *str2 = rval.toString();
|
||||
JSObject *obj = js_NewXMLSpecialObject(cx, JSXML_CLASS_PROCESSING_INSTRUCTION, atom, str2);
|
||||
if (!obj)
|
||||
goto error;
|
||||
regs.sp[-1].setObject(*obj);
|
||||
}
|
||||
END_CASE(JSOP_XMLPI)
|
||||
|
||||
BEGIN_CASE(JSOP_GETFUNNS)
|
||||
{
|
||||
JS_ASSERT(!script->strict);
|
||||
|
||||
Value rval;
|
||||
if (!cx->fp()->global().getFunctionNamespace(cx, &rval))
|
||||
goto error;
|
||||
PUSH_COPY(rval);
|
||||
}
|
||||
END_CASE(JSOP_GETFUNNS)
|
||||
#endif /* JS_HAS_XML_SUPPORT */
|
||||
|
||||
BEGIN_CASE(JSOP_ENTERBLOCK)
|
||||
BEGIN_CASE(JSOP_ENTERLET0)
|
||||
BEGIN_CASE(JSOP_ENTERLET1)
|
||||
|
@ -219,21 +219,6 @@ AssertValidPropertyCacheHit(JSContext *cx, JSObject *start, JSObject *found,
|
||||
{}
|
||||
#endif
|
||||
|
||||
inline bool
|
||||
GetPropertyGenericMaybeCallXML(JSContext *cx, JSOp op, HandleObject obj, HandleId id, MutableHandleValue vp)
|
||||
{
|
||||
/*
|
||||
* Various XML properties behave differently when accessed in a
|
||||
* call vs. normal context, and getGeneric will not work right.
|
||||
*/
|
||||
#if JS_HAS_XML_SUPPORT
|
||||
if (op == JSOP_CALLPROP && obj->isXML())
|
||||
return js_GetXMLMethod(cx, obj, id, vp);
|
||||
#endif
|
||||
|
||||
return JSObject::getGeneric(cx, obj, obj, id, vp);
|
||||
}
|
||||
|
||||
inline bool
|
||||
GetLengthProperty(const Value &lval, MutableHandleValue vp)
|
||||
{
|
||||
@ -304,7 +289,7 @@ GetPropertyOperation(JSContext *cx, JSScript *script, jsbytecode *pc, MutableHan
|
||||
RootedObject nobj(cx, obj);
|
||||
|
||||
if (obj->getOps()->getProperty) {
|
||||
if (!GetPropertyGenericMaybeCallXML(cx, op, nobj, id, vp))
|
||||
if (!JSObject::getGeneric(cx, nobj, nobj, id, vp))
|
||||
return false;
|
||||
} else {
|
||||
if (!GetPropertyHelper(cx, nobj, id, JSGET_CACHE_RESULT, vp))
|
||||
@ -577,15 +562,6 @@ AddOperation(JSContext *cx, HandleScript script, jsbytecode *pc,
|
||||
return true;
|
||||
}
|
||||
|
||||
#if JS_HAS_XML_SUPPORT
|
||||
if (IsXML(lhs) && IsXML(rhs)) {
|
||||
if (!js_ConcatenateXML(cx, &lhs.toObject(), &rhs.toObject(), res))
|
||||
return false;
|
||||
types::TypeScript::MonitorUnknown(cx, script, pc);
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* If either operand is an object, any non-integer result must be
|
||||
* reported to inference.
|
||||
@ -767,20 +743,6 @@ GetObjectElementOperation(JSContext *cx, JSOp op, JSObject *objArg, bool wasObje
|
||||
HandleValue rref, MutableHandleValue res)
|
||||
{
|
||||
do {
|
||||
|
||||
#if JS_HAS_XML_SUPPORT
|
||||
if (op == JSOP_CALLELEM && JS_UNLIKELY(objArg->isXML())) {
|
||||
RootedObject obj(cx, objArg);
|
||||
RootedId id(cx);
|
||||
if (!FetchElementId(cx, obj, rref, &id, res))
|
||||
return false;
|
||||
if (!js_GetXMLMethod(cx, obj, id, res))
|
||||
return false;
|
||||
objArg = obj;
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
|
||||
// Don't call GetPcScript (needed for analysis) from inside Ion since it's expensive.
|
||||
bool analyze = !cx->fp()->beginsIonActivation();
|
||||
|
||||
|
@ -30,10 +30,6 @@
|
||||
#include "jsproxy.h"
|
||||
#include "jsscript.h"
|
||||
|
||||
#if JS_HAS_XML_SUPPORT
|
||||
#include "jsxml.h"
|
||||
#endif
|
||||
|
||||
#include "builtin/ParallelArray.h"
|
||||
#include "ds/Sort.h"
|
||||
#include "frontend/TokenStream.h"
|
||||
@ -151,11 +147,8 @@ EnumerateNativeProperties(JSContext *cx, HandleObject pobj, unsigned flags, IdSe
|
||||
for (; !r.empty(); r.popFront()) {
|
||||
Shape &shape = r.front();
|
||||
|
||||
if (!JSID_IS_DEFAULT_XML_NAMESPACE(shape.propid()) &&
|
||||
!Enumerate(cx, pobj, shape.propid(), shape.enumerable(), flags, ht, props))
|
||||
{
|
||||
if (!Enumerate(cx, pobj, shape.propid(), shape.enumerable(), flags, ht, props))
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
::Reverse(props->begin() + initialLength, props->end());
|
||||
@ -264,10 +257,6 @@ Snapshot(JSContext *cx, RawObject pobj_, unsigned flags, AutoIdVector *props)
|
||||
if (flags & JSITER_OWNONLY)
|
||||
break;
|
||||
|
||||
#if JS_HAS_XML_SUPPORT
|
||||
if (pobj->isXML())
|
||||
break;
|
||||
#endif
|
||||
} while ((pobj = pobj->getProto()) != NULL);
|
||||
|
||||
#ifdef JS_MORE_DETERMINISTIC
|
||||
|
@ -64,9 +64,6 @@ CompartmentStats::gcHeapThingsSize()
|
||||
n += gcHeapScripts;
|
||||
n += gcHeapTypeObjects;
|
||||
n += gcHeapIonCodes;
|
||||
#if JS_HAS_XML_SUPPORT
|
||||
n += gcHeapXML;
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG
|
||||
size_t n2 = n;
|
||||
@ -249,13 +246,6 @@ StatsCellCallback(JSRuntime *rt, void *data, void *thing, JSGCTraceKind traceKin
|
||||
cStats->typeInference.typeObjects += obj->sizeOfExcludingThis(rtStats->mallocSizeOf);
|
||||
break;
|
||||
}
|
||||
#if JS_HAS_XML_SUPPORT
|
||||
case JSTRACE_XML:
|
||||
{
|
||||
cStats->gcHeapXML += thingSize;
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
// Yes, this is a subtraction: see StatsArenaCallback() for details.
|
||||
cStats->gcHeapUnusedGcThings -= thingSize;
|
||||
|
@ -42,7 +42,6 @@
|
||||
#include "json.h"
|
||||
#include "jswatchpoint.h"
|
||||
#include "jswrapper.h"
|
||||
#include "jsxml.h"
|
||||
|
||||
#include "builtin/MapObject.h"
|
||||
#include "builtin/Module.h"
|
||||
@ -2174,8 +2173,7 @@ js::DefineConstructorAndPrototype(JSContext *cx, HandleObject obj, JSProtoKey ke
|
||||
/*
|
||||
* Optionally construct the prototype object, before the class has
|
||||
* been fully initialized. Allow the ctor to replace proto with a
|
||||
* different object, as is done for operator new -- and as at least
|
||||
* XML support requires.
|
||||
* different object, as is done for operator new.
|
||||
*/
|
||||
ctor = fun;
|
||||
if (!LinkConstructorAndPrototype(cx, ctor, proto))
|
||||
@ -2791,13 +2789,6 @@ js::SetClassAndProto(JSContext *cx, HandleObject obj,
|
||||
{
|
||||
JS_ASSERT_IF(!checkForCycles, obj.get() != proto.raw());
|
||||
|
||||
#if JS_HAS_XML_SUPPORT
|
||||
if (proto.isObject() && proto.toObject()->isXML()) {
|
||||
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_XML_PROTO_FORBIDDEN);
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Regenerate shapes for all of the scopes along the old prototype chain,
|
||||
* in case any entries were filled by looking up through obj. Stop when a
|
||||
@ -3910,16 +3901,9 @@ js::GetMethod(JSContext *cx, HandleObject obj, HandleId id, unsigned getHow, Mut
|
||||
JSAutoResolveFlags rf(cx, 0);
|
||||
|
||||
GenericIdOp op = obj->getOps()->getGeneric;
|
||||
if (!op) {
|
||||
#if JS_HAS_XML_SUPPORT
|
||||
JS_ASSERT(!obj->isXML());
|
||||
#endif
|
||||
if (!op)
|
||||
return GetPropertyHelper(cx, obj, id, getHow, vp);
|
||||
}
|
||||
#if JS_HAS_XML_SUPPORT
|
||||
if (obj->isXML())
|
||||
return js_GetXMLMethod(cx, obj, id, vp);
|
||||
#endif
|
||||
|
||||
return op(cx, obj, obj, id, vp);
|
||||
}
|
||||
|
||||
@ -4409,9 +4393,6 @@ JSBool
|
||||
js::DefaultValue(JSContext *cx, HandleObject obj, JSType hint, MutableHandleValue vp)
|
||||
{
|
||||
JS_ASSERT(hint == JSTYPE_NUMBER || hint == JSTYPE_STRING || hint == JSTYPE_VOID);
|
||||
#if JS_HAS_XML_SUPPORT
|
||||
JS_ASSERT(!obj->isXML());
|
||||
#endif
|
||||
|
||||
Rooted<jsid> id(cx);
|
||||
|
||||
|
@ -237,7 +237,6 @@ extern Class StringClass;
|
||||
extern Class StrictArgumentsObjectClass;
|
||||
extern Class WeakMapClass;
|
||||
extern Class WithClass;
|
||||
extern Class XMLFilterClass;
|
||||
|
||||
class ArgumentsObject;
|
||||
class ArrayBufferObject;
|
||||
@ -699,45 +698,6 @@ class JSObject : public js::ObjectImpl
|
||||
|
||||
static const uint32_t ITER_CLASS_NFIXED_SLOTS = 1;
|
||||
|
||||
/*
|
||||
* XML-related getters and setters.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Slots for XML-related classes are as follows:
|
||||
* - NamespaceClass.base reserves the *_NAME_* and *_NAMESPACE_* slots.
|
||||
* - QNameClass.base, AttributeNameClass, AnyNameClass reserve
|
||||
* the *_NAME_* and *_QNAME_* slots.
|
||||
* - Others (XMLClass, js_XMLFilterClass) don't reserve any slots.
|
||||
*/
|
||||
private:
|
||||
static const uint32_t JSSLOT_NAME_PREFIX = 0; // shared
|
||||
static const uint32_t JSSLOT_NAME_URI = 1; // shared
|
||||
|
||||
static const uint32_t JSSLOT_NAMESPACE_DECLARED = 2;
|
||||
|
||||
static const uint32_t JSSLOT_QNAME_LOCAL_NAME = 2;
|
||||
|
||||
public:
|
||||
static const uint32_t NAMESPACE_CLASS_RESERVED_SLOTS = 3;
|
||||
static const uint32_t QNAME_CLASS_RESERVED_SLOTS = 3;
|
||||
|
||||
inline JSLinearString *getNamePrefix() const;
|
||||
inline jsval getNamePrefixVal() const;
|
||||
inline void setNamePrefix(JSLinearString *prefix);
|
||||
inline void clearNamePrefix();
|
||||
|
||||
inline JSLinearString *getNameURI() const;
|
||||
inline jsval getNameURIVal() const;
|
||||
inline void setNameURI(JSLinearString *uri);
|
||||
|
||||
inline jsval getNamespaceDeclared() const;
|
||||
inline void setNamespaceDeclared(jsval decl);
|
||||
|
||||
inline JSAtom *getQNameLocalName() const;
|
||||
inline jsval getQNameLocalNameVal() const;
|
||||
inline void setQNameLocalName(JSAtom *name);
|
||||
|
||||
/*
|
||||
* Back to generic stuff.
|
||||
*/
|
||||
@ -1026,12 +986,6 @@ class JSObject : public js::ObjectImpl
|
||||
inline bool isStopIteration() const;
|
||||
inline bool isTypedArray() const;
|
||||
inline bool isWeakMap() const;
|
||||
#if JS_HAS_XML_SUPPORT
|
||||
inline bool isNamespace() const;
|
||||
inline bool isQName() const;
|
||||
inline bool isXML() const;
|
||||
inline bool isXMLId() const;
|
||||
#endif
|
||||
|
||||
/* Subtypes of ScopeObject. */
|
||||
inline bool isBlock() const;
|
||||
|
@ -22,7 +22,6 @@
|
||||
#include "jsproxy.h"
|
||||
#include "jsstr.h"
|
||||
#include "jstypedarray.h"
|
||||
#include "jsxml.h"
|
||||
#include "jswrapper.h"
|
||||
|
||||
#include "builtin/MapObject.h"
|
||||
@ -749,97 +748,6 @@ JSObject::setDateUTCTime(const js::Value &time)
|
||||
setFixedSlot(JSSLOT_DATE_UTC_TIME, time);
|
||||
}
|
||||
|
||||
#if JS_HAS_XML_SUPPORT
|
||||
|
||||
inline JSLinearString *
|
||||
JSObject::getNamePrefix() const
|
||||
{
|
||||
JS_ASSERT(isNamespace() || isQName());
|
||||
const js::Value &v = getSlot(JSSLOT_NAME_PREFIX);
|
||||
return !v.isUndefined() ? &v.toString()->asLinear() : NULL;
|
||||
}
|
||||
|
||||
inline jsval
|
||||
JSObject::getNamePrefixVal() const
|
||||
{
|
||||
JS_ASSERT(isNamespace() || isQName());
|
||||
return getSlot(JSSLOT_NAME_PREFIX);
|
||||
}
|
||||
|
||||
inline void
|
||||
JSObject::setNamePrefix(JSLinearString *prefix)
|
||||
{
|
||||
JS_ASSERT(isNamespace() || isQName());
|
||||
setSlot(JSSLOT_NAME_PREFIX, prefix ? js::StringValue(prefix) : js::UndefinedValue());
|
||||
}
|
||||
|
||||
inline void
|
||||
JSObject::clearNamePrefix()
|
||||
{
|
||||
JS_ASSERT(isNamespace() || isQName());
|
||||
setSlot(JSSLOT_NAME_PREFIX, js::UndefinedValue());
|
||||
}
|
||||
|
||||
inline JSLinearString *
|
||||
JSObject::getNameURI() const
|
||||
{
|
||||
JS_ASSERT(isNamespace() || isQName());
|
||||
const js::Value &v = getSlot(JSSLOT_NAME_URI);
|
||||
return !v.isUndefined() ? &v.toString()->asLinear() : NULL;
|
||||
}
|
||||
|
||||
inline jsval
|
||||
JSObject::getNameURIVal() const
|
||||
{
|
||||
JS_ASSERT(isNamespace() || isQName());
|
||||
return getSlot(JSSLOT_NAME_URI);
|
||||
}
|
||||
|
||||
inline void
|
||||
JSObject::setNameURI(JSLinearString *uri)
|
||||
{
|
||||
JS_ASSERT(isNamespace() || isQName());
|
||||
setSlot(JSSLOT_NAME_URI, uri ? js::StringValue(uri) : js::UndefinedValue());
|
||||
}
|
||||
|
||||
inline jsval
|
||||
JSObject::getNamespaceDeclared() const
|
||||
{
|
||||
JS_ASSERT(isNamespace());
|
||||
return getSlot(JSSLOT_NAMESPACE_DECLARED);
|
||||
}
|
||||
|
||||
inline void
|
||||
JSObject::setNamespaceDeclared(jsval decl)
|
||||
{
|
||||
JS_ASSERT(isNamespace());
|
||||
setSlot(JSSLOT_NAMESPACE_DECLARED, decl);
|
||||
}
|
||||
|
||||
inline JSAtom *
|
||||
JSObject::getQNameLocalName() const
|
||||
{
|
||||
JS_ASSERT(isQName());
|
||||
const js::Value &v = getSlot(JSSLOT_QNAME_LOCAL_NAME);
|
||||
return !v.isUndefined() ? &v.toString()->asAtom() : NULL;
|
||||
}
|
||||
|
||||
inline jsval
|
||||
JSObject::getQNameLocalNameVal() const
|
||||
{
|
||||
JS_ASSERT(isQName());
|
||||
return getSlot(JSSLOT_QNAME_LOCAL_NAME);
|
||||
}
|
||||
|
||||
inline void
|
||||
JSObject::setQNameLocalName(JSAtom *name)
|
||||
{
|
||||
JS_ASSERT(isQName());
|
||||
setSlot(JSSLOT_QNAME_LOCAL_NAME, name ? js::StringValue(name) : js::UndefinedValue());
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/* static */ inline bool
|
||||
JSObject::setSingletonType(JSContext *cx, js::HandleObject obj)
|
||||
{
|
||||
@ -1032,27 +940,6 @@ JSObject::isDebugScope() const
|
||||
return getClass() == &js::ObjectProxyClass && js_IsDebugScopeSlow(const_cast<JSObject*>(this));
|
||||
}
|
||||
|
||||
#if JS_HAS_XML_SUPPORT
|
||||
inline bool JSObject::isNamespace() const { return hasClass(&js::NamespaceClass); }
|
||||
inline bool JSObject::isXML() const { return hasClass(&js::XMLClass); }
|
||||
|
||||
inline bool
|
||||
JSObject::isXMLId() const
|
||||
{
|
||||
return hasClass(&js::QNameClass)
|
||||
|| hasClass(&js::AttributeNameClass)
|
||||
|| hasClass(&js::AnyNameClass);
|
||||
}
|
||||
|
||||
inline bool
|
||||
JSObject::isQName() const
|
||||
{
|
||||
return hasClass(&js::QNameClass)
|
||||
|| hasClass(&js::AttributeNameClass)
|
||||
|| hasClass(&js::AnyNameClass);
|
||||
}
|
||||
#endif /* JS_HAS_XML_SUPPORT */
|
||||
|
||||
/* static */ inline JSObject *
|
||||
JSObject::create(JSContext *cx, js::gc::AllocKind kind,
|
||||
js::HandleShape shape, js::HandleTypeObject type, js::HeapSlot *slots)
|
||||
@ -1483,25 +1370,6 @@ GetOuterObject(JSContext *cx, HandleObject obj)
|
||||
return obj;
|
||||
}
|
||||
|
||||
#if JS_HAS_XML_SUPPORT
|
||||
/*
|
||||
* Methods to test whether an object or a value is of type "xml" (per typeof).
|
||||
*/
|
||||
|
||||
#define VALUE_IS_XML(v) ((v).isObject() && (v).toObject().isXML())
|
||||
|
||||
static inline bool
|
||||
IsXML(const js::Value &v)
|
||||
{
|
||||
return v.isObject() && v.toObject().isXML();
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
#define VALUE_IS_XML(v) false
|
||||
|
||||
#endif /* JS_HAS_XML_SUPPORT */
|
||||
|
||||
static inline bool
|
||||
IsStopIteration(const js::Value &v)
|
||||
{
|
||||
@ -1944,23 +1812,6 @@ static JS_ALWAYS_INLINE bool
|
||||
ValueIsSpecial(JSObject *obj, MutableHandleValue propval, MutableHandle<SpecialId> sidp,
|
||||
JSContext *cx)
|
||||
{
|
||||
#if JS_HAS_XML_SUPPORT
|
||||
if (!propval.isObject())
|
||||
return false;
|
||||
|
||||
if (obj->isXML()) {
|
||||
sidp.set(SpecialId(propval.toObject()));
|
||||
return true;
|
||||
}
|
||||
|
||||
JSObject &propobj = propval.toObject();
|
||||
JSAtom *name;
|
||||
if (propobj.isQName() && GetLocalNameFromFunctionQName(&propobj, &name, cx)) {
|
||||
propval.setString(name);
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -24,7 +24,6 @@
|
||||
#include "jsstr.h"
|
||||
#include "jstypes.h"
|
||||
#include "jsutil.h"
|
||||
#include "jsxml.h"
|
||||
|
||||
#include "frontend/TokenStream.h"
|
||||
#include "vm/StringBuffer.h"
|
||||
@ -360,7 +359,7 @@ PreprocessValue(JSContext *cx, HandleObject holder, KeyType key, MutableHandleVa
|
||||
static inline bool
|
||||
IsFilteredValue(const Value &v)
|
||||
{
|
||||
return v.isUndefined() || js_IsCallable(v) || VALUE_IS_XML(v);
|
||||
return v.isUndefined() || js_IsCallable(v);
|
||||
}
|
||||
|
||||
/* ES5 15.12.3 JO. */
|
||||
|
@ -2106,14 +2106,10 @@ DecompileDestructuringLHS(SprintStack *ss, jsbytecode *pc, jsbytecode *endpc, JS
|
||||
/* lval is from JSOP_BINDNAME, so just print xval. */
|
||||
todo = ss->sprinter.put(xval);
|
||||
} else if (*xval == '\0') {
|
||||
/* xval is from JSOP_SETCALL or JSOP_BINDXMLNAME, print lval. */
|
||||
/* xval is from JSOP_SETCALL, so print lval. */
|
||||
todo = ss->sprinter.put(lval);
|
||||
} else {
|
||||
todo = Sprint(&ss->sprinter,
|
||||
(JOF_OPMODE(ss->opcodes[ss->top+1]) == JOF_XMLNAME)
|
||||
? "%s.%s"
|
||||
: "%s[%s]",
|
||||
lval, xval);
|
||||
todo = Sprint(&ss->sprinter, "%s[%s]", lval, xval);
|
||||
}
|
||||
if (todo < 0)
|
||||
return NULL;
|
||||
@ -2627,18 +2623,12 @@ Decompile(SprintStack *ss, jsbytecode *pc, int nb)
|
||||
JSBool ok;
|
||||
JSBool foreach;
|
||||
JSBool defaultsSwitch = false;
|
||||
#if JS_HAS_XML_SUPPORT
|
||||
JSBool inXML, quoteAttr;
|
||||
#else
|
||||
#define inXML JS_FALSE
|
||||
#endif
|
||||
jsval val;
|
||||
|
||||
static const char exception_cookie[] = "/*EXCEPTION*/";
|
||||
static const char retsub_pc_cookie[] = "/*RETSUB_PC*/";
|
||||
static const char forelem_cookie[] = "/*FORELEM*/";
|
||||
static const char with_cookie[] = "/*WITH*/";
|
||||
static const char dot_format[] = "%s.%s";
|
||||
static const char index_format[] = "%s[%s]";
|
||||
static const char predot_format[] = "%s%s.%s";
|
||||
static const char postdot_format[] = "%s.%s%s";
|
||||
@ -2734,9 +2724,6 @@ Decompile(SprintStack *ss, jsbytecode *pc, int nb)
|
||||
rval = NULL;
|
||||
bool forOf = false;
|
||||
foreach = false;
|
||||
#if JS_HAS_XML_SUPPORT
|
||||
inXML = quoteAttr = false;
|
||||
#endif
|
||||
|
||||
while (nb < 0 || pc < endpc) {
|
||||
/*
|
||||
@ -2841,9 +2828,6 @@ Decompile(SprintStack *ss, jsbytecode *pc, int nb)
|
||||
case JSOP_ENUMCONSTELEM:
|
||||
op = JSOP_GETELEM;
|
||||
break;
|
||||
case JSOP_SETXMLNAME:
|
||||
op = JSOp(JSOP_GETELEM2);
|
||||
break;
|
||||
default:
|
||||
LOCAL_ASSERT(0);
|
||||
}
|
||||
@ -2880,19 +2864,13 @@ Decompile(SprintStack *ss, jsbytecode *pc, int nb)
|
||||
|
||||
/* Print only the right operand of the assignment-op. */
|
||||
todo = ss->sprinter.put(rval);
|
||||
} else if (!inXML) {
|
||||
} else {
|
||||
rval = PopStrPrecDupe(ss, cs->prec + !!(cs->format & JOF_LEFTASSOC), &rvalpc);
|
||||
lval = PopStrPrec(ss, cs->prec + !(cs->format & JOF_LEFTASSOC), &lvalpc);
|
||||
todo = ss->sprinter.getOffset();
|
||||
SprintOpcode(ss, lval, lvalpc, pc, todo);
|
||||
Sprint(&ss->sprinter, " %s ", token);
|
||||
SprintOpcode(ss, rval, rvalpc, pc, todo);
|
||||
} else {
|
||||
/* In XML, just concatenate the two operands. */
|
||||
LOCAL_ASSERT(op == JSOP_ADD);
|
||||
rval = POP_STR();
|
||||
lval = POP_STR();
|
||||
todo = Sprint(&ss->sprinter, ss_format, lval, rval);
|
||||
}
|
||||
break;
|
||||
|
||||
@ -4174,11 +4152,7 @@ Decompile(SprintStack *ss, jsbytecode *pc, int nb)
|
||||
if (*xval == '\0') {
|
||||
todo = ss->sprinter.put(lval);
|
||||
} else {
|
||||
todo = Sprint(&ss->sprinter,
|
||||
(JOF_OPMODE(lastop) == JOF_XMLNAME)
|
||||
? dot_format
|
||||
: index_format,
|
||||
lval, xval);
|
||||
todo = Sprint(&ss->sprinter, index_format, lval, xval);
|
||||
}
|
||||
break;
|
||||
|
||||
@ -4452,23 +4426,9 @@ Decompile(SprintStack *ss, jsbytecode *pc, int nb)
|
||||
lval = POP_STR();
|
||||
if (*xval == '\0')
|
||||
goto do_delete_lval;
|
||||
todo = Sprint(&ss->sprinter,
|
||||
(JOF_OPMODE(lastop) == JOF_XMLNAME)
|
||||
? "%s %s.%s"
|
||||
: "%s %s[%s]",
|
||||
js_delete_str, lval, xval);
|
||||
todo = Sprint(&ss->sprinter, "%s %s[%s]", js_delete_str, lval, xval);
|
||||
break;
|
||||
|
||||
#if JS_HAS_XML_SUPPORT
|
||||
case JSOP_DELDESC:
|
||||
xval = POP_STR();
|
||||
op = JSOP_GETPROP;
|
||||
lval = POP_STR();
|
||||
todo = Sprint(&ss->sprinter, "%s %s..%s",
|
||||
js_delete_str, lval, xval);
|
||||
break;
|
||||
#endif
|
||||
|
||||
case JSOP_TYPEOFEXPR:
|
||||
case JSOP_TYPEOF:
|
||||
case JSOP_VOID:
|
||||
@ -4530,10 +4490,7 @@ Decompile(SprintStack *ss, jsbytecode *pc, int nb)
|
||||
op = JSOP_GETELEM;
|
||||
lval = POP_STR();
|
||||
if (*xval != '\0') {
|
||||
todo = Sprint(&ss->sprinter,
|
||||
(JOF_OPMODE(lastop) == JOF_XMLNAME)
|
||||
? predot_format
|
||||
: preindex_format,
|
||||
todo = Sprint(&ss->sprinter, preindex_format,
|
||||
js_incop_strs[!(cs->format & JOF_INC)],
|
||||
lval, xval);
|
||||
} else {
|
||||
@ -4591,11 +4548,7 @@ Decompile(SprintStack *ss, jsbytecode *pc, int nb)
|
||||
op = JSOP_GETELEM;
|
||||
lval = POP_STR();
|
||||
if (*xval != '\0') {
|
||||
todo = Sprint(&ss->sprinter,
|
||||
(JOF_OPMODE(lastop) == JOF_XMLNAME)
|
||||
? postdot_format
|
||||
: postindex_format,
|
||||
lval, xval,
|
||||
todo = Sprint(&ss->sprinter, postindex_format, lval, xval,
|
||||
js_incop_strs[!(cs->format & JOF_INC)]);
|
||||
} else {
|
||||
todo = Sprint(&ss->sprinter, ss_format,
|
||||
@ -4660,10 +4613,9 @@ Decompile(SprintStack *ss, jsbytecode *pc, int nb)
|
||||
todo = ss->sprinter.getOffset();
|
||||
SprintOpcode(ss, lval, lvalpc, pc, todo);
|
||||
if (*xval != '\0') {
|
||||
bool xml = (JOF_OPMODE(lastop) == JOF_XMLNAME);
|
||||
ss->sprinter.put(xml ? "." : "[");
|
||||
ss->sprinter.put("[");
|
||||
SprintOpcode(ss, xval, xvalpc, pc, todo);
|
||||
ss->sprinter.put(xml ? "" : "]");
|
||||
ss->sprinter.put("]");
|
||||
}
|
||||
break;
|
||||
|
||||
@ -4679,15 +4631,14 @@ Decompile(SprintStack *ss, jsbytecode *pc, int nb)
|
||||
if (*xval == '\0')
|
||||
goto do_setlval;
|
||||
sn = js_GetSrcNote(cx, jp->script, pc - 1);
|
||||
bool xml = (JOF_MODE(cs->format) == JOF_XMLNAME);
|
||||
const char *token =
|
||||
GetTokenForAssignment(jp, sn, lastop, pc, rvalpc,
|
||||
&lastlvalpc, &lastrvalpc);
|
||||
todo = ss->sprinter.getOffset();
|
||||
SprintOpcode(ss, lval, lvalpc, pc, todo);
|
||||
ss->sprinter.put(xml ? "." : "[");
|
||||
ss->sprinter.put("[");
|
||||
SprintOpcode(ss, xval, xvalpc, pc, todo);
|
||||
ss->sprinter.put(xml ? "" : "]");
|
||||
ss->sprinter.put("]");
|
||||
Sprint(&ss->sprinter, " %s= ", token);
|
||||
SprintOpcode(ss, rval, rvalpc, pc, todo);
|
||||
break;
|
||||
@ -4714,11 +4665,8 @@ Decompile(SprintStack *ss, jsbytecode *pc, int nb)
|
||||
LOAD_ATOM(0);
|
||||
do_name:
|
||||
lval = "";
|
||||
#if JS_HAS_XML_SUPPORT
|
||||
do_qname:
|
||||
#endif
|
||||
sn = js_GetSrcNote(cx, jp->script, pc);
|
||||
rval = QuoteString(&ss->sprinter, atom, inXML ? DONT_ESCAPE : 0);
|
||||
rval = QuoteString(&ss->sprinter, atom, 0);
|
||||
if (!rval)
|
||||
return NULL;
|
||||
ss->sprinter.setOffset(rval);
|
||||
@ -4753,7 +4701,7 @@ Decompile(SprintStack *ss, jsbytecode *pc, int nb)
|
||||
|
||||
case JSOP_STRING:
|
||||
LOAD_ATOM(0);
|
||||
rval = QuoteString(&ss->sprinter, atom, inXML ? DONT_ESCAPE : '"');
|
||||
rval = QuoteString(&ss->sprinter, atom, '"');
|
||||
if (!rval)
|
||||
return NULL;
|
||||
todo = ss->sprinter.getOffsetOf(rval);
|
||||
@ -5266,172 +5214,6 @@ Decompile(SprintStack *ss, jsbytecode *pc, int nb)
|
||||
todo = -2;
|
||||
break;
|
||||
|
||||
#if JS_HAS_XML_SUPPORT
|
||||
case JSOP_STARTXML:
|
||||
case JSOP_STARTXMLEXPR:
|
||||
inXML = op == JSOP_STARTXML;
|
||||
todo = -2;
|
||||
break;
|
||||
|
||||
case JSOP_DEFXMLNS:
|
||||
rval = POP_STR();
|
||||
js_printf(jp, "\t%s %s %s = %s;\n",
|
||||
js_default_str, js_xml_str, js_namespace_str, rval);
|
||||
todo = -2;
|
||||
break;
|
||||
|
||||
case JSOP_ANYNAME:
|
||||
if (pc[JSOP_ANYNAME_LENGTH] == JSOP_TOATTRNAME) {
|
||||
len += JSOP_TOATTRNAME_LENGTH;
|
||||
todo = ss->sprinter.put("@*", 2);
|
||||
} else {
|
||||
todo = ss->sprinter.put("*", 1);
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
|
||||
case JSOP_QNAMEPART:
|
||||
LOAD_ATOM(0);
|
||||
#if JS_HAS_XML_SUPPORT
|
||||
if (pc[JSOP_QNAMEPART_LENGTH] == JSOP_TOATTRNAME) {
|
||||
saveop = JSOP_TOATTRNAME;
|
||||
len += JSOP_TOATTRNAME_LENGTH;
|
||||
lval = "@";
|
||||
goto do_qname;
|
||||
}
|
||||
#endif
|
||||
goto do_name;
|
||||
|
||||
#if JS_HAS_XML_SUPPORT
|
||||
case JSOP_QNAMECONST:
|
||||
LOAD_ATOM(0);
|
||||
rval = QuoteString(&ss->sprinter, atom, 0);
|
||||
if (!rval)
|
||||
return NULL;
|
||||
ss->sprinter.setOffset(rval);
|
||||
lval = POP_STR();
|
||||
todo = Sprint(&ss->sprinter, "%s::%s", lval, rval);
|
||||
break;
|
||||
|
||||
case JSOP_QNAME:
|
||||
rval = POP_STR();
|
||||
lval = POP_STR();
|
||||
todo = Sprint(&ss->sprinter, "%s::[%s]", lval, rval);
|
||||
break;
|
||||
|
||||
case JSOP_TOATTRNAME:
|
||||
op = JSOP_NOP; /* turn off parens */
|
||||
rval = POP_STR();
|
||||
todo = Sprint(&ss->sprinter, "@[%s]", rval);
|
||||
break;
|
||||
|
||||
case JSOP_TOATTRVAL:
|
||||
todo = -2;
|
||||
break;
|
||||
|
||||
case JSOP_ADDATTRNAME:
|
||||
rval = POP_STR();
|
||||
lval = POP_STR();
|
||||
todo = Sprint(&ss->sprinter, "%s %s", lval, rval);
|
||||
/* This gets reset by all XML tag expressions. */
|
||||
quoteAttr = JS_TRUE;
|
||||
break;
|
||||
|
||||
case JSOP_ADDATTRVAL:
|
||||
rval = POP_STR();
|
||||
lval = POP_STR();
|
||||
if (quoteAttr)
|
||||
todo = Sprint(&ss->sprinter, "%s=\"%s\"", lval, rval);
|
||||
else
|
||||
todo = Sprint(&ss->sprinter, "%s=%s", lval, rval);
|
||||
break;
|
||||
|
||||
case JSOP_BINDXMLNAME:
|
||||
/* Leave the name stacked and push a dummy string. */
|
||||
todo = Sprint(&ss->sprinter, "");
|
||||
break;
|
||||
|
||||
case JSOP_SETXMLNAME:
|
||||
/* Pop the r.h.s., the dummy string, and the name. */
|
||||
rval = PopStrDupe(ss, op, &rvalpc);
|
||||
(void) PopOff(ss, op);
|
||||
lval = POP_STR();
|
||||
goto do_setlval;
|
||||
|
||||
case JSOP_XMLELTEXPR:
|
||||
case JSOP_XMLTAGEXPR:
|
||||
todo = Sprint(&ss->sprinter, "{%s}", POP_STR());
|
||||
inXML = JS_TRUE;
|
||||
/* If we're an attribute value, we shouldn't quote this. */
|
||||
quoteAttr = JS_FALSE;
|
||||
break;
|
||||
|
||||
case JSOP_TOXMLLIST:
|
||||
op = JSOP_NOP; /* turn off parens */
|
||||
todo = Sprint(&ss->sprinter, "<>%s</>", POP_STR());
|
||||
inXML = JS_FALSE;
|
||||
break;
|
||||
|
||||
case JSOP_TOXML:
|
||||
case JSOP_CALLXMLNAME:
|
||||
case JSOP_XMLNAME:
|
||||
case JSOP_FILTER:
|
||||
/* These ops indicate the end of XML expressions. */
|
||||
inXML = JS_FALSE;
|
||||
todo = -2;
|
||||
break;
|
||||
|
||||
case JSOP_ENDFILTER:
|
||||
rval = POP_STR();
|
||||
PROPAGATE_CALLNESS();
|
||||
lval = POP_STR();
|
||||
todo = Sprint(&ss->sprinter, "%s.(%s)", lval, rval);
|
||||
break;
|
||||
|
||||
case JSOP_DESCENDANTS:
|
||||
rval = POP_STR();
|
||||
PROPAGATE_CALLNESS();
|
||||
lval = POP_STR();
|
||||
todo = Sprint(&ss->sprinter, "%s..%s", lval, rval);
|
||||
break;
|
||||
|
||||
case JSOP_XMLCDATA:
|
||||
LOAD_ATOM(0);
|
||||
todo = ss->sprinter.put("<![CDATA[", 9);
|
||||
if (!QuoteString(&ss->sprinter, atom, DONT_ESCAPE))
|
||||
return NULL;
|
||||
ss->sprinter.put("]]>", 3);
|
||||
break;
|
||||
|
||||
case JSOP_XMLCOMMENT:
|
||||
LOAD_ATOM(0);
|
||||
todo = ss->sprinter.put("<!--", 4);
|
||||
if (!QuoteString(&ss->sprinter, atom, DONT_ESCAPE))
|
||||
return NULL;
|
||||
ss->sprinter.put("-->", 3);
|
||||
break;
|
||||
|
||||
case JSOP_XMLPI:
|
||||
LOAD_ATOM(0);
|
||||
rval = JS_strdup(cx, POP_STR());
|
||||
if (!rval)
|
||||
return NULL;
|
||||
todo = ss->sprinter.put("<?", 2);
|
||||
ok = QuoteString(&ss->sprinter, atom, 0) &&
|
||||
(*rval == '\0' ||
|
||||
(ss->sprinter.put(" ", 1) >= 0 &&
|
||||
ss->sprinter.put(rval)));
|
||||
js_free((char *)rval);
|
||||
if (!ok)
|
||||
return NULL;
|
||||
ss->sprinter.put("?>", 2);
|
||||
break;
|
||||
|
||||
case JSOP_GETFUNNS:
|
||||
todo = ss->sprinter.put(js_function_str, 8);
|
||||
break;
|
||||
#endif /* JS_HAS_XML_SUPPORT */
|
||||
|
||||
case JSOP_REST:
|
||||
// Ignore bytecode related to handling rest.
|
||||
pc += GetBytecodeLength(pc);
|
||||
@ -5472,19 +5254,12 @@ Decompile(SprintStack *ss, jsbytecode *pc, int nb)
|
||||
CopyDecompiledTextForDecomposedOp(jp, pc);
|
||||
}
|
||||
|
||||
if (op == JSOP_CALLXMLNAME) {
|
||||
todo = Sprint(&ss->sprinter, "");
|
||||
if (todo < 0 || !PushOff(ss, todo, saveop))
|
||||
return NULL;
|
||||
}
|
||||
|
||||
pc += len;
|
||||
}
|
||||
|
||||
/*
|
||||
* Undefine local macros.
|
||||
*/
|
||||
#undef inXML
|
||||
#undef DECOMPILE_CODE
|
||||
#undef TOP_STR
|
||||
#undef POP_STR
|
||||
@ -6425,7 +6200,6 @@ DecompileExpression(JSContext *cx, JSScript *script, JSFunction *fun, jsbytecode
|
||||
switch (JOF_MODE(cs->format)) {
|
||||
case JOF_PROP:
|
||||
case JOF_ELEM:
|
||||
case JOF_XMLNAME:
|
||||
case 0: {
|
||||
jssrcnote *sn = js_GetSrcNote(cx, script, pc);
|
||||
if (!sn)
|
||||
|
@ -64,7 +64,6 @@ typedef enum JSOp {
|
||||
#define JOF_NAME (1U<<5) /* name operation */
|
||||
#define JOF_PROP (2U<<5) /* obj.prop operation */
|
||||
#define JOF_ELEM (3U<<5) /* obj[index] operation */
|
||||
#define JOF_XMLNAME (4U<<5) /* XML name: *, a::b, @a, @a::b, etc. */
|
||||
#define JOF_MODEMASK (7U<<5) /* mask for above addressing modes */
|
||||
#define JOF_SET (1U<<8) /* set (i.e., assignment) operation */
|
||||
#define JOF_DEL (1U<<9) /* delete operation */
|
||||
|
@ -192,7 +192,7 @@ OPDEF(JSOP_ENDITER, 78, "enditer", NULL, 1, 1, 0, 0, JOF_BYTE)
|
||||
|
||||
OPDEF(JSOP_FUNAPPLY, 79, "funapply", NULL, 3, -1, 1, 18, JOF_UINT16|JOF_INVOKE|JOF_TYPESET)
|
||||
|
||||
/* Push object literal: either an XML object or initialiser object. */
|
||||
/* Push object initializer literal. */
|
||||
OPDEF(JSOP_OBJECT, 80, "object", NULL, 5, 0, 1, 19, JOF_OBJECT)
|
||||
|
||||
/* Pop value and discard it. */
|
||||
@ -339,8 +339,8 @@ OPDEF(JSOP_FINALLY, 135,"finally", NULL, 1, 0, 2, 0, JOF_BYTE)
|
||||
* An "aliased variable" is a var, let, or formal arg that is aliased. Sources
|
||||
* of aliasing include: nested functions accessing the vars of an enclosing
|
||||
* function, function statements that are conditionally executed, 'eval',
|
||||
* 'with', 'arguments' and E4X filters. All of these cases require creating a
|
||||
* CallObject to own the aliased variable.
|
||||
* 'with', and 'arguments'. All of these cases require creating a CallObject to
|
||||
* own the aliased variable.
|
||||
*
|
||||
* An ALIASEDVAR opcode contains the following immediates:
|
||||
* uint16 hops: the number of scope objects to skip to find the ScopeObject
|
||||
@ -396,30 +396,29 @@ OPDEF(JSOP_GNAMEDEC, 159,"gnamedec", NULL, 6, 0, 1, 15, JOF_ATOM|
|
||||
/* Regular expression literal requiring special "fork on exec" handling. */
|
||||
OPDEF(JSOP_REGEXP, 160,"regexp", NULL, 5, 0, 1, 19, JOF_REGEXP)
|
||||
|
||||
/* XML (ECMA-357, a.k.a. "E4X") support. */
|
||||
OPDEF(JSOP_DEFXMLNS, 161,"defxmlns", NULL, 1, 1, 0, 0, JOF_BYTE)
|
||||
OPDEF(JSOP_ANYNAME, 162,"anyname", NULL, 1, 0, 1, 19, JOF_BYTE|JOF_XMLNAME)
|
||||
OPDEF(JSOP_QNAMEPART, 163,"qnamepart", NULL, 5, 0, 1, 19, JOF_ATOM|JOF_XMLNAME)
|
||||
OPDEF(JSOP_QNAMECONST, 164,"qnameconst", NULL, 5, 1, 1, 19, JOF_ATOM|JOF_XMLNAME)
|
||||
OPDEF(JSOP_QNAME, 165,"qname", NULL, 1, 2, 1, 0, JOF_BYTE|JOF_XMLNAME)
|
||||
OPDEF(JSOP_TOATTRNAME, 166,"toattrname", NULL, 1, 1, 1, 19, JOF_BYTE|JOF_XMLNAME)
|
||||
OPDEF(JSOP_TOATTRVAL, 167,"toattrval", NULL, 1, 1, 1, 19, JOF_BYTE)
|
||||
OPDEF(JSOP_ADDATTRNAME, 168,"addattrname",NULL, 1, 2, 1, 13, JOF_BYTE)
|
||||
OPDEF(JSOP_ADDATTRVAL, 169,"addattrval", NULL, 1, 2, 1, 13, JOF_BYTE)
|
||||
OPDEF(JSOP_BINDXMLNAME, 170,"bindxmlname",NULL, 1, 1, 2, 3, JOF_BYTE|JOF_SET)
|
||||
OPDEF(JSOP_SETXMLNAME, 171,"setxmlname", NULL, 1, 3, 1, 3, JOF_BYTE|JOF_SET|JOF_DETECTING)
|
||||
OPDEF(JSOP_XMLNAME, 172,"xmlname", NULL, 1, 1, 1, 19, JOF_BYTE)
|
||||
OPDEF(JSOP_DESCENDANTS, 173,"descendants",NULL, 1, 2, 1, 18, JOF_BYTE)
|
||||
OPDEF(JSOP_FILTER, 174,"filter", NULL, 5, 1, 1, 0, JOF_JUMP)
|
||||
OPDEF(JSOP_ENDFILTER, 175,"endfilter", NULL, 5, 2, 1, 18, JOF_JUMP)
|
||||
OPDEF(JSOP_TOXML, 176,"toxml", NULL, 1, 1, 1, 19, JOF_BYTE)
|
||||
OPDEF(JSOP_TOXMLLIST, 177,"toxmllist", NULL, 1, 1, 1, 19, JOF_BYTE)
|
||||
OPDEF(JSOP_XMLTAGEXPR, 178,"xmltagexpr", NULL, 1, 1, 1, 0, JOF_BYTE)
|
||||
OPDEF(JSOP_XMLELTEXPR, 179,"xmleltexpr", NULL, 1, 1, 1, 0, JOF_BYTE)
|
||||
OPDEF(JSOP_XMLCDATA, 180,"xmlcdata", NULL, 5, 0, 1, 19, JOF_ATOM)
|
||||
OPDEF(JSOP_XMLCOMMENT, 181,"xmlcomment", NULL, 5, 0, 1, 19, JOF_ATOM)
|
||||
OPDEF(JSOP_XMLPI, 182,"xmlpi", NULL, 5, 1, 1, 19, JOF_ATOM)
|
||||
OPDEF(JSOP_DELDESC, 183,"deldesc", NULL, 1, 2, 1, 15, JOF_BYTE|JOF_ELEM|JOF_DEL)
|
||||
OPDEF(JSOP_UNUSED161, 161,"unused161", NULL, 1, 0, 0, 0, JOF_BYTE)
|
||||
OPDEF(JSOP_UNUSED162, 162,"unused162", NULL, 1, 0, 0, 0, JOF_BYTE)
|
||||
OPDEF(JSOP_UNUSED163, 163,"unused163", NULL, 1, 0, 0, 0, JOF_BYTE)
|
||||
OPDEF(JSOP_UNUSED164, 164,"unused164", NULL, 1, 0, 0, 0, JOF_BYTE)
|
||||
OPDEF(JSOP_UNUSED165, 165,"unused165", NULL, 1, 0, 0, 0, JOF_BYTE)
|
||||
OPDEF(JSOP_UNUSED166, 166,"unused166", NULL, 1, 0, 0, 0, JOF_BYTE)
|
||||
OPDEF(JSOP_UNUSED167, 167,"unused167", NULL, 1, 0, 0, 0, JOF_BYTE)
|
||||
OPDEF(JSOP_UNUSED168, 168,"unused168", NULL, 1, 0, 0, 0, JOF_BYTE)
|
||||
OPDEF(JSOP_UNUSED169, 169,"unused169", NULL, 1, 0, 0, 0, JOF_BYTE)
|
||||
OPDEF(JSOP_UNUSED170, 170,"unused170", NULL, 1, 0, 0, 0, JOF_BYTE)
|
||||
OPDEF(JSOP_UNUSED171, 171,"unused171", NULL, 1, 0, 0, 0, JOF_BYTE)
|
||||
OPDEF(JSOP_UNUSED172, 172,"unused172", NULL, 1, 0, 0, 0, JOF_BYTE)
|
||||
OPDEF(JSOP_UNUSED173, 173,"unused173", NULL, 1, 0, 0, 0, JOF_BYTE)
|
||||
OPDEF(JSOP_UNUSED174, 174,"unused174", NULL, 1, 0, 0, 0, JOF_BYTE)
|
||||
OPDEF(JSOP_UNUSED175, 175,"unused175", NULL, 1, 0, 0, 0, JOF_BYTE)
|
||||
OPDEF(JSOP_UNUSED176, 176,"unused176", NULL, 1, 0, 0, 0, JOF_BYTE)
|
||||
OPDEF(JSOP_UNUSED177, 177,"unused177", NULL, 1, 0, 0, 0, JOF_BYTE)
|
||||
OPDEF(JSOP_UNUSED178, 178,"unused178", NULL, 1, 0, 0, 0, JOF_BYTE)
|
||||
OPDEF(JSOP_UNUSED179, 179,"unused179", NULL, 1, 0, 0, 0, JOF_BYTE)
|
||||
OPDEF(JSOP_UNUSED180, 180,"unused180", NULL, 1, 0, 0, 0, JOF_BYTE)
|
||||
OPDEF(JSOP_UNUSED181, 181,"unused181", NULL, 1, 0, 0, 0, JOF_BYTE)
|
||||
OPDEF(JSOP_UNUSED182, 182,"unused182", NULL, 1, 0, 0, 0, JOF_BYTE)
|
||||
OPDEF(JSOP_UNUSED183, 183,"unused183", NULL, 1, 0, 0, 0, JOF_BYTE)
|
||||
|
||||
OPDEF(JSOP_CALLPROP, 184,"callprop", NULL, 5, 1, 1, 18, JOF_ATOM|JOF_PROP|JOF_TYPESET|JOF_TMPSLOT3)
|
||||
|
||||
@ -437,12 +436,8 @@ OPDEF(JSOP_UINT24, 187,"uint24", NULL, 4, 0, 1, 16, JOF_UINT24
|
||||
OPDEF(JSOP_UNUSED188, 188,"unused188", NULL, 1, 0, 0, 0, JOF_BYTE)
|
||||
OPDEF(JSOP_UNUSED189, 189,"unused189", NULL, 1, 0, 0, 0, JOF_BYTE)
|
||||
OPDEF(JSOP_UNUSED190, 190,"unused190", NULL, 1, 0, 0, 0, JOF_BYTE)
|
||||
|
||||
/*
|
||||
* Opcodes to help the decompiler deal with XML.
|
||||
*/
|
||||
OPDEF(JSOP_STARTXML, 191,"startxml", NULL, 1, 0, 0, 0, JOF_BYTE)
|
||||
OPDEF(JSOP_STARTXMLEXPR, 192,"startxmlexpr",NULL, 1, 0, 0, 0, JOF_BYTE)
|
||||
OPDEF(JSOP_UNUSED191, 191,"unused191", NULL, 1, 0, 0, 0, JOF_BYTE)
|
||||
OPDEF(JSOP_UNUSED192, 192,"unused192", NULL, 1, 0, 0, 0, JOF_BYTE)
|
||||
|
||||
OPDEF(JSOP_CALLELEM, 193, "callelem", NULL, 1, 2, 1, 18, JOF_BYTE |JOF_ELEM|JOF_TYPESET|JOF_LEFTASSOC)
|
||||
|
||||
@ -458,7 +453,7 @@ OPDEF(JSOP_STOP, 194,"stop", NULL, 1, 0, 0, 0, JOF_BYTE)
|
||||
*/
|
||||
OPDEF(JSOP_GETXPROP, 195,"getxprop", NULL, 5, 1, 1, 18, JOF_ATOM|JOF_PROP|JOF_TYPESET)
|
||||
|
||||
OPDEF(JSOP_CALLXMLNAME, 196, "callxmlname", NULL, 1, 1, 2, 19, JOF_BYTE)
|
||||
OPDEF(JSOP_UNUSED196, 196,"unused196", NULL, 1, 0, 0, 0, JOF_BYTE)
|
||||
|
||||
/*
|
||||
* Specialized JSOP_TYPEOF to avoid reporting undefined for typeof(0, undef).
|
||||
|
@ -259,8 +259,6 @@ Shape::dump(JSContext *cx, FILE *fp) const
|
||||
|
||||
if (JSID_IS_INT(propid)) {
|
||||
fprintf(fp, "[%ld]", (long) JSID_TO_INT(propid));
|
||||
} else if (JSID_IS_DEFAULT_XML_NAMESPACE(propid)) {
|
||||
fprintf(fp, "<default XML namespace>");
|
||||
} else {
|
||||
JSLinearString *str;
|
||||
if (JSID_IS_ATOM(propid)) {
|
||||
|
@ -30,36 +30,32 @@
|
||||
macro(Number, 8, js_InitNumberClass) \
|
||||
macro(String, 9, js_InitStringClass) \
|
||||
macro(RegExp, 10, js_InitRegExpClass) \
|
||||
macro(XML, 11, js_InitXMLClass) \
|
||||
macro(Namespace, 12, js_InitNamespaceClass) \
|
||||
macro(QName, 13, js_InitQNameClass) \
|
||||
macro(Error, 14, js_InitExceptionClasses) \
|
||||
macro(InternalError, 15, js_InitExceptionClasses) \
|
||||
macro(EvalError, 16, js_InitExceptionClasses) \
|
||||
macro(RangeError, 17, js_InitExceptionClasses) \
|
||||
macro(ReferenceError, 18, js_InitExceptionClasses) \
|
||||
macro(SyntaxError, 19, js_InitExceptionClasses) \
|
||||
macro(TypeError, 20, js_InitExceptionClasses) \
|
||||
macro(URIError, 21, js_InitExceptionClasses) \
|
||||
macro(Iterator, 22, js_InitIteratorClasses) \
|
||||
macro(StopIteration, 23, js_InitIteratorClasses) \
|
||||
macro(ArrayBuffer, 24, js_InitTypedArrayClasses) \
|
||||
macro(Int8Array, 25, js_InitTypedArrayClasses) \
|
||||
macro(Uint8Array, 26, js_InitTypedArrayClasses) \
|
||||
macro(Int16Array, 27, js_InitTypedArrayClasses) \
|
||||
macro(Uint16Array, 28, js_InitTypedArrayClasses) \
|
||||
macro(Int32Array, 29, js_InitTypedArrayClasses) \
|
||||
macro(Uint32Array, 30, js_InitTypedArrayClasses) \
|
||||
macro(Float32Array, 31, js_InitTypedArrayClasses) \
|
||||
macro(Float64Array, 32, js_InitTypedArrayClasses) \
|
||||
macro(Uint8ClampedArray, 33, js_InitTypedArrayClasses) \
|
||||
macro(Proxy, 34, js_InitProxyClass) \
|
||||
macro(AnyName, 35, js_InitNullClass) \
|
||||
macro(WeakMap, 36, js_InitWeakMapClass) \
|
||||
macro(Map, 37, js_InitMapClass) \
|
||||
macro(Set, 38, js_InitSetClass) \
|
||||
macro(DataView, 39, js_InitTypedArrayClasses) \
|
||||
macro(ParallelArray, 40, js_InitParallelArrayClass) \
|
||||
macro(Intl, 41, js_InitIntlClass) \
|
||||
macro(Error, 11, js_InitExceptionClasses) \
|
||||
macro(InternalError, 12, js_InitExceptionClasses) \
|
||||
macro(EvalError, 13, js_InitExceptionClasses) \
|
||||
macro(RangeError, 14, js_InitExceptionClasses) \
|
||||
macro(ReferenceError, 15, js_InitExceptionClasses) \
|
||||
macro(SyntaxError, 16, js_InitExceptionClasses) \
|
||||
macro(TypeError, 17, js_InitExceptionClasses) \
|
||||
macro(URIError, 18, js_InitExceptionClasses) \
|
||||
macro(Iterator, 19, js_InitIteratorClasses) \
|
||||
macro(StopIteration, 20, js_InitIteratorClasses) \
|
||||
macro(ArrayBuffer, 21, js_InitTypedArrayClasses) \
|
||||
macro(Int8Array, 22, js_InitTypedArrayClasses) \
|
||||
macro(Uint8Array, 23, js_InitTypedArrayClasses) \
|
||||
macro(Int16Array, 24, js_InitTypedArrayClasses) \
|
||||
macro(Uint16Array, 25, js_InitTypedArrayClasses) \
|
||||
macro(Int32Array, 26, js_InitTypedArrayClasses) \
|
||||
macro(Uint32Array, 27, js_InitTypedArrayClasses) \
|
||||
macro(Float32Array, 28, js_InitTypedArrayClasses) \
|
||||
macro(Float64Array, 29, js_InitTypedArrayClasses) \
|
||||
macro(Uint8ClampedArray, 30, js_InitTypedArrayClasses) \
|
||||
macro(Proxy, 31, js_InitProxyClass) \
|
||||
macro(WeakMap, 32, js_InitWeakMapClass) \
|
||||
macro(Map, 33, js_InitMapClass) \
|
||||
macro(Set, 34, js_InitSetClass) \
|
||||
macro(DataView, 35, js_InitTypedArrayClasses) \
|
||||
macro(ParallelArray, 36, js_InitParallelArrayClass) \
|
||||
macro(Intl, 37, js_InitIntlClass) \
|
||||
|
||||
#endif /* jsprototypes_h___ */
|
||||
|
@ -58,10 +58,6 @@ typedef struct JSStackHeader JSStackHeader;
|
||||
typedef struct JSSubString JSSubString;
|
||||
typedef struct JSSpecializedNative JSSpecializedNative;
|
||||
|
||||
#if JS_HAS_XML_SUPPORT
|
||||
typedef struct JSXML JSXML;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Template declarations.
|
||||
*
|
||||
|
@ -91,7 +91,6 @@ typedef enum JSType {
|
||||
JSTYPE_NUMBER, /* number */
|
||||
JSTYPE_BOOLEAN, /* boolean */
|
||||
JSTYPE_NULL, /* null */
|
||||
JSTYPE_XML, /* xml object */
|
||||
JSTYPE_LIMIT
|
||||
} JSType;
|
||||
|
||||
@ -154,9 +153,6 @@ typedef enum {
|
||||
* implements JSTraceCallback.
|
||||
*/
|
||||
JSTRACE_IONCODE,
|
||||
#if JS_HAS_XML_SUPPORT
|
||||
JSTRACE_XML,
|
||||
#endif
|
||||
JSTRACE_SHAPE,
|
||||
JSTRACE_BASE_SHAPE,
|
||||
JSTRACE_TYPE_OBJECT,
|
||||
@ -227,7 +223,6 @@ enum ThingRootKind
|
||||
THING_ROOT_TYPE_OBJECT,
|
||||
THING_ROOT_STRING,
|
||||
THING_ROOT_SCRIPT,
|
||||
THING_ROOT_XML,
|
||||
THING_ROOT_ID,
|
||||
THING_ROOT_PROPERTY_ID,
|
||||
THING_ROOT_VALUE,
|
||||
|
@ -75,7 +75,6 @@ char const *js::binopNames[] = {
|
||||
"&", /* BINOP_BITAND */
|
||||
"in", /* BINOP_IN */
|
||||
"instanceof", /* BINOP_INSTANCEOF */
|
||||
"..", /* BINOP_DBLDOT */
|
||||
};
|
||||
|
||||
char const *js::unopNames[] = {
|
||||
@ -612,52 +611,6 @@ class NodeBuilder
|
||||
bool objectPattern(NodeVector &elts, TokenPos *pos, MutableHandleValue dst);
|
||||
|
||||
bool propertyPattern(HandleValue key, HandleValue patt, TokenPos *pos, MutableHandleValue dst);
|
||||
|
||||
/*
|
||||
* xml
|
||||
*/
|
||||
|
||||
bool xmlAnyName(TokenPos *pos, MutableHandleValue dst);
|
||||
|
||||
bool xmlEscapeExpression(HandleValue expr, TokenPos *pos, MutableHandleValue dst);
|
||||
|
||||
bool xmlDefaultNamespace(HandleValue ns, TokenPos *pos, MutableHandleValue dst);
|
||||
|
||||
bool xmlFilterExpression(HandleValue left, HandleValue right, TokenPos *pos,
|
||||
MutableHandleValue dst);
|
||||
|
||||
bool xmlAttributeSelector(HandleValue expr, bool computed, TokenPos *pos,
|
||||
MutableHandleValue dst);
|
||||
|
||||
bool xmlQualifiedIdentifier(HandleValue left, HandleValue right, bool computed, TokenPos *pos,
|
||||
MutableHandleValue dst);
|
||||
|
||||
bool xmlFunctionQualifiedIdentifier(HandleValue right, bool computed, TokenPos *pos,
|
||||
MutableHandleValue dst);
|
||||
|
||||
bool xmlElement(NodeVector &elts, TokenPos *pos, MutableHandleValue dst);
|
||||
|
||||
bool xmlText(HandleValue text, TokenPos *pos, MutableHandleValue dst);
|
||||
|
||||
bool xmlList(NodeVector &elts, TokenPos *pos, MutableHandleValue dst);
|
||||
|
||||
bool xmlStartTag(NodeVector &elts, TokenPos *pos, MutableHandleValue dst);
|
||||
|
||||
bool xmlEndTag(NodeVector &elts, TokenPos *pos, MutableHandleValue dst);
|
||||
|
||||
bool xmlPointTag(NodeVector &elts, TokenPos *pos, MutableHandleValue dst);
|
||||
|
||||
bool xmlName(HandleValue text, TokenPos *pos, MutableHandleValue dst);
|
||||
|
||||
bool xmlName(NodeVector &elts, TokenPos *pos, MutableHandleValue dst);
|
||||
|
||||
bool xmlAttribute(HandleValue text, TokenPos *pos, MutableHandleValue dst);
|
||||
|
||||
bool xmlCdata(HandleValue text, TokenPos *pos, MutableHandleValue dst);
|
||||
|
||||
bool xmlComment(HandleValue text, TokenPos *pos, MutableHandleValue dst);
|
||||
|
||||
bool xmlPI(HandleValue target, HandleValue content, TokenPos *pos, MutableHandleValue dst);
|
||||
};
|
||||
|
||||
bool
|
||||
@ -1497,195 +1450,6 @@ NodeBuilder::function(ASTType type, TokenPos *pos,
|
||||
dst);
|
||||
}
|
||||
|
||||
bool
|
||||
NodeBuilder::xmlAnyName(TokenPos *pos, MutableHandleValue dst)
|
||||
{
|
||||
RootedValue cb(cx, callbacks[AST_XMLANYNAME]);
|
||||
if (!cb.isNull())
|
||||
return callback(cb, pos, dst);
|
||||
|
||||
return newNode(AST_XMLANYNAME, pos, dst);
|
||||
}
|
||||
|
||||
bool
|
||||
NodeBuilder::xmlEscapeExpression(HandleValue expr, TokenPos *pos, MutableHandleValue dst)
|
||||
{
|
||||
RootedValue cb(cx, callbacks[AST_XMLESCAPE]);
|
||||
if (!cb.isNull())
|
||||
return callback(cb, expr, pos, dst);
|
||||
|
||||
return newNode(AST_XMLESCAPE, pos, "expression", expr, dst);
|
||||
}
|
||||
|
||||
bool
|
||||
NodeBuilder::xmlFilterExpression(HandleValue left, HandleValue right, TokenPos *pos,
|
||||
MutableHandleValue dst)
|
||||
{
|
||||
RootedValue cb(cx, callbacks[AST_XMLFILTER]);
|
||||
if (!cb.isNull())
|
||||
return callback(cb, left, right, pos, dst);
|
||||
|
||||
return newNode(AST_XMLFILTER, pos, "left", left, "right", right, dst);
|
||||
}
|
||||
|
||||
bool
|
||||
NodeBuilder::xmlDefaultNamespace(HandleValue ns, TokenPos *pos, MutableHandleValue dst)
|
||||
{
|
||||
RootedValue cb(cx, callbacks[AST_XMLDEFAULT]);
|
||||
if (!cb.isNull())
|
||||
return callback(cb, ns, pos, dst);
|
||||
|
||||
return newNode(AST_XMLDEFAULT, pos, "namespace", ns, dst);
|
||||
}
|
||||
|
||||
bool
|
||||
NodeBuilder::xmlAttributeSelector(HandleValue expr, bool computed, TokenPos *pos,
|
||||
MutableHandleValue dst)
|
||||
{
|
||||
RootedValue computedVal(cx, BooleanValue(computed));
|
||||
|
||||
RootedValue cb(cx, callbacks[AST_XMLATTR_SEL]);
|
||||
if (!cb.isNull())
|
||||
return callback(cb, expr, computedVal, pos, dst);
|
||||
|
||||
return newNode(AST_XMLATTR_SEL, pos,
|
||||
"attribute", expr,
|
||||
"computed", computedVal,
|
||||
dst);
|
||||
}
|
||||
|
||||
bool
|
||||
NodeBuilder::xmlFunctionQualifiedIdentifier(HandleValue right, bool computed, TokenPos *pos,
|
||||
MutableHandleValue dst)
|
||||
{
|
||||
RootedValue computedVal(cx, BooleanValue(computed));
|
||||
|
||||
RootedValue cb(cx, callbacks[AST_XMLFUNCQUAL]);
|
||||
if (!cb.isNull())
|
||||
return callback(cb, right, computedVal, pos, dst);
|
||||
|
||||
return newNode(AST_XMLFUNCQUAL, pos,
|
||||
"right", right,
|
||||
"computed", computedVal,
|
||||
dst);
|
||||
}
|
||||
|
||||
bool
|
||||
NodeBuilder::xmlQualifiedIdentifier(HandleValue left, HandleValue right, bool computed,
|
||||
TokenPos *pos, MutableHandleValue dst)
|
||||
{
|
||||
RootedValue computedVal(cx, BooleanValue(computed));
|
||||
|
||||
RootedValue cb(cx, callbacks[AST_XMLQUAL]);
|
||||
if (!cb.isNull())
|
||||
return callback(cb, left, right, computedVal, pos, dst);
|
||||
|
||||
return newNode(AST_XMLQUAL, pos,
|
||||
"left", left,
|
||||
"right", right,
|
||||
"computed", computedVal,
|
||||
dst);
|
||||
}
|
||||
|
||||
bool
|
||||
NodeBuilder::xmlElement(NodeVector &elts, TokenPos *pos, MutableHandleValue dst)
|
||||
{
|
||||
return listNode(AST_XMLELEM, "contents", elts, pos, dst);
|
||||
}
|
||||
|
||||
bool
|
||||
NodeBuilder::xmlText(HandleValue text, TokenPos *pos, MutableHandleValue dst)
|
||||
{
|
||||
RootedValue cb(cx, callbacks[AST_XMLTEXT]);
|
||||
if (!cb.isNull())
|
||||
return callback(cb, text, pos, dst);
|
||||
|
||||
return newNode(AST_XMLTEXT, pos, "text", text, dst);
|
||||
}
|
||||
|
||||
bool
|
||||
NodeBuilder::xmlList(NodeVector &elts, TokenPos *pos, MutableHandleValue dst)
|
||||
{
|
||||
return listNode(AST_XMLLIST, "contents", elts, pos, dst);
|
||||
}
|
||||
|
||||
bool
|
||||
NodeBuilder::xmlStartTag(NodeVector &elts, TokenPos *pos, MutableHandleValue dst)
|
||||
{
|
||||
return listNode(AST_XMLSTART, "contents", elts, pos, dst);
|
||||
}
|
||||
|
||||
bool
|
||||
NodeBuilder::xmlEndTag(NodeVector &elts, TokenPos *pos, MutableHandleValue dst)
|
||||
{
|
||||
return listNode(AST_XMLEND, "contents", elts, pos, dst);
|
||||
}
|
||||
|
||||
bool
|
||||
NodeBuilder::xmlPointTag(NodeVector &elts, TokenPos *pos, MutableHandleValue dst)
|
||||
{
|
||||
return listNode(AST_XMLPOINT, "contents", elts, pos, dst);
|
||||
}
|
||||
|
||||
bool
|
||||
NodeBuilder::xmlName(HandleValue text, TokenPos *pos, MutableHandleValue dst)
|
||||
{
|
||||
RootedValue cb(cx, callbacks[AST_XMLNAME]);
|
||||
if (!cb.isNull())
|
||||
return callback(cb, text, pos, dst);
|
||||
|
||||
return newNode(AST_XMLNAME, pos, "contents", text, dst);
|
||||
}
|
||||
|
||||
bool
|
||||
NodeBuilder::xmlName(NodeVector &elts, TokenPos *pos, MutableHandleValue dst)
|
||||
{
|
||||
return listNode(AST_XMLNAME, "contents", elts, pos, dst);
|
||||
}
|
||||
|
||||
bool
|
||||
NodeBuilder::xmlAttribute(HandleValue text, TokenPos *pos, MutableHandleValue dst)
|
||||
{
|
||||
RootedValue cb(cx, callbacks[AST_XMLATTR]);
|
||||
if (!cb.isNull())
|
||||
return callback(cb, text, pos, dst);
|
||||
|
||||
return newNode(AST_XMLATTR, pos, "value", text, dst);
|
||||
}
|
||||
|
||||
bool
|
||||
NodeBuilder::xmlCdata(HandleValue text, TokenPos *pos, MutableHandleValue dst)
|
||||
{
|
||||
RootedValue cb(cx, callbacks[AST_XMLCDATA]);
|
||||
if (!cb.isNull())
|
||||
return callback(cb, text, pos, dst);
|
||||
|
||||
return newNode(AST_XMLCDATA, pos, "contents", text, dst);
|
||||
}
|
||||
|
||||
bool
|
||||
NodeBuilder::xmlComment(HandleValue text, TokenPos *pos, MutableHandleValue dst)
|
||||
{
|
||||
RootedValue cb(cx, callbacks[AST_XMLCOMMENT]);
|
||||
if (!cb.isNull())
|
||||
return callback(cb, text, pos, dst);
|
||||
|
||||
return newNode(AST_XMLCOMMENT, pos, "contents", text, dst);
|
||||
}
|
||||
|
||||
bool
|
||||
NodeBuilder::xmlPI(HandleValue target, HandleValue contents, TokenPos *pos, MutableHandleValue dst)
|
||||
{
|
||||
RootedValue cb(cx, callbacks[AST_XMLPI]);
|
||||
if (!cb.isNull())
|
||||
return callback(cb, target, contents, pos, dst);
|
||||
|
||||
return newNode(AST_XMLPI, pos,
|
||||
"target", target,
|
||||
"contents", contents,
|
||||
dst);
|
||||
}
|
||||
|
||||
/*
|
||||
* Serialization of parse nodes to JavaScript objects.
|
||||
*
|
||||
@ -1708,7 +1472,6 @@ class ASTSerializer
|
||||
|
||||
bool statements(ParseNode *pn, NodeVector &elts);
|
||||
bool expressions(ParseNode *pn, NodeVector &elts);
|
||||
bool xmls(ParseNode *pn, NodeVector &elts);
|
||||
bool leftAssociate(ParseNode *pn, MutableHandleValue dst);
|
||||
bool functionArgs(ParseNode *pn, ParseNode *pnargs, ParseNode *pndestruct, ParseNode *pnbody,
|
||||
NodeVector &args, NodeVector &defaults, MutableHandleValue rest);
|
||||
@ -1776,8 +1539,6 @@ class ASTSerializer
|
||||
bool comprehension(ParseNode *pn, MutableHandleValue dst);
|
||||
bool generatorExpression(ParseNode *pn, MutableHandleValue dst);
|
||||
|
||||
bool xml(ParseNode *pn, MutableHandleValue dst);
|
||||
|
||||
public:
|
||||
ASTSerializer(JSContext *c, bool l, char const *src, uint32_t ln)
|
||||
: cx(c)
|
||||
@ -1902,8 +1663,6 @@ ASTSerializer::binop(ParseNodeKind kind, JSOp op)
|
||||
return BINOP_IN;
|
||||
case PNK_INSTANCEOF:
|
||||
return BINOP_INSTANCEOF;
|
||||
case PNK_DBLDOT:
|
||||
return BINOP_DBLDOT;
|
||||
default:
|
||||
return BINOP_ERR;
|
||||
}
|
||||
@ -1948,24 +1707,6 @@ ASTSerializer::expressions(ParseNode *pn, NodeVector &elts)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
ASTSerializer::xmls(ParseNode *pn, NodeVector &elts)
|
||||
{
|
||||
if (!elts.reserve(pn->pn_count))
|
||||
return false;
|
||||
|
||||
for (ParseNode *next = pn->pn_head; next; next = next->pn_next) {
|
||||
JS_ASSERT(pn->pn_pos.encloses(next->pn_pos));
|
||||
|
||||
RootedValue elt(cx);
|
||||
if (!xml(next, &elt))
|
||||
return false;
|
||||
elts.infallibleAppend(elt);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
ASTSerializer::blockStatement(ParseNode *pn, MutableHandleValue dst)
|
||||
{
|
||||
@ -2420,20 +2161,6 @@ ASTSerializer::statement(ParseNode *pn, MutableHandleValue dst)
|
||||
case PNK_DEBUGGER:
|
||||
return builder.debuggerStatement(&pn->pn_pos, dst);
|
||||
|
||||
#if JS_HAS_XML_SUPPORT
|
||||
case PNK_DEFXMLNS:
|
||||
{
|
||||
JS_ASSERT(pn->pn_pos.encloses(pn->pn_kid->pn_pos));
|
||||
|
||||
LOCAL_ASSERT(pn->isArity(PN_UNARY));
|
||||
|
||||
RootedValue ns(cx);
|
||||
|
||||
return expression(pn->pn_kid, &ns) &&
|
||||
builder.xmlDefaultNamespace(ns, &pn->pn_pos, dst);
|
||||
}
|
||||
#endif
|
||||
|
||||
case PNK_NOP:
|
||||
return builder.emptyStatement(&pn->pn_pos, dst);
|
||||
|
||||
@ -2677,7 +2404,6 @@ ASTSerializer::expression(ParseNode *pn, MutableHandleValue dst)
|
||||
case PNK_BITAND:
|
||||
case PNK_IN:
|
||||
case PNK_INSTANCEOF:
|
||||
case PNK_DBLDOT:
|
||||
if (pn->isArity(PN_BINARY)) {
|
||||
JS_ASSERT(pn->pn_pos.encloses(pn->pn_left->pn_pos));
|
||||
JS_ASSERT(pn->pn_pos.encloses(pn->pn_right->pn_pos));
|
||||
@ -2852,189 +2578,8 @@ ASTSerializer::expression(ParseNode *pn, MutableHandleValue dst)
|
||||
case PNK_LET:
|
||||
return let(pn, true, dst);
|
||||
|
||||
#if JS_HAS_XML_SUPPORT
|
||||
case PNK_XMLUNARY:
|
||||
JS_ASSERT(pn->isOp(JSOP_XMLNAME) ||
|
||||
pn->isOp(JSOP_SETXMLNAME) ||
|
||||
pn->isOp(JSOP_BINDXMLNAME));
|
||||
return expression(pn->pn_kid, dst);
|
||||
|
||||
case PNK_ANYNAME:
|
||||
return builder.xmlAnyName(&pn->pn_pos, dst);
|
||||
|
||||
case PNK_DBLCOLON:
|
||||
{
|
||||
RootedValue right(cx);
|
||||
|
||||
LOCAL_ASSERT(pn->isArity(PN_NAME) || pn->isArity(PN_BINARY));
|
||||
|
||||
ParseNode *pnleft;
|
||||
bool computed;
|
||||
|
||||
if (pn->isArity(PN_BINARY)) {
|
||||
JS_ASSERT(pn->pn_pos.encloses(pn->pn_left->pn_pos));
|
||||
JS_ASSERT(pn->pn_pos.encloses(pn->pn_right->pn_pos));
|
||||
|
||||
computed = true;
|
||||
pnleft = pn->pn_left;
|
||||
if (!expression(pn->pn_right, &right))
|
||||
return false;
|
||||
} else {
|
||||
JS_ASSERT(pn->isArity(PN_NAME));
|
||||
JS_ASSERT(pn->pn_pos.encloses(pn->pn_expr->pn_pos));
|
||||
|
||||
computed = false;
|
||||
pnleft = pn->pn_expr;
|
||||
RootedAtom pnAtom(cx, pn->pn_atom);
|
||||
if (!identifier(pnAtom, NULL, &right))
|
||||
return false;
|
||||
}
|
||||
|
||||
if (pnleft->isKind(PNK_FUNCTIONNS))
|
||||
return builder.xmlFunctionQualifiedIdentifier(right, computed, &pn->pn_pos, dst);
|
||||
|
||||
RootedValue left(cx);
|
||||
return expression(pnleft, &left) &&
|
||||
builder.xmlQualifiedIdentifier(left, right, computed, &pn->pn_pos, dst);
|
||||
}
|
||||
|
||||
case PNK_AT:
|
||||
{
|
||||
JS_ASSERT(pn->pn_pos.encloses(pn->pn_kid->pn_pos));
|
||||
|
||||
RootedValue expr(cx);
|
||||
ParseNode *kid = pn->pn_kid;
|
||||
bool computed = ((!kid->isKind(PNK_NAME) || !kid->isOp(JSOP_QNAMEPART)) &&
|
||||
!kid->isKind(PNK_DBLCOLON) &&
|
||||
!kid->isKind(PNK_ANYNAME));
|
||||
return expression(kid, &expr) &&
|
||||
builder.xmlAttributeSelector(expr, computed, &pn->pn_pos, dst);
|
||||
}
|
||||
|
||||
case PNK_FILTER:
|
||||
{
|
||||
JS_ASSERT(pn->pn_pos.encloses(pn->pn_left->pn_pos));
|
||||
JS_ASSERT(pn->pn_pos.encloses(pn->pn_right->pn_pos));
|
||||
|
||||
RootedValue left(cx), right(cx);
|
||||
return expression(pn->pn_left, &left) &&
|
||||
expression(pn->pn_right, &right) &&
|
||||
builder.xmlFilterExpression(left, right, &pn->pn_pos, dst);
|
||||
}
|
||||
|
||||
default:
|
||||
return xml(pn, dst);
|
||||
|
||||
#else
|
||||
default:
|
||||
LOCAL_NOT_REACHED("unexpected expression type");
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
ASTSerializer::xml(ParseNode *pn, MutableHandleValue dst)
|
||||
{
|
||||
JS_CHECK_RECURSION(cx, return false);
|
||||
switch (pn->getKind()) {
|
||||
#if JS_HAS_XML_SUPPORT
|
||||
case PNK_XMLCURLYEXPR:
|
||||
{
|
||||
JS_ASSERT(pn->pn_pos.encloses(pn->pn_kid->pn_pos));
|
||||
|
||||
RootedValue expr(cx);
|
||||
return expression(pn->pn_kid, &expr) &&
|
||||
builder.xmlEscapeExpression(expr, &pn->pn_pos, dst);
|
||||
}
|
||||
|
||||
case PNK_XMLELEM:
|
||||
{
|
||||
NodeVector elts(cx);
|
||||
if (!xmls(pn, elts))
|
||||
return false;
|
||||
return builder.xmlElement(elts, &pn->pn_pos, dst);
|
||||
}
|
||||
|
||||
case PNK_XMLLIST:
|
||||
{
|
||||
NodeVector elts(cx);
|
||||
if (!xmls(pn, elts))
|
||||
return false;
|
||||
return builder.xmlList(elts, &pn->pn_pos, dst);
|
||||
}
|
||||
|
||||
case PNK_XMLSTAGO:
|
||||
{
|
||||
NodeVector elts(cx);
|
||||
if (!xmls(pn, elts))
|
||||
return false;
|
||||
return builder.xmlStartTag(elts, &pn->pn_pos, dst);
|
||||
}
|
||||
|
||||
case PNK_XMLETAGO:
|
||||
{
|
||||
NodeVector elts(cx);
|
||||
if (!xmls(pn, elts))
|
||||
return false;
|
||||
return builder.xmlEndTag(elts, &pn->pn_pos, dst);
|
||||
}
|
||||
|
||||
case PNK_XMLPTAGC:
|
||||
{
|
||||
NodeVector elts(cx);
|
||||
if (!xmls(pn, elts))
|
||||
return false;
|
||||
return builder.xmlPointTag(elts, &pn->pn_pos, dst);
|
||||
}
|
||||
|
||||
case PNK_XMLTEXT:
|
||||
case PNK_XMLSPACE: {
|
||||
RootedValue atomContentsVal(cx, unrootedAtomContents(pn->pn_atom));
|
||||
return builder.xmlText(atomContentsVal, &pn->pn_pos, dst);
|
||||
}
|
||||
|
||||
case PNK_XMLNAME:
|
||||
if (pn->isArity(PN_NULLARY)) {
|
||||
RootedValue atomContentsVal(cx, unrootedAtomContents(pn->pn_atom));
|
||||
return builder.xmlName(atomContentsVal, &pn->pn_pos, dst);
|
||||
}
|
||||
|
||||
LOCAL_ASSERT(pn->isArity(PN_LIST));
|
||||
|
||||
{
|
||||
NodeVector elts(cx);
|
||||
return xmls(pn, elts) &&
|
||||
builder.xmlName(elts, &pn->pn_pos, dst);
|
||||
}
|
||||
|
||||
case PNK_XMLATTR: {
|
||||
RootedValue atomContentsVal(cx, unrootedAtomContents(pn->pn_atom));
|
||||
return builder.xmlAttribute(atomContentsVal, &pn->pn_pos, dst);
|
||||
}
|
||||
|
||||
case PNK_XMLCDATA: {
|
||||
RootedValue atomContentsVal(cx, unrootedAtomContents(pn->pn_atom));
|
||||
return builder.xmlCdata(atomContentsVal, &pn->pn_pos, dst);
|
||||
}
|
||||
|
||||
case PNK_XMLCOMMENT: {
|
||||
RootedValue atomContentsVal(cx, unrootedAtomContents(pn->pn_atom));
|
||||
return builder.xmlComment(atomContentsVal, &pn->pn_pos, dst);
|
||||
}
|
||||
|
||||
case PNK_XMLPI: {
|
||||
XMLProcessingInstruction &pi = pn->as<XMLProcessingInstruction>();
|
||||
RootedValue targetAtomContentsVal(cx, unrootedAtomContents(pi.target()));
|
||||
RootedValue dataAtomContentsVal(cx, unrootedAtomContents(pi.data()));
|
||||
return builder.xmlPI(targetAtomContentsVal,
|
||||
dataAtomContentsVal,
|
||||
&pi.pn_pos,
|
||||
dst);
|
||||
}
|
||||
#endif
|
||||
|
||||
default:
|
||||
LOCAL_NOT_REACHED("unexpected XML node type");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -54,8 +54,6 @@ enum BinaryOperator {
|
||||
BINOP_BITOR, BINOP_BITXOR, BINOP_BITAND,
|
||||
/* misc */
|
||||
BINOP_IN, BINOP_INSTANCEOF,
|
||||
/* xml */
|
||||
BINOP_DBLDOT,
|
||||
|
||||
BINOP_LIMIT
|
||||
};
|
||||
|
@ -45,13 +45,6 @@ Wrapper::New(JSContext *cx, JSObject *obj, JSObject *proto, JSObject *parent,
|
||||
|
||||
AutoMarkInDeadCompartment amd(cx->compartment);
|
||||
|
||||
#if JS_HAS_XML_SUPPORT
|
||||
if (obj->isXML()) {
|
||||
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL,
|
||||
JSMSG_CANT_WRAP_XML_OBJECT);
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
return NewProxyObject(cx, handler, ObjectValue(*obj), proto, parent,
|
||||
obj->isCallable() ? obj : NULL, NULL);
|
||||
}
|
||||
@ -59,14 +52,6 @@ Wrapper::New(JSContext *cx, JSObject *obj, JSObject *proto, JSObject *parent,
|
||||
JSObject *
|
||||
Wrapper::Renew(JSContext *cx, JSObject *existing, JSObject *obj, Wrapper *handler)
|
||||
{
|
||||
#if JS_HAS_XML_SUPPORT
|
||||
if (obj->isXML()) {
|
||||
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL,
|
||||
JSMSG_CANT_WRAP_XML_OBJECT);
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
JS_ASSERT(!obj->isCallable());
|
||||
return RenewProxyObject(cx, existing, handler, ObjectValue(*obj));
|
||||
}
|
||||
|
8032
js/src/jsxml.cpp
8032
js/src/jsxml.cpp
File diff suppressed because it is too large
Load Diff
314
js/src/jsxml.h
314
js/src/jsxml.h
@ -1,314 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef jsxml_h___
|
||||
#define jsxml_h___
|
||||
|
||||
#include "jspubtd.h"
|
||||
#include "jsobj.h"
|
||||
|
||||
#include "gc/Barrier.h"
|
||||
#include "gc/Heap.h"
|
||||
|
||||
#if JS_HAS_XML_SUPPORT
|
||||
extern JSObject *
|
||||
js_InitXMLClass(JSContext *cx, js::HandleObject obj);
|
||||
extern JSObject *
|
||||
js_InitNamespaceClass(JSContext *cx, js::HandleObject obj);
|
||||
extern JSObject *
|
||||
js_InitQNameClass(JSContext *cx, js::HandleObject obj);
|
||||
#else
|
||||
#define js_InitXMLClass js_InitNullClass
|
||||
#define js_InitNamespaceClass js_InitNullClass
|
||||
#define js_InitQNameClass js_InitNullClass
|
||||
#endif
|
||||
|
||||
#if JS_HAS_XML_SUPPORT
|
||||
|
||||
extern const char js_AnyName_str[];
|
||||
extern const char js_AttributeName_str[];
|
||||
extern const char js_isXMLName_str[];
|
||||
extern const char js_XMLList_str[];
|
||||
|
||||
extern const char js_amp_entity_str[];
|
||||
extern const char js_gt_entity_str[];
|
||||
extern const char js_lt_entity_str[];
|
||||
extern const char js_quot_entity_str[];
|
||||
|
||||
template<class T>
|
||||
struct JSXMLArrayCursor;
|
||||
|
||||
template<class T>
|
||||
struct JSXMLArray
|
||||
{
|
||||
uint32_t length;
|
||||
uint32_t capacity;
|
||||
js::HeapPtr<T> *vector;
|
||||
JSXMLArrayCursor<T> *cursors;
|
||||
|
||||
void init() {
|
||||
length = capacity = 0;
|
||||
vector = NULL;
|
||||
cursors = NULL;
|
||||
}
|
||||
|
||||
void finish(js::FreeOp *fop);
|
||||
|
||||
bool setCapacity(JSContext *cx, uint32_t capacity);
|
||||
void trim();
|
||||
};
|
||||
|
||||
template<class T>
|
||||
struct JSXMLArrayCursor
|
||||
{
|
||||
typedef js::HeapPtr<T> HeapPtrT;
|
||||
|
||||
JSXMLArray<T> *array;
|
||||
uint32_t index;
|
||||
JSXMLArrayCursor<T> *next;
|
||||
JSXMLArrayCursor<T> **prevp;
|
||||
HeapPtrT root;
|
||||
|
||||
JSXMLArrayCursor(JSXMLArray<T> *array)
|
||||
: array(array), index(0), next(array->cursors), prevp(&array->cursors),
|
||||
root(NULL)
|
||||
{
|
||||
if (next)
|
||||
next->prevp = &next;
|
||||
array->cursors = this;
|
||||
}
|
||||
|
||||
~JSXMLArrayCursor() { disconnect(); }
|
||||
|
||||
void disconnect() {
|
||||
if (!array)
|
||||
return;
|
||||
if (next)
|
||||
next->prevp = prevp;
|
||||
*prevp = next;
|
||||
array = NULL;
|
||||
root.~HeapPtrT();
|
||||
}
|
||||
|
||||
T *getNext() {
|
||||
if (!array || index >= array->length)
|
||||
return NULL;
|
||||
return root = array->vector[index++];
|
||||
}
|
||||
|
||||
T *getCurrent() {
|
||||
if (!array || index >= array->length)
|
||||
return NULL;
|
||||
return root = array->vector[index];
|
||||
}
|
||||
};
|
||||
|
||||
void js_XMLArrayCursorTrace(JSTracer *trc, JSXMLArrayCursor<JSXML> *cursor);
|
||||
void js_XMLArrayCursorTrace(JSTracer *trc, JSXMLArrayCursor<JSObject> *cursor);
|
||||
|
||||
#define JSXML_PRESET_CAPACITY JS_BIT(31)
|
||||
#define JSXML_CAPACITY_MASK JS_BITMASK(31)
|
||||
#define JSXML_CAPACITY(array) ((array)->capacity & JSXML_CAPACITY_MASK)
|
||||
|
||||
/*
|
||||
* NB: don't reorder this enum without changing all array initializers that
|
||||
* depend on it in jsxml.c.
|
||||
*/
|
||||
typedef enum JSXMLClass {
|
||||
JSXML_CLASS_LIST,
|
||||
JSXML_CLASS_ELEMENT,
|
||||
JSXML_CLASS_ATTRIBUTE,
|
||||
JSXML_CLASS_PROCESSING_INSTRUCTION,
|
||||
JSXML_CLASS_TEXT,
|
||||
JSXML_CLASS_COMMENT,
|
||||
JSXML_CLASS_LIMIT
|
||||
} JSXMLClass;
|
||||
|
||||
#define JSXML_CLASS_HAS_KIDS(class_) ((class_) < JSXML_CLASS_ATTRIBUTE)
|
||||
#define JSXML_CLASS_HAS_VALUE(class_) ((class_) >= JSXML_CLASS_ATTRIBUTE)
|
||||
#define JSXML_CLASS_HAS_NAME(class_) \
|
||||
((unsigned)((class_) - JSXML_CLASS_ELEMENT) <= \
|
||||
(unsigned)(JSXML_CLASS_PROCESSING_INSTRUCTION - JSXML_CLASS_ELEMENT))
|
||||
|
||||
#ifdef DEBUG_notme
|
||||
#include "jsclist.h"
|
||||
#endif
|
||||
|
||||
typedef struct JSXMLListVar {
|
||||
JSXMLArray<JSXML> kids; /* NB: must come first */
|
||||
js::HeapPtrXML target;
|
||||
js::HeapPtrObject targetprop;
|
||||
} JSXMLListVar;
|
||||
|
||||
typedef struct JSXMLElemVar {
|
||||
JSXMLArray<JSXML> kids; /* NB: must come first */
|
||||
JSXMLArray<JSObject> namespaces;
|
||||
JSXMLArray<JSXML> attrs;
|
||||
} JSXMLElemVar;
|
||||
|
||||
/* union member shorthands */
|
||||
#define xml_kids list.kids
|
||||
#define xml_target list.target
|
||||
#define xml_targetprop list.targetprop
|
||||
#define xml_namespaces elem.namespaces
|
||||
#define xml_attrs elem.attrs
|
||||
#define xml_value value
|
||||
|
||||
/* xml_class-testing macros */
|
||||
#define JSXML_HAS_KIDS(xml) JSXML_CLASS_HAS_KIDS((xml)->xml_class)
|
||||
#define JSXML_HAS_VALUE(xml) JSXML_CLASS_HAS_VALUE((xml)->xml_class)
|
||||
#define JSXML_HAS_NAME(xml) JSXML_CLASS_HAS_NAME((xml)->xml_class)
|
||||
#define JSXML_LENGTH(xml) (JSXML_CLASS_HAS_KIDS((xml)->xml_class) \
|
||||
? (xml)->xml_kids.length \
|
||||
: 0)
|
||||
|
||||
struct JSXML : js::gc::Cell {
|
||||
#ifdef DEBUG_notme
|
||||
JSCList links;
|
||||
uint32_t serial;
|
||||
#endif
|
||||
js::HeapPtrObject object;
|
||||
void *domnode; /* DOM node if mapped info item */
|
||||
js::HeapPtrXML parent;
|
||||
js::HeapPtrObject name;
|
||||
uint32_t xml_class; /* discriminates u, below */
|
||||
uint32_t xml_flags; /* flags, see below */
|
||||
|
||||
JSXMLListVar list;
|
||||
JSXMLElemVar elem;
|
||||
js::HeapPtrString value;
|
||||
|
||||
#if JS_BITS_PER_WORD == 32
|
||||
/* The size of every GC thing must be divisible by the FreeCell size. */
|
||||
void *pad;
|
||||
#endif
|
||||
|
||||
void finalize(js::FreeOp *fop);
|
||||
|
||||
static void writeBarrierPre(JSXML *xml);
|
||||
static void writeBarrierPost(JSXML *xml, void *addr);
|
||||
|
||||
static inline js::ThingRootKind rootKind() { return js::THING_ROOT_XML; }
|
||||
};
|
||||
|
||||
/* xml_flags values */
|
||||
#define XMLF_WHITESPACE_TEXT 0x1
|
||||
|
||||
extern JSXML *
|
||||
js_NewXML(JSContext *cx, JSXMLClass xml_class);
|
||||
|
||||
extern void
|
||||
js_TraceXML(JSTracer *trc, JSXML *xml);
|
||||
|
||||
extern JSObject *
|
||||
js_NewXMLObject(JSContext *cx, JSXMLClass xml_class);
|
||||
|
||||
extern JSObject *
|
||||
js_GetXMLObject(JSContext *cx, JSXML *xml);
|
||||
|
||||
extern JSObject *
|
||||
js_InitXMLClasses(JSContext *cx, js::HandleObject obj);
|
||||
|
||||
/*
|
||||
* If obj is a QName corresponding to function::name, set *funidp to name's id
|
||||
* and return true, else return false.
|
||||
*/
|
||||
extern bool
|
||||
js_GetLocalNameFromFunctionQName(JSObject *obj, jsid *funidp, JSContext *cx);
|
||||
|
||||
extern JSBool
|
||||
js_GetDefaultXMLNamespace(JSContext *cx, jsval *vp);
|
||||
|
||||
extern JSBool
|
||||
js_SetDefaultXMLNamespace(JSContext *cx, const js::Value &v);
|
||||
|
||||
/*
|
||||
* Return true if v is a XML QName object, or if it converts to a string that
|
||||
* contains a valid XML qualified name (one containing no :), false otherwise.
|
||||
* NB: This function is an infallible predicate, it hides exceptions.
|
||||
*/
|
||||
extern JSBool
|
||||
js_IsXMLName(JSContext *cx, jsval v);
|
||||
|
||||
extern JSBool
|
||||
js_ToAttributeName(JSContext *cx, js::Value *vp);
|
||||
|
||||
extern JSFlatString *
|
||||
js_EscapeAttributeValue(JSContext *cx, JSString *str, JSBool quote);
|
||||
|
||||
extern JSString *
|
||||
js_AddAttributePart(JSContext *cx, JSBool isName, JSString *str,
|
||||
JSString *str2);
|
||||
|
||||
extern JSFlatString *
|
||||
js_EscapeElementValue(JSContext *cx, JSString *str);
|
||||
|
||||
extern JSString *
|
||||
js_ValueToXMLString(JSContext *cx, const js::Value &v);
|
||||
|
||||
extern JSObject *
|
||||
js_ConstructXMLQNameObject(JSContext *cx, const js::Value & nsval,
|
||||
const js::Value & lnval);
|
||||
|
||||
extern JSBool
|
||||
js_GetAnyName(JSContext *cx, jsid *idp);
|
||||
|
||||
/*
|
||||
* Note: nameval must be either QName, AttributeName, or AnyName.
|
||||
*/
|
||||
extern JSBool
|
||||
js_FindXMLProperty(JSContext *cx, const js::Value &nameval,
|
||||
js::MutableHandleObject objp, jsid *idp);
|
||||
|
||||
extern JSBool
|
||||
js_GetXMLMethod(JSContext *cx, js::HandleObject obj, jsid id, js::MutableHandleValue vp);
|
||||
|
||||
extern JSBool
|
||||
js_GetXMLDescendants(JSContext *cx, JSObject *obj, jsval id, jsval *vp);
|
||||
|
||||
extern JSBool
|
||||
js_DeleteXMLListElements(JSContext *cx, JSObject *listobj);
|
||||
|
||||
extern JSBool
|
||||
js_StepXMLListFilter(JSContext *cx, JSBool initialized);
|
||||
|
||||
extern JSObject *
|
||||
js_ValueToXMLObject(JSContext *cx, const js::Value &v);
|
||||
|
||||
extern JSObject *
|
||||
js_ValueToXMLListObject(JSContext *cx, const js::Value &v);
|
||||
|
||||
extern JSObject *
|
||||
js_NewXMLSpecialObject(JSContext *cx, JSXMLClass xml_class, JSString *name,
|
||||
JSString *value);
|
||||
|
||||
extern JSString *
|
||||
js_MakeXMLCDATAString(JSContext *cx, JSString *str);
|
||||
|
||||
extern JSString *
|
||||
js_MakeXMLCommentString(JSContext *cx, JSString *str);
|
||||
|
||||
extern JSString *
|
||||
js_MakeXMLPIString(JSContext *cx, JSString *name, JSString *str);
|
||||
|
||||
/* The caller must ensure that either v1 or v2 is an object. */
|
||||
extern JSBool
|
||||
js_TestXMLEquality(JSContext *cx, const js::Value &v1, const js::Value &v2,
|
||||
JSBool *bp);
|
||||
|
||||
extern JSBool
|
||||
js_ConcatenateXML(JSContext *cx, JSObject *obj1, JSObject *obj2, js::Value *vp);
|
||||
|
||||
namespace js {
|
||||
|
||||
extern bool
|
||||
GetLocalNameFromFunctionQName(JSObject *qn, JSAtom **namep, JSContext *cx);
|
||||
|
||||
} /* namespace js */
|
||||
|
||||
#endif /* JS_HAS_XML_SUPPORT */
|
||||
|
||||
#endif /* jsxml_h___ */
|
@ -13,7 +13,6 @@
|
||||
#include "jslibmath.h"
|
||||
#include "jsiter.h"
|
||||
#include "jsnum.h"
|
||||
#include "jsxml.h"
|
||||
#include "jsbool.h"
|
||||
#include "jstypes.h"
|
||||
|
||||
|
@ -2638,16 +2638,6 @@ ic::GetElement(VMFrame &f, ic::GetElementIC *ic)
|
||||
if (!obj)
|
||||
THROW();
|
||||
|
||||
#if JS_HAS_XML_SUPPORT
|
||||
// Some XML properties behave differently when accessed in a call vs. normal
|
||||
// context, so we fall back to stubs::GetElem.
|
||||
if (obj->isXML()) {
|
||||
ic->disable(f, "XML object");
|
||||
stubs::GetElem(f);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
Rooted<jsid> id(cx);
|
||||
if (idval.isInt32() && INT_FITS_IN_JSID(idval.toInt32())) {
|
||||
id = INT_TO_JSID(idval.toInt32());
|
||||
|
@ -13,7 +13,6 @@
|
||||
#include "jslibmath.h"
|
||||
#include "jsiter.h"
|
||||
#include "jsnum.h"
|
||||
#include "jsxml.h"
|
||||
#include "jsbool.h"
|
||||
#include "assembler/assembler/MacroAssemblerCodeRef.h"
|
||||
#include "jstypes.h"
|
||||
@ -485,19 +484,7 @@ StubEqualityOp(VMFrame &f)
|
||||
if (!EqualStrings(cx, l, r, &equal))
|
||||
return false;
|
||||
cond = equal == EQ;
|
||||
} else
|
||||
#if JS_HAS_XML_SUPPORT
|
||||
if ((lval.isObject() && lval.toObject().isXML()) ||
|
||||
(rval.isObject() && rval.toObject().isXML()))
|
||||
{
|
||||
JSBool equal;
|
||||
if (!js_TestXMLEquality(cx, lval, rval, &equal))
|
||||
return false;
|
||||
cond = !!equal == EQ;
|
||||
} else
|
||||
#endif
|
||||
|
||||
if (SameType(lval, rval)) {
|
||||
} else if (SameType(lval, rval)) {
|
||||
JS_ASSERT(!lval.isString()); /* this case is handled above */
|
||||
if (lval.isDouble()) {
|
||||
double l = lval.toDouble();
|
||||
@ -597,18 +584,7 @@ stubs::Add(VMFrame &f)
|
||||
rstr = rval.toString();
|
||||
goto string_concat;
|
||||
|
||||
} else
|
||||
#if JS_HAS_XML_SUPPORT
|
||||
if (lval.isObject() && lval.toObject().isXML() &&
|
||||
rval.isObject() && rval.toObject().isXML()) {
|
||||
if (!js_ConcatenateXML(cx, &lval.toObject(), &rval.toObject(), &rval))
|
||||
THROW();
|
||||
regs.sp[-2] = rval;
|
||||
regs.sp--;
|
||||
TypeScript::MonitorUnknown(cx, f.script(), f.pc());
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
} else {
|
||||
bool lIsObject = lval.isObject(), rIsObject = rval.isObject();
|
||||
if (!ToPrimitive(f.cx, &lval))
|
||||
THROW();
|
||||
|
@ -41,7 +41,6 @@
|
||||
#include "jstypedarray.h"
|
||||
#include "jstypedarrayinlines.h"
|
||||
#include "jsworkers.h"
|
||||
#include "jsxml.h"
|
||||
#include "jsperf.h"
|
||||
|
||||
#include "builtin/TestingFunctions.h"
|
||||
@ -717,8 +716,6 @@ static const struct JSOption {
|
||||
{"strict", JSOPTION_STRICT},
|
||||
{"typeinfer", JSOPTION_TYPE_INFERENCE},
|
||||
{"werror", JSOPTION_WERROR},
|
||||
{"allow_xml", JSOPTION_ALLOW_XML},
|
||||
{"moar_xml", JSOPTION_MOAR_XML},
|
||||
{"strict_mode", JSOPTION_STRICT_MODE},
|
||||
};
|
||||
|
||||
|
@ -13,23 +13,6 @@
|
||||
#include "jsprototypes.h"
|
||||
#include "jsversion.h"
|
||||
|
||||
#if JS_HAS_XML_SUPPORT
|
||||
#define FOR_EACH_XML_ONLY_NAME(macro) \
|
||||
macro(etago, etago, "</") \
|
||||
macro(functionNamespaceURI, functionNamespaceURI, "@mozilla.org/js/function") \
|
||||
macro(namespace, namespace_, "namespace") \
|
||||
macro(ptagc, ptagc, "/>") \
|
||||
macro(qualifier, qualifier, "::") \
|
||||
macro(space, space, " ") \
|
||||
macro(stago, stago, "<") \
|
||||
macro(star, star, "*") \
|
||||
macro(starQualifier, starQualifier, "*::") \
|
||||
macro(tagc, tagc, ">") \
|
||||
macro(XMLList, XMLList, "XMLList")
|
||||
#else
|
||||
#define FOR_EACH_XML_ONLY_NAME(macro) /* nothing */
|
||||
#endif /* JS_HAS_XML_SUPPORT */
|
||||
|
||||
#define FOR_EACH_COMMON_PROPERTYNAME(macro) \
|
||||
macro(anonymous, anonymous, "anonymous") \
|
||||
macro(apply, apply, "apply") \
|
||||
@ -90,7 +73,6 @@
|
||||
macro(isFinite, isFinite, "isFinite") \
|
||||
macro(isNaN, isNaN, "isNaN") \
|
||||
macro(isPrototypeOf, isPrototypeOf, "isPrototypeOf") \
|
||||
macro(isXMLName, isXMLName, "isXMLName") \
|
||||
macro(iterate, iterate, "iterate") \
|
||||
macro(Infinity, Infinity, "Infinity") \
|
||||
macro(iterator, iterator, "iterator") \
|
||||
@ -154,8 +136,6 @@
|
||||
macro(string, string, "string") \
|
||||
macro(number, number, "number") \
|
||||
macro(boolean, boolean, "boolean") \
|
||||
macro(null, null, "null") \
|
||||
macro(xml, xml, "xml") \
|
||||
FOR_EACH_XML_ONLY_NAME(macro)
|
||||
macro(null, null, "null")
|
||||
|
||||
#endif /* CommonPropertyNames_h__ */
|
||||
|
@ -467,9 +467,6 @@ GlobalObject::initStandardClasses(JSContext *cx, Handle<GlobalObject*> global)
|
||||
js_InitRegExpClass(cx, global) &&
|
||||
js_InitStringClass(cx, global) &&
|
||||
js_InitTypedArrayClasses(cx, global) &&
|
||||
#if JS_HAS_XML_SUPPORT
|
||||
(!VersionHasAllowXML(cx->findVersion()) || js_InitXMLClasses(cx, global)) &&
|
||||
#endif
|
||||
js_InitIteratorClasses(cx, global) &&
|
||||
js_InitDateClass(cx, global) &&
|
||||
js_InitWeakMapClass(cx, global) &&
|
||||
|
@ -49,11 +49,10 @@ class Debugger;
|
||||
* for the corresponding JSProtoKey offset from 2 * JSProto_LIMIT.
|
||||
* [3 * JSProto_LIMIT, RESERVED_SLOTS)
|
||||
* Various one-off values: ES5 13.2.3's [[ThrowTypeError]], RegExp statics,
|
||||
* the Namespace object for E4X's function::, the original eval for this
|
||||
* global object (implementing |var eval = otherWindow.eval; eval(...)| as an
|
||||
* indirect eval), a bit indicating whether this object has been cleared
|
||||
* (see JS_ClearScope), and a cache for whether eval is allowed (per the
|
||||
* global's Content Security Policy).
|
||||
* the original eval for this global object (implementing |var eval =
|
||||
* otherWindow.eval; eval(...)| as an indirect eval), a bit indicating
|
||||
* whether this object has been cleared (see JS_ClearScope), and a cache for
|
||||
* whether eval is allowed (per the global's Content Security Policy).
|
||||
*
|
||||
* The first two ranges are necessary to implement js::FindClassObject,
|
||||
* FindClassPrototype, and spec language speaking in terms of "the original
|
||||
@ -428,8 +427,6 @@ class GlobalObject : public JSObject
|
||||
return getSlot(EVAL);
|
||||
}
|
||||
|
||||
bool getFunctionNamespace(JSContext *cx, Value *vp);
|
||||
|
||||
// Implemented in jsiter.cpp.
|
||||
static bool initIteratorClasses(JSContext *cx, Handle<GlobalObject*> global);
|
||||
|
||||
|
@ -48,9 +48,8 @@ CastAsStrictPropertyOp(JSObject *object)
|
||||
* property storage, typed array data, and so on). All other properties are
|
||||
* stored using shapes and shape trees. Keys for these properties are either
|
||||
* PropertyNames (that is, atomized strings whose contents are not unsigned
|
||||
* 32-bit integers) or SpecialIds (object values for E4X and a couple other
|
||||
* things, see jsid for details); the union of these types, used in individual
|
||||
* shapes, is PropertyId.
|
||||
* 32-bit integers) or SpecialIds (see jsid for details); the union of these
|
||||
* types, used in individual shapes, is PropertyId.
|
||||
*/
|
||||
class PropertyId
|
||||
{
|
||||
|
@ -319,7 +319,7 @@ Shape::set(JSContext* cx, HandleObject obj, HandleObject receiver, bool strict,
|
||||
return false;
|
||||
|
||||
/*
|
||||
* |with (it) color;| ends up here, as do XML filter-expressions.
|
||||
* |with (it) color='red';| ends up here.
|
||||
* Avoid exposing the With object to native setters.
|
||||
*/
|
||||
if (obj->isWith()) {
|
||||
|
@ -701,9 +701,8 @@ class StackFrame
|
||||
/*
|
||||
* With
|
||||
*
|
||||
* Entering/leaving a with (or E4X filter) block pushes/pops an object
|
||||
* on the scope chain. Pushing uses pushOnScopeChain, popping should use
|
||||
* popWith.
|
||||
* Entering/leaving a |with| block pushes/pops an object on the scope chain.
|
||||
* Pushing uses pushOnScopeChain, popping should use popWith.
|
||||
*/
|
||||
|
||||
void popWith(JSContext *cx);
|
||||
|
@ -836,8 +836,8 @@ class StaticStrings
|
||||
* - uint32_t indexes,
|
||||
* - PropertyName strings which don't encode uint32_t indexes, and
|
||||
* - jsspecial special properties (non-ES5 properties like object-valued
|
||||
* jsids, JSID_EMPTY, JSID_VOID, E4X's default XML namespace, and maybe in
|
||||
* the future Harmony-proposed private names).
|
||||
* jsids, JSID_EMPTY, JSID_VOID, and maybe in the future Harmony-proposed
|
||||
* private names).
|
||||
*/
|
||||
class PropertyName : public JSAtom
|
||||
{};
|
||||
|
@ -60,9 +60,6 @@ namespace unicode {
|
||||
*
|
||||
* NO_DELTA
|
||||
* See comment in CharacterInfo
|
||||
*
|
||||
* ENCLOSING_MARK / COMBINING_SPACING_MARK
|
||||
* Something for E4X....
|
||||
*/
|
||||
|
||||
struct CharFlag {
|
||||
@ -70,9 +67,7 @@ struct CharFlag {
|
||||
SPACE = 1 << 0,
|
||||
LETTER = 1 << 1,
|
||||
IDENTIFIER_PART = 1 << 2,
|
||||
NO_DELTA = 1 << 3,
|
||||
ENCLOSING_MARK = 1 << 4,
|
||||
COMBINING_SPACING_MARK = 1 << 5
|
||||
NO_DELTA = 1 << 3
|
||||
};
|
||||
};
|
||||
|
||||
@ -116,14 +111,6 @@ class CharacterInfo {
|
||||
inline bool isIdentifierPart() const {
|
||||
return flags & (CharFlag::IDENTIFIER_PART | CharFlag::LETTER);
|
||||
}
|
||||
|
||||
inline bool isEnclosingMark() const {
|
||||
return flags & CharFlag::ENCLOSING_MARK;
|
||||
}
|
||||
|
||||
inline bool isCombiningSpacingMark() const {
|
||||
return flags & CharFlag::COMBINING_SPACING_MARK;
|
||||
}
|
||||
};
|
||||
|
||||
extern const uint8_t index1[];
|
||||
@ -237,51 +224,6 @@ ToLowerCase(jschar ch)
|
||||
return uint16_t(ch) + info.lowerCase;
|
||||
}
|
||||
|
||||
/* XML support functions */
|
||||
|
||||
inline bool
|
||||
IsXMLSpace(jschar ch)
|
||||
{
|
||||
return ch == ' ' || ch == '\t' || ch == '\r' || ch == '\n';
|
||||
}
|
||||
|
||||
inline bool
|
||||
IsXMLNamespaceStart(jschar ch)
|
||||
{
|
||||
if (ch == '_')
|
||||
return true;
|
||||
|
||||
return CharInfo(ch).isCombiningSpacingMark() || IsIdentifierStart(ch);
|
||||
}
|
||||
|
||||
inline bool
|
||||
IsXMLNamespacePart(jschar ch)
|
||||
{
|
||||
if (ch == '.' || ch == '-' || ch == '_')
|
||||
return true;
|
||||
|
||||
return CharInfo(ch).isEnclosingMark() || IsIdentifierPart(ch);
|
||||
}
|
||||
|
||||
inline bool
|
||||
IsXMLNameStart(jschar ch)
|
||||
{
|
||||
if (ch == '_' || ch == ':')
|
||||
return true;
|
||||
|
||||
return CharInfo(ch).isCombiningSpacingMark() || IsIdentifierStart(ch);
|
||||
}
|
||||
|
||||
inline bool
|
||||
IsXMLNamePart(jschar ch)
|
||||
{
|
||||
if (ch == '.' || ch == '-' || ch == '_' || ch == ':')
|
||||
return true;
|
||||
|
||||
return CharInfo(ch).isEnclosingMark() || IsIdentifierPart(ch);
|
||||
}
|
||||
|
||||
|
||||
} /* namespace unicode */
|
||||
} /* namespace js */
|
||||
|
||||
|
@ -25,7 +25,7 @@ namespace js {
|
||||
* and saved versions. If deserialization fails, the data should be
|
||||
* invalidated if possible.
|
||||
*/
|
||||
static const uint32_t XDR_BYTECODE_VERSION = uint32_t(0xb973c0de - 135);
|
||||
static const uint32_t XDR_BYTECODE_VERSION = uint32_t(0xb973c0de - 136);
|
||||
|
||||
class XDRBuffer {
|
||||
public:
|
||||
|
@ -384,9 +384,6 @@ interface nsIXPCComponents_Utils : nsISupports
|
||||
[implicit_jscontext]
|
||||
attribute boolean atline;
|
||||
|
||||
[implicit_jscontext]
|
||||
attribute boolean xml;
|
||||
|
||||
[implicit_jscontext]
|
||||
attribute boolean methodjit;
|
||||
|
||||
|
@ -471,11 +471,6 @@ mozJSComponentLoader::ReallyInit()
|
||||
if (!mContext)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
if (Preferences::GetBool("javascript.options.xml.chrome")) {
|
||||
uint32_t options = JS_GetOptions(mContext);
|
||||
JS_SetOptions(mContext, options | JSOPTION_ALLOW_XML | JSOPTION_MOAR_XML);
|
||||
}
|
||||
|
||||
// Always use the latest js version
|
||||
JS_SetVersion(mContext, JSVERSION_LATEST);
|
||||
|
||||
|
@ -702,8 +702,6 @@ static const struct JSOption {
|
||||
{"atline", JSOPTION_ATLINE},
|
||||
{"strict", JSOPTION_STRICT},
|
||||
{"werror", JSOPTION_WERROR},
|
||||
{"allow_xml", JSOPTION_ALLOW_XML},
|
||||
{"moar_xml", JSOPTION_MOAR_XML},
|
||||
{"strict_mode", JSOPTION_STRICT_MODE},
|
||||
};
|
||||
|
||||
@ -1131,7 +1129,7 @@ static int
|
||||
usage(void)
|
||||
{
|
||||
fprintf(gErrFile, "%s\n", JS_GetImplementationVersion());
|
||||
fprintf(gErrFile, "usage: xpcshell [-g gredir] [-a appdir] [-r manifest]... [-PsSwWxCijmIn] [-v version] [-f scriptfile] [-e script] [scriptfile] [scriptarg...]\n");
|
||||
fprintf(gErrFile, "usage: xpcshell [-g gredir] [-a appdir] [-r manifest]... [-PsSwWCijmIn] [-v version] [-f scriptfile] [-e script] [scriptfile] [scriptarg...]\n");
|
||||
return 2;
|
||||
}
|
||||
|
||||
@ -1156,9 +1154,6 @@ ProcessArgsForCompartment(JSContext *cx, char **argv, int argc)
|
||||
case 's':
|
||||
JS_ToggleOptions(cx, JSOPTION_STRICT);
|
||||
break;
|
||||
case 'x':
|
||||
JS_ToggleOptions(cx, JSOPTION_MOAR_XML);
|
||||
break;
|
||||
case 'm':
|
||||
JS_ToggleOptions(cx, JSOPTION_METHODJIT);
|
||||
break;
|
||||
@ -1830,7 +1825,6 @@ main(int argc, char **argv, char **envp)
|
||||
argv++;
|
||||
ProcessArgsForCompartment(cx, argv, argc);
|
||||
|
||||
JS_SetOptions(cx, JS_GetOptions(cx) | JSOPTION_ALLOW_XML);
|
||||
xpc_LocalizeContext(cx);
|
||||
|
||||
nsCOMPtr<nsIXPConnect> xpc = do_GetService(nsIXPConnect::GetCID());
|
||||
|
@ -3762,16 +3762,12 @@ ContextHolder::ContextHolder(JSContext *aOuterCx,
|
||||
DebugOnly<nsresult> rv = XPCWrapper::GetSecurityManager()->
|
||||
IsSystemPrincipal(mPrincipal, &isChrome);
|
||||
MOZ_ASSERT(NS_SUCCEEDED(rv));
|
||||
bool allowXML = Preferences::GetBool(isChrome ?
|
||||
"javascript.options.xml.chrome" :
|
||||
"javascript.options.xml.content");
|
||||
|
||||
JSAutoRequest ar(mJSContext);
|
||||
JS_SetOptions(mJSContext,
|
||||
JS_GetOptions(mJSContext) |
|
||||
JSOPTION_DONT_REPORT_UNCAUGHT |
|
||||
JSOPTION_PRIVATE_IS_NSISUPPORTS |
|
||||
(allowXML ? JSOPTION_ALLOW_XML : 0));
|
||||
JSOPTION_PRIVATE_IS_NSISUPPORTS);
|
||||
JS_SetGlobalObject(mJSContext, aSandbox);
|
||||
JS_SetContextPrivate(mJSContext, this);
|
||||
JS_SetOperationCallback(mJSContext, ContextHolderOperationCallback);
|
||||
@ -4494,7 +4490,6 @@ SetBoolOption(JSContext* cx, uint32_t aOption, bool aValue)
|
||||
GENERATE_JSOPTION_GETTER_SETTER(Strict, JSOPTION_STRICT)
|
||||
GENERATE_JSOPTION_GETTER_SETTER(Werror, JSOPTION_WERROR)
|
||||
GENERATE_JSOPTION_GETTER_SETTER(Atline, JSOPTION_ATLINE)
|
||||
GENERATE_JSOPTION_GETTER_SETTER(Xml, JSOPTION_MOAR_XML)
|
||||
GENERATE_JSOPTION_GETTER_SETTER(Methodjit, JSOPTION_METHODJIT)
|
||||
GENERATE_JSOPTION_GETTER_SETTER(Methodjit_always, JSOPTION_METHODJIT_ALWAYS)
|
||||
GENERATE_JSOPTION_GETTER_SETTER(Strict_mode, JSOPTION_STRICT_MODE)
|
||||
|
@ -1059,12 +1059,6 @@ XPCConvert::JSObject2NativeInterface(JSContext* cx,
|
||||
}
|
||||
// else...
|
||||
|
||||
// XXX E4X breaks the world. Don't try wrapping E4X objects!
|
||||
// This hack can be removed (or changed accordingly) when the
|
||||
// DOM <-> E4X bindings are complete, see bug 270553
|
||||
if (JS_TypeOfValue(cx, OBJECT_TO_JSVAL(src)) == JSTYPE_XML)
|
||||
return false;
|
||||
|
||||
// Deal with slim wrappers here.
|
||||
if (GetISupportsFromJSObject(inner ? inner : src, &iface)) {
|
||||
if (iface)
|
||||
|
@ -1646,13 +1646,6 @@ ReportCompartmentStats(const JS::CompartmentStats &cStats,
|
||||
"heap that holds references to executable code pools "
|
||||
"used by IonMonkey.");
|
||||
|
||||
#if JS_HAS_XML_SUPPORT
|
||||
CREPORT_GC_BYTES(cJSPathPrefix + NS_LITERAL_CSTRING("gc-heap/xml"),
|
||||
cStats.gcHeapXML,
|
||||
"Memory on the garbage-collected JavaScript "
|
||||
"heap that holds E4X XML objects.");
|
||||
#endif
|
||||
|
||||
CREPORT_BYTES(cJSPathPrefix + NS_LITERAL_CSTRING("objects-extra/slots"),
|
||||
cStats.objectsExtra.slots,
|
||||
"Memory allocated for the non-fixed object "
|
||||
|
@ -828,14 +828,6 @@ xpc_qsUnwrapArgImpl(JSContext *cx,
|
||||
// else...
|
||||
// Slow path.
|
||||
|
||||
// XXX E4X breaks the world. Don't try wrapping E4X objects!
|
||||
// This hack can be removed (or changed accordingly) when the
|
||||
// DOM <-> E4X bindings are complete, see bug 270553
|
||||
if (JS_TypeOfValue(cx, OBJECT_TO_JSVAL(src)) == JSTYPE_XML) {
|
||||
*ppArgRef = nullptr;
|
||||
return NS_ERROR_XPC_BAD_CONVERT_JS;
|
||||
}
|
||||
|
||||
// Try to unwrap a slim wrapper.
|
||||
nsISupports *iface;
|
||||
if (XPCConvert::GetISupportsFromJSObject(src, &iface)) {
|
||||
|
@ -769,7 +769,6 @@ DescribeGCThing(bool isMarked, void *p, JSGCTraceKind traceKind,
|
||||
"String",
|
||||
"Script",
|
||||
"IonCode",
|
||||
"Xml",
|
||||
"Shape",
|
||||
"BaseShape",
|
||||
"TypeObject",
|
||||
@ -2516,13 +2515,8 @@ nsXPConnect::GetTelemetryValue(JSContext *cx, jsval *rval)
|
||||
|
||||
unsigned attrs = JSPROP_ENUMERATE | JSPROP_READONLY | JSPROP_PERMANENT;
|
||||
|
||||
size_t i = JS_GetE4XObjectsCreated(cx);
|
||||
size_t i = JS_SetProtoCalled(cx);
|
||||
jsval v = DOUBLE_TO_JSVAL(i);
|
||||
if (!JS_DefineProperty(cx, obj, "e4x", v, NULL, NULL, attrs))
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
i = JS_SetProtoCalled(cx);
|
||||
v = DOUBLE_TO_JSVAL(i);
|
||||
if (!JS_DefineProperty(cx, obj, "setProto", v, NULL, NULL, attrs))
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
|
@ -451,12 +451,10 @@ private:
|
||||
// returned as function call result values they are not addref'd. Exceptions
|
||||
// to this rule are noted explicitly.
|
||||
|
||||
// JSTRACE_XML can recursively hold on to more JSTRACE_XML objects, adding it to
|
||||
// the cycle collector avoids stack overflow.
|
||||
inline bool
|
||||
AddToCCKind(JSGCTraceKind kind)
|
||||
{
|
||||
return kind == JSTRACE_OBJECT || kind == JSTRACE_XML || kind == JSTRACE_SCRIPT;
|
||||
return kind == JSTRACE_OBJECT || kind == JSTRACE_SCRIPT;
|
||||
}
|
||||
|
||||
class nsXPConnect : public nsIXPConnect,
|
||||
|
@ -743,8 +743,6 @@ pref("javascript.options.ion.parallel_compilation", true);
|
||||
pref("javascript.options.pccounts.content", false);
|
||||
pref("javascript.options.pccounts.chrome", false);
|
||||
pref("javascript.options.methodjit_always", false);
|
||||
pref("javascript.options.xml.content", false);
|
||||
pref("javascript.options.xml.chrome", false);
|
||||
pref("javascript.options.jit_hardening", true);
|
||||
pref("javascript.options.typeinference", true);
|
||||
// This preference limits the memory usage of javascript.
|
||||
|
Loading…
Reference in New Issue
Block a user