Hi,everyone

I’m compiling SpiderMonkey v33 for Cocos2d-JS, but I’m facing strange issues on 
iOS 32bit architectures (i386, armv6, armv7, armv7s).

The SpiderMonkey repo is here <https://github.com/ricardoquesada/Spidermonkey/>
We modified several things to make it support iOS, you can refer to the commit 
history.

Here is the compiling configurations 
<https://github.com/ricardoquesada/Spidermonkey/blob/master/js/src/build-ios/build.sh#L21>
 for build iOS static libraries.

Then we are using SpiderMonkey in Cocos2d-JS, which works perfectly fine on 
64bit devices. We also compiled for 32bit windows and android, nothing wrong 
with those platforms neither. But on iOS 32bit architectures, we can’t create 
objects in the current context. I don’t understand what’s happening, so I will 
describe things I observed, sorry if it’s a bit long.

Original implementation:

Code link 
<https://github.com/cocos2d/cocos2d-js/blob/develop/frameworks/js-bindings/bindings/manual/ScriptingCore.cpp#L391>


From the images, you can see JS::HandleObject’s ptr is lost after a conditional 
check which doesn’t make any sense.

Improved implementation:

Code link 
<https://github.com/pandamicro/cocos2d-js/blob/ImproveBindings/frameworks/js-bindings/bindings/manual/ScriptingCore.cpp#L391>


In this way, although global is again lost, but problem solved with another 
cached HandleObject. However, when executing js files for the current context, 
all objects I registered with C++ API can not be found. So I guess there must 
be serious problems. Seems the context is totally messed up.

Oh, also, I found another strange thing, I have the following code:

std::string fullPath = futil->fullPathForFilename(path);

JS::CompileOptions op(cx);
While fullPath have intially a correct value, but once execution finished 
creating the JS::CompileOptions object, the memory of fullPath shows an empty 
string. And also, I tried to insert another local variable declaration between 
these two lines, the new local variable get polluted instead.

Conclusion

My 32 bit build of SpiderMonkey seems to violate the memory in a strange way. 
Can anyone give me some help to get rid of these problems ?

Sorry for the long mail, and thank you in advance.

Huabin @ Cocos2d-JS <https://github.com/cocos2d/cocos2d-js/>
_______________________________________________
dev-tech-js-engine-internals mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-js-engine-internals

Reply via email to