Fixes to argc handling and Date class.

git-svn-id: svn://10.0.0.236/trunk@139233 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
rogerl%netscape.com 2003-03-10 23:48:12 +00:00
parent 0aeb2920f1
commit 3a360650b4
3 changed files with 15 additions and 11 deletions

View File

@ -1481,7 +1481,7 @@ void initDateObject(JS2Metadata *meta)
LocalTZA = -(PRMJ_LocalGMTDifference() * msPerSecond);
meta->dateClass->prototype = new DateInstance(meta, meta->objectClass->prototype, meta->booleanClass);
meta->dateClass->prototype = new DateInstance(meta, meta->objectClass->prototype, meta->dateClass);
meta->initBuiltinClass(meta->dateClass, &prototypeFunctions[0], &staticFunctions[0], Date_Constructor, Date_Call);
}

View File

@ -313,11 +313,11 @@ namespace MetaData {
float64 JS2Engine::truncateFloat64(float64 d)
{
if (d == 0)
return d;
return d;
if (!JSDOUBLE_IS_FINITE(d)) {
if (JSDOUBLE_IS_NaN(d))
return 0;
return d;
if (JSDOUBLE_IS_NaN(d))
return 0;
return d;
}
bool neg = (d < 0);
d = fd::floor(neg ? -d : d);
@ -773,6 +773,10 @@ namespace MetaData {
case eForValue: // leave the iterator helper
return 1; // and push iteration value
case eFrameSlotRead:
return 1; // push value
case eFrameSlotWrite:
return -1; // doesn't leave value on stack
case eLexicalPostInc:
case eLexicalPostDec:

View File

@ -114,7 +114,7 @@
pc += sizeof(uint16);
a = top(argCount + 2); // 'this'
b = top(argCount + 1); // target function
uint32 length = 0;
// uint32 length = 0;
if (JS2VAL_IS_PRIMITIVE(b))
meta->reportError(Exception::badValueError, "Can't call on primitive value", errorPos());
JS2Object *fObj = JS2VAL_TO_OBJECT(b);
@ -127,7 +127,7 @@
if ((fObj->kind == PrototypeInstanceKind)
&& ((checked_cast<PrototypeInstance *>(fObj))->type == meta->functionClass)) {
fWrap = (checked_cast<FunctionInstance *>(fObj))->fWrap;
length = getLength(meta, fObj);
// length = getLength(meta, fObj);
}
if (fWrap) {
if (fWrap->compileFrame->prototype) {
@ -138,10 +138,10 @@
}
}
if (fWrap->code) { // native code
while (length > argCount) {
push(JS2VAL_UNDEFINED);
argCount++;
}
// while (length > argCount) {
// push(JS2VAL_UNDEFINED);
// argCount++;
// }
a = fWrap->code(meta, a, base(argCount), argCount);
pop(argCount + 2);
push(a);