This commit is contained in:
rogerl%netscape.com 2003-07-14 19:07:42 +00:00
Родитель 32a41a6089
Коммит 6a5004b520
4 изменённых файлов: 33 добавлений и 61 удалений

Просмотреть файл

@ -3404,9 +3404,9 @@ doUnary:
return NULL;
JS2Class *s = c;
while (s) {
InstanceBindingEntry **ibeP = c->instanceBindings[qname->name];
InstanceBindingEntry *ibeP = c->instanceBindings[qname->name];
if (ibeP) {
for (InstanceBindingEntry::NS_Iterator i = (*ibeP)->begin(), end = (*ibeP)->end(); (i != end); i++) {
for (InstanceBindingEntry::NS_Iterator i = ibeP->begin(), end = ibeP->end(); (i != end); i++) {
InstanceBindingEntry::NamespaceBinding &ns = *i;
if ((ns.second->accesses & access) && (ns.first == qname->nameSpace)) {
return ns.second->content;
@ -3483,9 +3483,9 @@ doUnary:
if (mOverridden->final || !goodKind)
reportError(Exception::definitionError, "Illegal override", pos);
}
InstanceBindingEntry **ibeP = c->instanceBindings[id];
InstanceBindingEntry *ibeP = c->instanceBindings[id];
if (ibeP) {
for (InstanceBindingEntry::NS_Iterator i = (*ibeP)->begin(), end = (*ibeP)->end(); (i != end); i++) {
for (InstanceBindingEntry::NS_Iterator i = ibeP->begin(), end = ibeP->end(); (i != end); i++) {
InstanceBindingEntry::NamespaceBinding &ns = *i;
if ((access & ns.second->content->instanceMemberAccess()) && (definedMultiname->listContains(ns.first)))
reportError(Exception::definitionError, "Illegal override", pos);
@ -3506,18 +3506,13 @@ doUnary:
break;
}
m->multiname = new (this) Multiname(definedMultiname);
InstanceBindingEntry *ibe;
if (ibeP == NULL) {
ibe = new InstanceBindingEntry(id);
c->instanceBindings.insert(id, ibe);
}
else
ibe = *ibeP;
if (ibeP == NULL)
ibeP = &c->instanceBindings.insert(id);
for (NamespaceListIterator nli = definedMultiname->nsList->begin(), nlend = definedMultiname->nsList->end(); (nli != nlend); nli++) {
// XXX here and in defineLocal... why a new binding for each namespace?
// (other than it would mess up the destructor sequence :-)
InstanceBinding *ib = new InstanceBinding(access, m);
ibe->bindingList.push_back(InstanceBindingEntry::NamespaceBinding(*nli, ib));
ibeP->bindingList.push_back(InstanceBindingEntry::NamespaceBinding(*nli, ib));
}
return mOverridden;
}
@ -4325,9 +4320,9 @@ XXX see EvalAttributeExpression, where identifiers are being handled for now...
InstanceMember *JS2Metadata::findLocalInstanceMember(JS2Class *limit, Multiname *multiname, Access access)
{
InstanceMember *result = NULL;
InstanceBindingEntry **ibeP = limit->instanceBindings[multiname->name];
InstanceBindingEntry *ibeP = limit->instanceBindings[multiname->name];
if (ibeP) {
for (InstanceBindingEntry::NS_Iterator i = (*ibeP)->begin(), end = (*ibeP)->end(); (i != end); i++) {
for (InstanceBindingEntry::NS_Iterator i = ibeP->begin(), end = ibeP->end(); (i != end); i++) {
InstanceBindingEntry::NamespaceBinding &ns = *i;
if ((ns.second->accesses & access) && multiname->listContains(ns.first)) {
if (result && (ns.second->content != result))
@ -4357,9 +4352,9 @@ XXX see EvalAttributeExpression, where identifiers are being handled for now...
// in this case either the getter or the setter is returned at the implementation's discretion
InstanceMember *JS2Metadata::getDerivedInstanceMember(JS2Class *c, InstanceMember *mBase, Access access)
{
InstanceBindingEntry **ibeP = c->instanceBindings[mBase->multiname->name];
InstanceBindingEntry *ibeP = c->instanceBindings[mBase->multiname->name];
if (ibeP) {
for (InstanceBindingEntry::NS_Iterator i = (*ibeP)->begin(), end = (*ibeP)->end(); (i != end); i++) {
for (InstanceBindingEntry::NS_Iterator i = ibeP->begin(), end = ibeP->end(); (i != end); i++) {
InstanceBindingEntry::NamespaceBinding &ns = *i;
if ((ns.second->accesses & access) && mBase->multiname->listContains(ns.first))
return ns.second->content;
@ -4954,12 +4949,11 @@ XXX see EvalAttributeExpression, where identifiers are being handled for now...
JS2Class::~JS2Class()
{
for (InstanceBindingIterator rib = instanceBindings.begin(), riend = instanceBindings.end(); (rib != riend); rib++) {
InstanceBindingEntry *ibe = *rib;
for (InstanceBindingEntry::NS_Iterator i = ibe->begin(), end = ibe->end(); (i != end); i++) {
InstanceBindingEntry &ibe = *rib;
for (InstanceBindingEntry::NS_Iterator i = ibe.begin(), end = ibe.end(); (i != end); i++) {
InstanceBindingEntry::NamespaceBinding ns = *i;
delete ns.second;
}
delete ibe;
}
}
@ -4974,8 +4968,8 @@ XXX see EvalAttributeExpression, where identifiers are being handled for now...
GCMARKOBJECT(init)
GCMARKVALUE(defaultValue);
for (InstanceBindingIterator rib = instanceBindings.begin(), riend = instanceBindings.end(); (rib != riend); rib++) {
InstanceBindingEntry *ibe = *rib;
for (InstanceBindingEntry::NS_Iterator i = ibe->begin(), end = ibe->end(); (i != end); i++) {
InstanceBindingEntry &ibe = *rib;
for (InstanceBindingEntry::NS_Iterator i = ibe.begin(), end = ibe.end(); (i != end); i++) {
InstanceBindingEntry::NamespaceBinding ns = *i;
ns.second->content->mark();
}
@ -5033,25 +5027,6 @@ XXX see EvalAttributeExpression, where identifiers are being handled for now...
}
}
// This version of 'clone' is used to construct a duplicate LocalBinding entry
// with each LocalBinding content copied from the (perhaps previously) cloned member.
// See 'instantiateFrame'.
LocalBindingEntry *LocalBindingEntry::clone()
{
LocalBindingEntry *new_e = new LocalBindingEntry(name);
for (NS_Iterator i = bindingList.begin(), end = bindingList.end(); (i != end); i++) {
NamespaceBinding &ns = *i;
LocalBinding *m = ns.second;
if (m->content->cloneContent == NULL) {
m->content->cloneContent = m->content->clone();
}
LocalBinding *new_b = new LocalBinding(m->accesses, m->content->cloneContent, m->enumerable);
new_b->xplicit = m->xplicit;
new_e->bindingList.push_back(NamespaceBinding(ns.first, new_b));
}
return new_e;
}
/************************************************************************************
*
@ -5065,8 +5040,8 @@ XXX see EvalAttributeExpression, where identifiers are being handled for now...
if (type->super)
initializeSlots(type->super);
for (InstanceBindingIterator rib = type->instanceBindings.begin(), riend = type->instanceBindings.end(); (rib != riend); rib++) {
InstanceBindingEntry *ibe = *rib;
for (InstanceBindingEntry::NS_Iterator i = ibe->begin(), end = ibe->end(); (i != end); i++) {
InstanceBindingEntry &ibe = *rib;
for (InstanceBindingEntry::NS_Iterator i = ibe.begin(), end = ibe.end(); (i != end); i++) {
InstanceBindingEntry::NamespaceBinding ns = *i;
InstanceMember *im = ns.second->content;
if (im->memberKind == Member::InstanceVariableMember) {

Просмотреть файл

@ -637,7 +637,6 @@ class LocalBindingEntry {
public:
LocalBindingEntry(const StringAtom &s) : name(s) { }
LocalBindingEntry *clone();
void clear();
typedef std::pair<Namespace *, LocalBinding *> NamespaceBinding;
@ -680,8 +679,8 @@ public:
typedef HashTable<InstanceBindingEntry *, const StringAtom &> InstanceBindingMap;
typedef TableIterator<InstanceBindingEntry *, const StringAtom &> InstanceBindingIterator;
typedef HashTable<InstanceBindingEntry, const StringAtom &> InstanceBindingMap;
typedef TableIterator<InstanceBindingEntry, const StringAtom &> InstanceBindingIterator;
// A frame contains bindings defined at a particular scope in a program. A frame is either the top-level system frame,
@ -1765,8 +1764,8 @@ public:
inline bool operator==(MetaData::LocalBindingEntry &s1, const StringAtom &s2) { return s1.name == s2;}
inline bool operator!=(MetaData::LocalBindingEntry &s1, const StringAtom &s2) { return s1.name != s2;}
inline bool operator==(MetaData::InstanceBindingEntry *s1, const StringAtom &s2) { return s1->name == s2;}
inline bool operator!=(MetaData::InstanceBindingEntry *s1, const StringAtom &s2) { return s1->name != s2;}
inline bool operator==(MetaData::InstanceBindingEntry &s1, const StringAtom &s2) { return s1.name == s2;}
inline bool operator!=(MetaData::InstanceBindingEntry &s1, const StringAtom &s2) { return s1.name != s2;}
inline HashNumber hashString(const StringAtom &s) { return s.hash; }

Просмотреть файл

@ -123,8 +123,6 @@ static js2val String_search(JS2Metadata *meta, const js2val thisValue, js2val *a
DEFINE_ROOTKEEPER(meta, rk, str);
str = meta->toString(thisValue);
js2val S = STRING_TO_JS2VAL(str);
js2val regexp = argv[0];
if ((argc == 0) || (meta->objectType(argv[0]) != meta->regexpClass)) {
@ -185,7 +183,7 @@ static js2val String_match(JS2Metadata *meta, const js2val thisValue, js2val *ar
ArrayInstance *A = NULL;
DEFINE_ROOTKEEPER(meta, rk2, A);
int32 index = 0;
int32 lastIndex = 0;
uint32 lastIndex = 0;
while (true) {
REMatchResult *match = REExecute(meta, re, JS2VAL_TO_STRING(S)->begin(), lastIndex, toInt32(JS2VAL_TO_STRING(S)->length()), globalMultiline);
if (match == NULL)
@ -231,10 +229,10 @@ static const String interpretDollar(JS2Metadata *meta, const String *replaceStr,
case '8':
case '9':
{
int32 num = (int32)(*dollarValue - '0');
uint32 num = (uint32)(*dollarValue - '0');
if (num <= match->parenCount) {
if ((dollarPos < (replaceStr->length() - 2)) && (dollarValue[1] >= '0') && (dollarValue[1] <= '9')) {
int32 tmp = (num * 10) + (dollarValue[1] - '0');
uint32 tmp = (num * 10) + (dollarValue[1] - '0');
if (tmp <= match->parenCount) {
num = tmp;
skip = 3;
@ -542,7 +540,7 @@ static js2val String_charCodeAt(JS2Metadata *meta, const js2val thisValue, js2va
if ((posd < 0) || (posd >= str->size()))
return meta->engine->nanValue;
else
return meta->engine->allocNumber((float64)(*str)[toUInt32(posd)]);
return meta->engine->allocNumber((float64)(*str)[toUInt32((int32)posd)]);
}
static js2val String_concat(JS2Metadata *meta, const js2val thisValue, js2val *argv, uint32 argc)
@ -628,7 +626,6 @@ static js2val String_toLowerCase(JS2Metadata *meta, const js2val thisValue, js2v
{
const String *str = meta->toString(thisValue);
DEFINE_ROOTKEEPER(meta, rk1, str);
js2val S = STRING_TO_JS2VAL(str);
String *result = meta->engine->allocStringPtr(str);
DEFINE_ROOTKEEPER(meta, rk2, result);

Просмотреть файл

@ -261,6 +261,8 @@ typedef struct CompilerState {
} classCache[CLASS_CACHE_SIZE];
} CompilerState;
#define NO_MAX ((uint16)(-1))
typedef struct REProgState {
jsbytecode *continue_pc; /* current continuation data */
REOp continue_op;
@ -939,7 +941,6 @@ parseTerm(CompilerState *state)
{
jschar c = *state->cp++;
uintN nDigits;
uintN parenBaseCount = state->parenCount;
uintN num, tmp, n, i;
const jschar *termStart;
JSBool foundCachedCopy;
@ -1218,7 +1219,7 @@ parseQuantifier(CompilerState *state)
if (!state->result)
return JS_FALSE;
state->result->u.range.min = 1;
state->result->u.range.max = -1;
state->result->u.range.max = NO_MAX;
/* <PLUS>, <next> ... <ENDCHILD> */
state->progLength += 4;
goto quantifier;
@ -1227,7 +1228,7 @@ parseQuantifier(CompilerState *state)
if (!state->result)
return JS_FALSE;
state->result->u.range.min = 0;
state->result->u.range.max = -1;
state->result->u.range.max = NO_MAX;
/* <STAR>, <next> ... <ENDCHILD> */
state->progLength += 4;
goto quantifier;
@ -2445,11 +2446,11 @@ doAlt:
case REOP_STAR:
curState->u.quantifier.min = 0;
curState->u.quantifier.max = -1;
curState->u.quantifier.max = NO_MAX;
goto quantcommon;
case REOP_PLUS:
curState->u.quantifier.min = 1;
curState->u.quantifier.max = -1;
curState->u.quantifier.max = NO_MAX;
goto quantcommon;
case REOP_OPT:
curState->u.quantifier.min = 0;
@ -2576,11 +2577,11 @@ repeatDone:
case REOP_MINIMALSTAR:
curState->u.quantifier.min = 0;
curState->u.quantifier.max = -1;
curState->u.quantifier.max = NO_MAX;
goto minimalquantcommon;
case REOP_MINIMALPLUS:
curState->u.quantifier.min = 1;
curState->u.quantifier.max = -1;
curState->u.quantifier.max = NO_MAX;
goto minimalquantcommon;
case REOP_MINIMALOPT:
curState->u.quantifier.min = 0;