diff --git a/js/js2/interpreter.cpp b/js/js2/interpreter.cpp index 38fd455a83c5..243205d60438 100644 --- a/js/js2/interpreter.cpp +++ b/js/js2/interpreter.cpp @@ -123,13 +123,13 @@ namespace JavaScript { case LOAD_NAME: { LoadName* ln = static_cast(instruction); - (*registers)[dst(ln)] = mGlobal[*src1(ln)]; + (*registers)[dst(ln)] = (*mGlobal)[*src1(ln)]; } break; case SAVE_NAME: { SaveName* sn = static_cast(instruction); - mGlobal[*dst(sn)] = (*registers)[src1(sn)]; + (*mGlobal)[*dst(sn)] = (*registers)[src1(sn)]; } break; case NEW_OBJECT: @@ -296,7 +296,7 @@ namespace JavaScript { break; case NOT: { - Move* nt = static_cast(instruction); + Not* nt = static_cast(instruction); (*registers)[dst(nt)].i32 = !(*registers)[src1(nt)].i32; } break; diff --git a/js/js2/interpreter.h b/js/js2/interpreter.h index 41df1c40460b..2e44da313c5f 100644 --- a/js/js2/interpreter.h +++ b/js/js2/interpreter.h @@ -31,26 +31,26 @@ namespace JavaScript { class Context : public gc_base { public: - explicit Context(World& /*world */, JSObject& aGlobal) : - mGlobal(aGlobal) {}; + explicit Context(World& /*world */, JSObject* aGlobal) : + mGlobal(aGlobal) {} JSValue interpret(ICodeModule* iCode, const JSValues& args); - JSObject& setGlobalObject(JSObject& aGlobal) + JSObject* setGlobalObject(JSObject* aGlobal) { - JSObject &t = mGlobal; + JSObject* t = mGlobal; mGlobal = aGlobal; return t; } - JSObject& getGlobalObject() + JSObject* getGlobalObject() { return mGlobal; } private: /* World mWorld; */ - JSObject& mGlobal; + JSObject* mGlobal; }; /* class Interpreter */ } /* namespace JavaScript */ diff --git a/js/js2/js2.cpp b/js/js2/js2.cpp index 25c2974a4f31..ced09e5505df 100644 --- a/js/js2/js2.cpp +++ b/js/js2/js2.cpp @@ -216,7 +216,7 @@ namespace Shell { static float64 testFunctionCall(World &world, float64 n) { JSObject glob; - Context cx(world, glob); + Context cx(world, &glob); uint32 position = 0; //StringAtom& global = world.identifiers[widenCString("global")]; StringAtom& sum = world.identifiers[widenCString("sum")]; @@ -266,7 +266,7 @@ namespace Shell { static float64 testFactorial(World &world, float64 n) { JSObject glob; - Context cx(world, glob); + Context cx(world, &glob); // generate code for factorial, and interpret it. uint32 position = 0; ICodeGenerator icg; @@ -327,7 +327,7 @@ namespace Shell { static float64 testObjects(World &world, int32 n) { JSObject glob; - Context cx(world, glob); + Context cx(world, &glob); // create some objects, put some properties, and retrieve them. uint32 position = 0; ICodeGenerator initCG; diff --git a/js2/src/interpreter.cpp b/js2/src/interpreter.cpp index 38fd455a83c5..243205d60438 100644 --- a/js2/src/interpreter.cpp +++ b/js2/src/interpreter.cpp @@ -123,13 +123,13 @@ namespace JavaScript { case LOAD_NAME: { LoadName* ln = static_cast(instruction); - (*registers)[dst(ln)] = mGlobal[*src1(ln)]; + (*registers)[dst(ln)] = (*mGlobal)[*src1(ln)]; } break; case SAVE_NAME: { SaveName* sn = static_cast(instruction); - mGlobal[*dst(sn)] = (*registers)[src1(sn)]; + (*mGlobal)[*dst(sn)] = (*registers)[src1(sn)]; } break; case NEW_OBJECT: @@ -296,7 +296,7 @@ namespace JavaScript { break; case NOT: { - Move* nt = static_cast(instruction); + Not* nt = static_cast(instruction); (*registers)[dst(nt)].i32 = !(*registers)[src1(nt)].i32; } break; diff --git a/js2/src/interpreter.h b/js2/src/interpreter.h index 41df1c40460b..2e44da313c5f 100644 --- a/js2/src/interpreter.h +++ b/js2/src/interpreter.h @@ -31,26 +31,26 @@ namespace JavaScript { class Context : public gc_base { public: - explicit Context(World& /*world */, JSObject& aGlobal) : - mGlobal(aGlobal) {}; + explicit Context(World& /*world */, JSObject* aGlobal) : + mGlobal(aGlobal) {} JSValue interpret(ICodeModule* iCode, const JSValues& args); - JSObject& setGlobalObject(JSObject& aGlobal) + JSObject* setGlobalObject(JSObject* aGlobal) { - JSObject &t = mGlobal; + JSObject* t = mGlobal; mGlobal = aGlobal; return t; } - JSObject& getGlobalObject() + JSObject* getGlobalObject() { return mGlobal; } private: /* World mWorld; */ - JSObject& mGlobal; + JSObject* mGlobal; }; /* class Interpreter */ } /* namespace JavaScript */ diff --git a/js2/tests/cpp/js2_shell.cpp b/js2/tests/cpp/js2_shell.cpp index 25c2974a4f31..ced09e5505df 100644 --- a/js2/tests/cpp/js2_shell.cpp +++ b/js2/tests/cpp/js2_shell.cpp @@ -216,7 +216,7 @@ namespace Shell { static float64 testFunctionCall(World &world, float64 n) { JSObject glob; - Context cx(world, glob); + Context cx(world, &glob); uint32 position = 0; //StringAtom& global = world.identifiers[widenCString("global")]; StringAtom& sum = world.identifiers[widenCString("sum")]; @@ -266,7 +266,7 @@ namespace Shell { static float64 testFactorial(World &world, float64 n) { JSObject glob; - Context cx(world, glob); + Context cx(world, &glob); // generate code for factorial, and interpret it. uint32 position = 0; ICodeGenerator icg; @@ -327,7 +327,7 @@ namespace Shell { static float64 testObjects(World &world, int32 n) { JSObject glob; - Context cx(world, glob); + Context cx(world, &glob); // create some objects, put some properties, and retrieve them. uint32 position = 0; ICodeGenerator initCG;