Fixed warnings for gcc build.
This commit is contained in:
Родитель
000531f5c5
Коммит
9a22c0ee19
|
@ -121,7 +121,7 @@
|
|||
f << opcodeNames[BRANCH] << "\t" << "Offset " << ((mOp1) ? mOp1->mOffset : NotAnOffset);
|
||||
return f;
|
||||
}
|
||||
virtual Formatter& printOperands(Formatter& f, const JSValues& registers) {
|
||||
virtual Formatter& printOperands(Formatter& f, const JSValues& /*registers*/) {
|
||||
return f;
|
||||
}
|
||||
};
|
||||
|
@ -258,7 +258,7 @@
|
|||
f << opcodeNames[DEBUGGER];
|
||||
return f;
|
||||
}
|
||||
virtual Formatter& printOperands(Formatter& f, const JSValues& registers) {
|
||||
virtual Formatter& printOperands(Formatter& f, const JSValues& /*registers*/) {
|
||||
return f;
|
||||
}
|
||||
};
|
||||
|
@ -435,7 +435,7 @@
|
|||
f << opcodeNames[JSR] << "\t" << "Offset " << ((mOp1) ? mOp1->mOffset : NotAnOffset);
|
||||
return f;
|
||||
}
|
||||
virtual Formatter& printOperands(Formatter& f, const JSValues& registers) {
|
||||
virtual Formatter& printOperands(Formatter& f, const JSValues& /*registers*/) {
|
||||
return f;
|
||||
}
|
||||
};
|
||||
|
@ -635,7 +635,7 @@
|
|||
f << opcodeNames[NOP];
|
||||
return f;
|
||||
}
|
||||
virtual Formatter& printOperands(Formatter& f, const JSValues& registers) {
|
||||
virtual Formatter& printOperands(Formatter& f, const JSValues& /*registers*/) {
|
||||
return f;
|
||||
}
|
||||
};
|
||||
|
@ -732,7 +732,7 @@
|
|||
f << opcodeNames[RETURN_VOID];
|
||||
return f;
|
||||
}
|
||||
virtual Formatter& printOperands(Formatter& f, const JSValues& registers) {
|
||||
virtual Formatter& printOperands(Formatter& f, const JSValues& /*registers*/) {
|
||||
return f;
|
||||
}
|
||||
};
|
||||
|
@ -747,7 +747,7 @@
|
|||
f << opcodeNames[RTS];
|
||||
return f;
|
||||
}
|
||||
virtual Formatter& printOperands(Formatter& f, const JSValues& registers) {
|
||||
virtual Formatter& printOperands(Formatter& f, const JSValues& /*registers*/) {
|
||||
return f;
|
||||
}
|
||||
};
|
||||
|
@ -967,7 +967,7 @@
|
|||
f << opcodeNames[TRYIN] << "\t" << "Offset " << ((mOp1) ? mOp1->mOffset : NotAnOffset) << ", " << "Offset " << ((mOp2) ? mOp2->mOffset : NotAnOffset);
|
||||
return f;
|
||||
}
|
||||
virtual Formatter& printOperands(Formatter& f, const JSValues& registers) {
|
||||
virtual Formatter& printOperands(Formatter& f, const JSValues& /*registers*/) {
|
||||
return f;
|
||||
}
|
||||
};
|
||||
|
@ -982,7 +982,7 @@
|
|||
f << opcodeNames[TRYOUT];
|
||||
return f;
|
||||
}
|
||||
virtual Formatter& printOperands(Formatter& f, const JSValues& registers) {
|
||||
virtual Formatter& printOperands(Formatter& f, const JSValues& /*registers*/) {
|
||||
return f;
|
||||
}
|
||||
};
|
||||
|
@ -1038,7 +1038,7 @@
|
|||
f << opcodeNames[WITHOUT];
|
||||
return f;
|
||||
}
|
||||
virtual Formatter& printOperands(Formatter& f, const JSValues& registers) {
|
||||
virtual Formatter& printOperands(Formatter& f, const JSValues& /*registers*/) {
|
||||
return f;
|
||||
}
|
||||
};
|
||||
|
|
|
@ -1902,7 +1902,7 @@ TypedRegister ICodeGenerator::genStmt(StmtNode *p, LabelSet *currentLabelSet)
|
|||
FILE* f = fopen(str.c_str(), "r");
|
||||
if (f) {
|
||||
Context cx(*mWorld, mGlobal);
|
||||
JSValue result = cx.readEvalFile(f, *fileName);
|
||||
(void)cx.readEvalFile(f, *fileName);
|
||||
fclose(f);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -504,7 +504,7 @@ void Context::initOperatorsPackage()
|
|||
{ "defineIdentical", defineIdentical },
|
||||
};
|
||||
|
||||
for (int i = 0; i < sizeof(OBOs) / sizeof(struct OBO); i++)
|
||||
for (uint i = 0; i < sizeof(OBOs) / sizeof(struct OBO); i++)
|
||||
mGlobal->defineNativeFunction(mWorld.identifiers[widenCString(OBOs[i].name)], OBOs[i].fun);
|
||||
|
||||
mHasOperatorsPackageLoaded = true;
|
||||
|
@ -535,7 +535,7 @@ void Context::initContext()
|
|||
{ "none", &None_Type }
|
||||
};
|
||||
|
||||
for (int i = 0; i < sizeof(PDTs) / sizeof(struct PDT); i++)
|
||||
for (uint i = 0; i < sizeof(PDTs) / sizeof(struct PDT); i++)
|
||||
mGlobal->defineVariable(widenCString(PDTs[i].name), &Type_Type, JSValue(PDTs[i].type));
|
||||
|
||||
// set up the correct [[Class]] for the global object (matching SpiderMonkey)
|
||||
|
|
|
@ -1,208 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express oqr
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is the JavaScript 2 Prototype.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the
|
||||
* terms of the GNU Public License (the "GPL"), in which case the
|
||||
* provisions of the GPL are applicable instead of those above.
|
||||
* If you wish to allow use of your version of this file only
|
||||
* under the terms of the GPL and not to allow others to use your
|
||||
* version of this file under the NPL, indicate your decision by
|
||||
* deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this
|
||||
* file under either the NPL or the GPL.
|
||||
*/
|
||||
|
||||
#include <math.h>
|
||||
#include "jsmath.h"
|
||||
|
||||
namespace JavaScript {
|
||||
namespace JSMathClass {
|
||||
|
||||
using namespace JSTypes;
|
||||
|
||||
#ifndef M_E
|
||||
#define M_E 2.7182818284590452354
|
||||
#endif
|
||||
#ifndef M_LOG2E
|
||||
#define M_LOG2E 1.4426950408889634074
|
||||
#endif
|
||||
#ifndef M_LOG10E
|
||||
#define M_LOG10E 0.43429448190325182765
|
||||
#endif
|
||||
#ifndef M_LN2
|
||||
#define M_LN2 0.69314718055994530942
|
||||
#endif
|
||||
#ifndef M_LN10
|
||||
#define M_LN10 2.30258509299404568402
|
||||
#endif
|
||||
#ifndef M_PI
|
||||
#define M_PI 3.14159265358979323846
|
||||
#endif
|
||||
#ifndef M_SQRT2
|
||||
#define M_SQRT2 1.41421356237309504880
|
||||
#endif
|
||||
#ifndef M_SQRT1_2
|
||||
#define M_SQRT1_2 0.70710678118654752440
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
Concept copied from SpiderMonkey -
|
||||
fd_XXX needs to be defined either as a call to the fdlibm routine
|
||||
or the native C library routine depending on the platform
|
||||
*/
|
||||
|
||||
#define JS_USE_FDLIBM_MATH 0
|
||||
|
||||
|
||||
#if !JS_USE_FDLIBM_MATH
|
||||
/*
|
||||
* Use system provided math routines.
|
||||
*/
|
||||
|
||||
|
||||
#define fd_acos acos
|
||||
#define fd_asin asin
|
||||
#define fd_atan atan
|
||||
#define fd_atan2 atan2
|
||||
#define fd_ceil ceil
|
||||
#define fd_copysign copysign
|
||||
#define fd_cos cos
|
||||
#define fd_exp exp
|
||||
#define fd_fabs fabs
|
||||
#define fd_floor floor
|
||||
#define fd_fmod fmod
|
||||
#define fd_log log
|
||||
#define fd_pow pow
|
||||
#define fd_sin sin
|
||||
#define fd_sqrt sqrt
|
||||
#define fd_tan tan
|
||||
|
||||
#endif
|
||||
|
||||
static JSValue math_abs(Context *, const JSValues& argv)
|
||||
{
|
||||
if (argv.size() > 0) {
|
||||
JSValue num = argv[1].toNumber();
|
||||
if (num.isNaN()) return num;
|
||||
if (num.isNegativeZero()) return kPositiveZero;
|
||||
if (num.isNegativeInfinity()) return kPositiveInfinity;
|
||||
if (num.f64 < 0) return JSValue(-num.f64);
|
||||
return num;
|
||||
}
|
||||
return kUndefinedValue;
|
||||
}
|
||||
|
||||
static JSValue math_acos(Context *, const JSValues& argv)
|
||||
{
|
||||
if (argv.size() > 0) {
|
||||
JSValue num = argv[1].toNumber();
|
||||
return JSValue(fd_acos(num.f64));
|
||||
}
|
||||
return kUndefinedValue;
|
||||
}
|
||||
|
||||
static JSValue math_asin(Context *, const JSValues& argv)
|
||||
{
|
||||
if (argv.size() > 0) {
|
||||
JSValue num = argv[1].toNumber();
|
||||
return JSValue(fd_asin(num.f64));
|
||||
}
|
||||
return kUndefinedValue;
|
||||
}
|
||||
|
||||
static JSValue math_atan(Context *, const JSValues& argv)
|
||||
{
|
||||
if (argv.size() > 0) {
|
||||
JSValue num = argv[1].toNumber();
|
||||
return JSValue(fd_atan(num.f64));
|
||||
}
|
||||
return kUndefinedValue;
|
||||
}
|
||||
|
||||
static JSValue math_atan2(Context *, const JSValues& argv)
|
||||
{
|
||||
if (argv.size() > 1) {
|
||||
JSValue num1 = argv[1].toNumber();
|
||||
JSValue num2 = argv[1].toNumber();
|
||||
return JSValue(fd_atan2(num1.f64, num2.f64));
|
||||
}
|
||||
return kUndefinedValue;
|
||||
}
|
||||
|
||||
static JSValue math_ceil(Context *, const JSValues& argv)
|
||||
{
|
||||
if (argv.size() > 0) {
|
||||
JSValue num = argv[1].toNumber();
|
||||
return JSValue(fd_ceil(num.f64));
|
||||
}
|
||||
return kUndefinedValue;
|
||||
}
|
||||
|
||||
struct MathFunctionEntry {
|
||||
char *name;
|
||||
JSNativeFunction::JSCode fn;
|
||||
} MathFunctions[] = {
|
||||
{ "abs", math_abs },
|
||||
{ "acos", math_acos },
|
||||
{ "asin", math_asin },
|
||||
{ "atan", math_atan },
|
||||
{ "atan2", math_atan2 },
|
||||
{ "ceil", math_ceil },
|
||||
{ "acos", math_acos },
|
||||
{ "acos", math_acos }
|
||||
};
|
||||
|
||||
struct MathConstantEntry {
|
||||
char *name;
|
||||
double value;
|
||||
} MathConstants[] = {
|
||||
{ "E", M_E },
|
||||
{ "LOG2E", M_LOG2E },
|
||||
{ "LOG10E", M_LOG10E },
|
||||
{ "LN2", M_LN2 },
|
||||
{ "LN10", M_LN10 },
|
||||
{ "PI", M_PI },
|
||||
{ "SQRT2", M_SQRT2 },
|
||||
{ "SQRT1_2", M_SQRT1_2 }
|
||||
};
|
||||
|
||||
// There is no constructor for Math, we simply initialize
|
||||
// the properties of the Math object
|
||||
void JSMath::initMathObject(JSScope *g)
|
||||
{
|
||||
int i;
|
||||
JSMath *m = new JSMath();
|
||||
m->setClass(new JSString("Math"));
|
||||
|
||||
for (i = 0; i < sizeof(MathFunctions) / sizeof(MathFunctionEntry); i++)
|
||||
m->setProperty(widenCString(MathFunctions[i].name), JSValue(new JSNativeFunction(MathFunctions[i].fn) ) );
|
||||
|
||||
for (i = 0; i < sizeof(MathConstants) / sizeof(MathConstantEntry); i++)
|
||||
m->setProperty(widenCString(MathConstants[i].name), JSValue(MathConstants[i].value) );
|
||||
|
||||
g->setProperty(widenCString("Math"), JSValue(m));
|
||||
|
||||
}
|
||||
|
||||
} /* JSMathClass */
|
||||
} /* JavaScript */
|
|
@ -58,7 +58,7 @@ static JSValue object_toString(Context *, const JSValues& argv)
|
|||
return kUndefinedValue;
|
||||
}
|
||||
|
||||
static JSValue object_constructor(Context *cx, const JSValues& argv)
|
||||
static JSValue object_constructor(Context *, const JSValues& /*argv*/)
|
||||
{
|
||||
// argv[0] will be NULL
|
||||
return JSValue(new JSObject());
|
||||
|
@ -82,13 +82,13 @@ JSObject *JSObject::initJSObject()
|
|||
{
|
||||
JSObject *result = new JSObject();
|
||||
|
||||
for (int i = 0; i < sizeof(ObjectFunctions) / sizeof(ObjectFunctionEntry); i++)
|
||||
for (uint i = 0; i < sizeof(ObjectFunctions) / sizeof(ObjectFunctionEntry); i++)
|
||||
result->setProperty(widenCString(ObjectFunctions[i].name), JSValue(new JSNativeFunction(ObjectFunctions[i].fn) ) );
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
void JSObject::initObjectObject(JSScope *g)
|
||||
void JSObject::initObjectObject(JSScope *)
|
||||
{
|
||||
// The ObjectPrototypeObject has already been constructed by static initialization.
|
||||
|
||||
|
@ -168,7 +168,7 @@ void JSFunction::initFunctionObject(JSScope *g)
|
|||
{
|
||||
// first build the Function Prototype Object
|
||||
FunctionPrototypeObject = new JSNativeFunction(functionPrototypeFunction);
|
||||
for (int i = 0; i < sizeof(FunctionFunctions) / sizeof(FunctionFunctionEntry); i++)
|
||||
for (uint i = 0; i < sizeof(FunctionFunctions) / sizeof(FunctionFunctionEntry); i++)
|
||||
FunctionPrototypeObject->setProperty(widenCString(FunctionFunctions[i].name), JSValue(new JSNativeFunction(FunctionFunctions[i].fn) ) );
|
||||
|
||||
ASSERT(g->getProperty(*FunctionString).isObject());
|
||||
|
@ -183,7 +183,7 @@ void JSFunction::initFunctionObject(JSScope *g)
|
|||
|
||||
JSString* JSBoolean::BooleanString = new JSString("Boolean");
|
||||
|
||||
static JSValue boolean_constructor(Context *cx, const JSValues& argv)
|
||||
static JSValue boolean_constructor(Context */*cx*/, const JSValues& argv)
|
||||
{
|
||||
// argv[0] will be NULL
|
||||
if (argv.size() > 1)
|
||||
|
@ -192,7 +192,7 @@ static JSValue boolean_constructor(Context *cx, const JSValues& argv)
|
|||
return JSValue(new JSBoolean(false));
|
||||
}
|
||||
|
||||
static JSValue boolean_toString(Context *cx, const JSValues& argv)
|
||||
static JSValue boolean_toString(Context */*cx*/, const JSValues& argv)
|
||||
{
|
||||
if (argv.size() > 0) {
|
||||
JSValue theThis = argv[0];
|
||||
|
@ -209,7 +209,7 @@ static JSValue boolean_toString(Context *cx, const JSValues& argv)
|
|||
return kUndefinedValue;
|
||||
}
|
||||
|
||||
static JSValue boolean_valueOf(Context *cx, const JSValues& argv)
|
||||
static JSValue boolean_valueOf(Context *, const JSValues&)
|
||||
{
|
||||
return kUndefinedValue;
|
||||
}
|
||||
|
@ -230,7 +230,7 @@ void JSBoolean::initBooleanObject(JSScope *g)
|
|||
BooleanPrototypeObject = new JSObject();
|
||||
BooleanPrototypeObject->setClass(new JSString(BooleanString));
|
||||
|
||||
for (int i = 0; i < sizeof(BooleanFunctions) / sizeof(BooleanFunctionEntry); i++)
|
||||
for (uint i = 0; i < sizeof(BooleanFunctions) / sizeof(BooleanFunctionEntry); i++)
|
||||
BooleanPrototypeObject->setProperty(widenCString(BooleanFunctions[i].name), JSValue(new JSNativeFunction(BooleanFunctions[i].fn) ) );
|
||||
|
||||
ASSERT(g->getProperty(*BooleanString).isObject());
|
||||
|
@ -240,13 +240,13 @@ void JSBoolean::initBooleanObject(JSScope *g)
|
|||
|
||||
/********** Date Object Stuff **************************/
|
||||
|
||||
static JSValue date_constructor(Context *cx, const JSValues& argv)
|
||||
static JSValue date_constructor(Context *, const JSValues&)
|
||||
{
|
||||
// return JSValue(new JSDate());
|
||||
return JSValue(new JSObject());
|
||||
}
|
||||
|
||||
static JSValue date_invokor(Context *cx, const JSValues& argv)
|
||||
static JSValue date_invokor(Context *, const JSValues&)
|
||||
{
|
||||
return JSValue(new JSString("now"));
|
||||
}
|
||||
|
@ -447,6 +447,8 @@ int JSValue::operator==(const JSValue& value) const
|
|||
case integer_tag : return (this->f64 == value.f64);
|
||||
// question: are all undefined values equal to one another?
|
||||
case undefined_tag: return 1;
|
||||
default:
|
||||
NOT_REACHED("Broken compiler?");
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
@ -654,7 +656,7 @@ JSValue JSValue::valueToInteger(const JSValue& value)
|
|||
ASSERT(result.tag == f64_tag);
|
||||
result.tag = i32_tag;
|
||||
bool neg = (result.f64 < 0);
|
||||
result.i32 = floor((neg) ? -result.f64 : result.f64);
|
||||
result.i32 = (int32)floor((neg) ? -result.f64 : result.f64);
|
||||
result.i32 = (neg) ? -result.i32 : result.i32;
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -661,7 +661,7 @@ namespace JSTypes {
|
|||
static JSObject* BooleanPrototypeObject;
|
||||
static JSString* BooleanString;
|
||||
public:
|
||||
JSBoolean(bool value) : mValue(value), JSObject(BooleanPrototypeObject) { setClass(BooleanString); }
|
||||
JSBoolean(bool value) : JSObject(BooleanPrototypeObject), mValue(value) { setClass(BooleanString); }
|
||||
|
||||
static void initBooleanObject(JSScope *g);
|
||||
|
||||
|
|
|
@ -429,8 +429,11 @@ sub collect {
|
|||
my $printops_body = &get_printops_body(@types);
|
||||
my $printops_decl = "virtual Formatter& printOperands(Formatter& f, ";
|
||||
|
||||
$printops_decl .= ($dec_list =~ /ArgumentList/) ?
|
||||
"const JSValues& registers" :
|
||||
# $printops_decl .= ($dec_list =~ /ArgumentList/) ?
|
||||
# "const JSValues& registers" :
|
||||
# "const JSValues& registers";
|
||||
$printops_decl .= ($printops_body eq "") ?
|
||||
"const JSValues& /*registers*/" :
|
||||
"const JSValues& registers";
|
||||
$printops_decl .= ") {\n";
|
||||
|
||||
|
|
|
@ -121,7 +121,7 @@
|
|||
f << opcodeNames[BRANCH] << "\t" << "Offset " << ((mOp1) ? mOp1->mOffset : NotAnOffset);
|
||||
return f;
|
||||
}
|
||||
virtual Formatter& printOperands(Formatter& f, const JSValues& registers) {
|
||||
virtual Formatter& printOperands(Formatter& f, const JSValues& /*registers*/) {
|
||||
return f;
|
||||
}
|
||||
};
|
||||
|
@ -258,7 +258,7 @@
|
|||
f << opcodeNames[DEBUGGER];
|
||||
return f;
|
||||
}
|
||||
virtual Formatter& printOperands(Formatter& f, const JSValues& registers) {
|
||||
virtual Formatter& printOperands(Formatter& f, const JSValues& /*registers*/) {
|
||||
return f;
|
||||
}
|
||||
};
|
||||
|
@ -435,7 +435,7 @@
|
|||
f << opcodeNames[JSR] << "\t" << "Offset " << ((mOp1) ? mOp1->mOffset : NotAnOffset);
|
||||
return f;
|
||||
}
|
||||
virtual Formatter& printOperands(Formatter& f, const JSValues& registers) {
|
||||
virtual Formatter& printOperands(Formatter& f, const JSValues& /*registers*/) {
|
||||
return f;
|
||||
}
|
||||
};
|
||||
|
@ -635,7 +635,7 @@
|
|||
f << opcodeNames[NOP];
|
||||
return f;
|
||||
}
|
||||
virtual Formatter& printOperands(Formatter& f, const JSValues& registers) {
|
||||
virtual Formatter& printOperands(Formatter& f, const JSValues& /*registers*/) {
|
||||
return f;
|
||||
}
|
||||
};
|
||||
|
@ -732,7 +732,7 @@
|
|||
f << opcodeNames[RETURN_VOID];
|
||||
return f;
|
||||
}
|
||||
virtual Formatter& printOperands(Formatter& f, const JSValues& registers) {
|
||||
virtual Formatter& printOperands(Formatter& f, const JSValues& /*registers*/) {
|
||||
return f;
|
||||
}
|
||||
};
|
||||
|
@ -747,7 +747,7 @@
|
|||
f << opcodeNames[RTS];
|
||||
return f;
|
||||
}
|
||||
virtual Formatter& printOperands(Formatter& f, const JSValues& registers) {
|
||||
virtual Formatter& printOperands(Formatter& f, const JSValues& /*registers*/) {
|
||||
return f;
|
||||
}
|
||||
};
|
||||
|
@ -967,7 +967,7 @@
|
|||
f << opcodeNames[TRYIN] << "\t" << "Offset " << ((mOp1) ? mOp1->mOffset : NotAnOffset) << ", " << "Offset " << ((mOp2) ? mOp2->mOffset : NotAnOffset);
|
||||
return f;
|
||||
}
|
||||
virtual Formatter& printOperands(Formatter& f, const JSValues& registers) {
|
||||
virtual Formatter& printOperands(Formatter& f, const JSValues& /*registers*/) {
|
||||
return f;
|
||||
}
|
||||
};
|
||||
|
@ -982,7 +982,7 @@
|
|||
f << opcodeNames[TRYOUT];
|
||||
return f;
|
||||
}
|
||||
virtual Formatter& printOperands(Formatter& f, const JSValues& registers) {
|
||||
virtual Formatter& printOperands(Formatter& f, const JSValues& /*registers*/) {
|
||||
return f;
|
||||
}
|
||||
};
|
||||
|
@ -1038,7 +1038,7 @@
|
|||
f << opcodeNames[WITHOUT];
|
||||
return f;
|
||||
}
|
||||
virtual Formatter& printOperands(Formatter& f, const JSValues& registers) {
|
||||
virtual Formatter& printOperands(Formatter& f, const JSValues& /*registers*/) {
|
||||
return f;
|
||||
}
|
||||
};
|
||||
|
|
|
@ -1902,7 +1902,7 @@ TypedRegister ICodeGenerator::genStmt(StmtNode *p, LabelSet *currentLabelSet)
|
|||
FILE* f = fopen(str.c_str(), "r");
|
||||
if (f) {
|
||||
Context cx(*mWorld, mGlobal);
|
||||
JSValue result = cx.readEvalFile(f, *fileName);
|
||||
(void)cx.readEvalFile(f, *fileName);
|
||||
fclose(f);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -504,7 +504,7 @@ void Context::initOperatorsPackage()
|
|||
{ "defineIdentical", defineIdentical },
|
||||
};
|
||||
|
||||
for (int i = 0; i < sizeof(OBOs) / sizeof(struct OBO); i++)
|
||||
for (uint i = 0; i < sizeof(OBOs) / sizeof(struct OBO); i++)
|
||||
mGlobal->defineNativeFunction(mWorld.identifiers[widenCString(OBOs[i].name)], OBOs[i].fun);
|
||||
|
||||
mHasOperatorsPackageLoaded = true;
|
||||
|
@ -535,7 +535,7 @@ void Context::initContext()
|
|||
{ "none", &None_Type }
|
||||
};
|
||||
|
||||
for (int i = 0; i < sizeof(PDTs) / sizeof(struct PDT); i++)
|
||||
for (uint i = 0; i < sizeof(PDTs) / sizeof(struct PDT); i++)
|
||||
mGlobal->defineVariable(widenCString(PDTs[i].name), &Type_Type, JSValue(PDTs[i].type));
|
||||
|
||||
// set up the correct [[Class]] for the global object (matching SpiderMonkey)
|
||||
|
|
|
@ -190,7 +190,7 @@ struct MathConstantEntry {
|
|||
// the properties of the Math object
|
||||
void JSMath::initMathObject(JSScope *g)
|
||||
{
|
||||
int i;
|
||||
uint i;
|
||||
JSMath *m = new JSMath();
|
||||
m->setClass(new JSString("Math"));
|
||||
|
||||
|
|
|
@ -58,7 +58,7 @@ static JSValue object_toString(Context *, const JSValues& argv)
|
|||
return kUndefinedValue;
|
||||
}
|
||||
|
||||
static JSValue object_constructor(Context *cx, const JSValues& argv)
|
||||
static JSValue object_constructor(Context *, const JSValues& /*argv*/)
|
||||
{
|
||||
// argv[0] will be NULL
|
||||
return JSValue(new JSObject());
|
||||
|
@ -82,13 +82,13 @@ JSObject *JSObject::initJSObject()
|
|||
{
|
||||
JSObject *result = new JSObject();
|
||||
|
||||
for (int i = 0; i < sizeof(ObjectFunctions) / sizeof(ObjectFunctionEntry); i++)
|
||||
for (uint i = 0; i < sizeof(ObjectFunctions) / sizeof(ObjectFunctionEntry); i++)
|
||||
result->setProperty(widenCString(ObjectFunctions[i].name), JSValue(new JSNativeFunction(ObjectFunctions[i].fn) ) );
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
void JSObject::initObjectObject(JSScope *g)
|
||||
void JSObject::initObjectObject(JSScope *)
|
||||
{
|
||||
// The ObjectPrototypeObject has already been constructed by static initialization.
|
||||
|
||||
|
@ -168,7 +168,7 @@ void JSFunction::initFunctionObject(JSScope *g)
|
|||
{
|
||||
// first build the Function Prototype Object
|
||||
FunctionPrototypeObject = new JSNativeFunction(functionPrototypeFunction);
|
||||
for (int i = 0; i < sizeof(FunctionFunctions) / sizeof(FunctionFunctionEntry); i++)
|
||||
for (uint i = 0; i < sizeof(FunctionFunctions) / sizeof(FunctionFunctionEntry); i++)
|
||||
FunctionPrototypeObject->setProperty(widenCString(FunctionFunctions[i].name), JSValue(new JSNativeFunction(FunctionFunctions[i].fn) ) );
|
||||
|
||||
ASSERT(g->getProperty(*FunctionString).isObject());
|
||||
|
@ -183,7 +183,7 @@ void JSFunction::initFunctionObject(JSScope *g)
|
|||
|
||||
JSString* JSBoolean::BooleanString = new JSString("Boolean");
|
||||
|
||||
static JSValue boolean_constructor(Context *cx, const JSValues& argv)
|
||||
static JSValue boolean_constructor(Context */*cx*/, const JSValues& argv)
|
||||
{
|
||||
// argv[0] will be NULL
|
||||
if (argv.size() > 1)
|
||||
|
@ -192,7 +192,7 @@ static JSValue boolean_constructor(Context *cx, const JSValues& argv)
|
|||
return JSValue(new JSBoolean(false));
|
||||
}
|
||||
|
||||
static JSValue boolean_toString(Context *cx, const JSValues& argv)
|
||||
static JSValue boolean_toString(Context */*cx*/, const JSValues& argv)
|
||||
{
|
||||
if (argv.size() > 0) {
|
||||
JSValue theThis = argv[0];
|
||||
|
@ -209,7 +209,7 @@ static JSValue boolean_toString(Context *cx, const JSValues& argv)
|
|||
return kUndefinedValue;
|
||||
}
|
||||
|
||||
static JSValue boolean_valueOf(Context *cx, const JSValues& argv)
|
||||
static JSValue boolean_valueOf(Context *, const JSValues&)
|
||||
{
|
||||
return kUndefinedValue;
|
||||
}
|
||||
|
@ -230,7 +230,7 @@ void JSBoolean::initBooleanObject(JSScope *g)
|
|||
BooleanPrototypeObject = new JSObject();
|
||||
BooleanPrototypeObject->setClass(new JSString(BooleanString));
|
||||
|
||||
for (int i = 0; i < sizeof(BooleanFunctions) / sizeof(BooleanFunctionEntry); i++)
|
||||
for (uint i = 0; i < sizeof(BooleanFunctions) / sizeof(BooleanFunctionEntry); i++)
|
||||
BooleanPrototypeObject->setProperty(widenCString(BooleanFunctions[i].name), JSValue(new JSNativeFunction(BooleanFunctions[i].fn) ) );
|
||||
|
||||
ASSERT(g->getProperty(*BooleanString).isObject());
|
||||
|
@ -240,13 +240,13 @@ void JSBoolean::initBooleanObject(JSScope *g)
|
|||
|
||||
/********** Date Object Stuff **************************/
|
||||
|
||||
static JSValue date_constructor(Context *cx, const JSValues& argv)
|
||||
static JSValue date_constructor(Context *, const JSValues&)
|
||||
{
|
||||
// return JSValue(new JSDate());
|
||||
return JSValue(new JSObject());
|
||||
}
|
||||
|
||||
static JSValue date_invokor(Context *cx, const JSValues& argv)
|
||||
static JSValue date_invokor(Context *, const JSValues&)
|
||||
{
|
||||
return JSValue(new JSString("now"));
|
||||
}
|
||||
|
@ -447,6 +447,8 @@ int JSValue::operator==(const JSValue& value) const
|
|||
case integer_tag : return (this->f64 == value.f64);
|
||||
// question: are all undefined values equal to one another?
|
||||
case undefined_tag: return 1;
|
||||
default:
|
||||
NOT_REACHED("Broken compiler?");
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
@ -654,7 +656,7 @@ JSValue JSValue::valueToInteger(const JSValue& value)
|
|||
ASSERT(result.tag == f64_tag);
|
||||
result.tag = i32_tag;
|
||||
bool neg = (result.f64 < 0);
|
||||
result.i32 = floor((neg) ? -result.f64 : result.f64);
|
||||
result.i32 = (int32)floor((neg) ? -result.f64 : result.f64);
|
||||
result.i32 = (neg) ? -result.i32 : result.i32;
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -661,7 +661,7 @@ namespace JSTypes {
|
|||
static JSObject* BooleanPrototypeObject;
|
||||
static JSString* BooleanString;
|
||||
public:
|
||||
JSBoolean(bool value) : mValue(value), JSObject(BooleanPrototypeObject) { setClass(BooleanString); }
|
||||
JSBoolean(bool value) : JSObject(BooleanPrototypeObject), mValue(value) { setClass(BooleanString); }
|
||||
|
||||
static void initBooleanObject(JSScope *g);
|
||||
|
||||
|
|
|
@ -429,8 +429,11 @@ sub collect {
|
|||
my $printops_body = &get_printops_body(@types);
|
||||
my $printops_decl = "virtual Formatter& printOperands(Formatter& f, ";
|
||||
|
||||
$printops_decl .= ($dec_list =~ /ArgumentList/) ?
|
||||
"const JSValues& registers" :
|
||||
# $printops_decl .= ($dec_list =~ /ArgumentList/) ?
|
||||
# "const JSValues& registers" :
|
||||
# "const JSValues& registers";
|
||||
$printops_decl .= ($printops_body eq "") ?
|
||||
"const JSValues& /*registers*/" :
|
||||
"const JSValues& registers";
|
||||
$printops_decl .= ") {\n";
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче