Creator 1.8.2 正式版IOS上各种崩溃

还要音效的

0 WinningSlots-mobile	std::__1::__hash_table<std::__1::__hash_value_type<int, cocos2d::experimental::AudioPlayer*>, std::__1::__unordered_map_hasher<int, std::__1::__hash_value_type<int, cocos2d::experimental::AudioPlayer*>, std::__1::hash<int>, true>, std::__1::__unordered_map_equal<int, std::__1::__hash_value_type<int, cocos2d::experimental::AudioPlayer*>, std::__1::equal_to<int>, true>, std::__1::allocator<std::__1::__hash_value_type<int, cocos2d::experimental::AudioPlayer*> > >::remove(std::__1::__hash_const_iterator<std::__1::__hash_node<std::__1::__hash_value_type<int, cocos2d::experimental::AudioPlayer*>, void*>*>) + 56
1 WinningSlots-mobile	std::__1::__hash_table<std::__1::__hash_value_type<int, cocos2d::experimental::AudioPlayer*>, std::__1::__unordered_map_hasher<int, std::__1::__hash_value_type<int, cocos2d::experimental::AudioPlayer*>, std::__1::hash<int>, true>, std::__1::__unordered_map_equal<int, std::__1::__hash_value_type<int, cocos2d::experimental::AudioPlayer*>, std::__1::equal_to<int>, true>, std::__1::allocator<std::__1::__hash_value_type<int, cocos2d::experimental::AudioPlayer*> > >::erase(std::__1::__hash_const_iterator<std::__1::__hash_node<std::__1::__hash_value_type<int, cocos2d::experimental::AudioPlayer*>, void*>*>) + 28
2 WinningSlots-mobile	cocos2d::experimental::AudioEngineImpl::update(float) + 136
3 WinningSlots-mobile	cocos2d::Timer::update(float) + 196
4 WinningSlots-mobile	cocos2d::Scheduler::update(float) + 280
5 WinningSlots-mobile	cocos2d::Director::drawScene() + 72
6 WinningSlots-mobile	cocos2d::Director::mainLoop() + 56
7 QuartzCore	CA::Display::DisplayLink::dispatch_items(unsigned long long, unsigned long long, unsigned long long) + 672
8 QuartzCore	display_timer_callback(__CFMachPort*, void*, long, void*) + 240
9 CoreFoundation	___CFMachPortPerform + 188
10 CoreFoundation	___CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 56
11 CoreFoundation	___CFRunLoopDoSource1 + 440
12 CoreFoundation	___CFRunLoopRun + 2196
13 CoreFoundation	CFRunLoopRunSpecific + 436
14 GraphicsServices	GSEventRunModal + 100
15 UIKit	UIApplicationMain + 236
16 WinningSlots-mobile	main (main.m:8)
17 libdyld.dylib	_start + 4

我再找找看栈信息,还碰到过JavaScriptCore子线程的Mark崩溃,都是很怪异的。我后来换成SpiderMonkey, 也比较稳定,但性能不行啊。

还有一处

Thread 1 Queue : com.apple.main-thread (serial)
#0	0x00000001854083cc in JSC::speculationFromCell(JSC::JSCell*) ()
#1	0x00000001851926f0 in JSC::CodeBlock::updateAllPredictionsAndCountLiveness(unsigned int&, unsigned int&) ()
#2	0x00000001850d0ba4 in JSC::CodeBlock::stronglyVisitStrongReferences(JSC::SlotVisitor&) ()
#3	0x00000001850d0340 in JSC::CodeBlock::visitAggregate(JSC::SlotVisitor&) ()
#4	0x00000001850cfcd0 in JSC::FunctionExecutable::visitChildren(JSC::JSCell*, JSC::SlotVisitor&) ()
#5	0x000000018500f0b8 in JSC::SlotVisitor::drain() ()
#6	0x00000001852b65b4 in JSC::Heap::markRoots(double) ()
#7	0x00000001852b8100 in JSC::Heap::collect(JSC::HeapOperation) ()
#8	0x00000001851a94d8 in JSC::GCActivityCallback::doWork() ()
#9	0x000000018500d624 in JSC::HeapTimer::timerDidFire(__CFRunLoopTimer*, void*) ()
#10	0x0000000183b0ec20 in __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ ()
#11	0x0000000183b0e8d0 in __CFRunLoopDoTimer ()
#12	0x0000000183b0c31c in __CFRunLoopRun ()
#13	0x0000000183a391f4 in CFRunLoopRunSpecific ()
#14	0x000000018ce5b6fc in GSEventRunModal ()
#15	0x00000001883ca10c in UIApplicationMain ()
#16	0x00000001000d5ec0 in main at /Users/liujun/Projects/Chariot/ChariotClient/frameworks/runtime-src/proj.ios_mac/ios/main.m:8
#17	0x00000001951b2a08 in start ()

一处

#0	0x000000018530d75c in long long JSC::APICallbackFunction::call<JSC::JSCallbackFunction>(JSC::ExecState*) ()
#1	0x0000000185054fbc in JSC::LLInt::setUpCall(JSC::ExecState*, JSC::Instruction*, JSC::CodeSpecializationKind, JSC::JSValue, JSC::LLIntCallLinkInfo*) ()
#2	0x0000000185385fd0 in llint_entry ()
#3	0x0000000185385f78 in llint_entry ()
#4	0x0000000185385f78 in llint_entry ()
#5	0x0000000185385fdc in llint_entry ()
#6	0x0000000185385fdc in llint_entry ()
#7	0x0000000185385f78 in llint_entry ()
#8	0x0000000185385f78 in llint_entry ()
#9	0x000000018537fd74 in callToJavaScript ()
#10	0x00000001852ee3d8 in JSC::JITCode::execute(JSC::VM*, JSC::ProtoCallFrame*) ()
#11	0x00000001850594d8 in JSC::Interpreter::executeCall(JSC::ExecState*, JSC::JSObject*, JSC::CallType, JSC::CallData const&, JSC::JSValue, JSC::ArgList const&) ()
#12	0x000000018513066c in JSC::boundFunctionCall(JSC::ExecState*) ()
#13	0x000000018537fefc in callToNativeFunction ()
#14	0x000000018505951c in JSC::Interpreter::executeCall(JSC::ExecState*, JSC::JSObject*, JSC::CallType, JSC::CallData const&, JSC::JSValue, JSC::ArgList const&) ()
#15	0x0000000185059264 in JSObjectCallAsFunction ()
#16	0x00000001001040a8 in se::Object::call(std::__1::vector<se::Value, std::__1::allocator<se::Value> > const&, se::Object*, se::Value*) at /Users/liujun/Projects/Chariot/ChariotClient/frameworks/cocos2d-x/cocos/scripting/js-bindings/jswrapper/jsc/Object.cpp:536
#17	0x0000000100141588 in js_cocos2dx_CallFunc_init(cocos2d::CallFuncN*, se::Object*, std::__1::vector<se::Value, std::__1::allocator<se::Value> > const&)::$_18::operator()(cocos2d::Node*) const at /Users/liujun/Projects/Chariot/ChariotClient/frameworks/cocos2d-x/cocos/scripting/js-bindings/manual/jsb_cocos2dx_manual.cpp:1529
#18	0x00000001001410a4 in decltype(std::__1::forward<js_cocos2dx_CallFunc_init(cocos2d::CallFuncN*, se::Object*, std::__1::vector<se::Value, std::__1::allocator<se::Value> > const&)::$_18&>(fp)(std::__1::forward<cocos2d::Node*>(fp0))) std::__1::__invoke<js_cocos2dx_CallFunc_init(cocos2d::CallFuncN*, se::Object*, std::__1::vector<se::Value, std::__1::allocator<se::Value> > const&)::$_18&, cocos2d::Node*>(js_cocos2dx_CallFunc_init(cocos2d::CallFuncN*, se::Object*, std::__1::vector<se::Value, std::__1::allocator<se::Value> > const&)::$_18&&&, cocos2d::Node*&&) [inlined] at /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/type_traits:4291
#19	0x0000000100141084 in void std::__1::__invoke_void_return_wrapper<void>::__call<js_cocos2dx_CallFunc_init(cocos2d::CallFuncN*, se::Object*, std::__1::vector<se::Value, std::__1::allocator<se::Value> > const&)::$_18&, cocos2d::Node*>(js_cocos2dx_CallFunc_init(cocos2d::CallFuncN*, se::Object*, std::__1::vector<se::Value, std::__1::allocator<se::Value> > const&)::$_18&&&, cocos2d::Node*&&) at /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/__functional_base:359
#20	0x0000000100140bbc in std::__1::__function::__func<js_cocos2dx_CallFunc_init(cocos2d::CallFuncN*, se::Object*, std::__1::vector<se::Value, std::__1::allocator<se::Value> > const&)::$_18, std::__1::allocator<js_cocos2dx_CallFunc_init(cocos2d::CallFuncN*, se::Object*, std::__1::vector<se::Value, std::__1::allocator<se::Value> > const&)::$_18>, void (cocos2d::Node*)>::operator()(cocos2d::Node*&&) at /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/functional:1552
#21	0x00000001009dd13c in std::__1::function<void (cocos2d::Node*)>::operator()(cocos2d::Node*) const at /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/functional:1903
#22	0x00000001009dd094 in cocos2d::CallFuncN::execute() at /Users/liujun/Projects/Chariot/ChariotClient/frameworks/cocos2d-x/cocos/2d/CCActionInstant.cpp:400
#23	0x00000001009dceb4 in cocos2d::CallFunc::update(float) at /Users/liujun/Projects/Chariot/ChariotClient/frameworks/cocos2d-x/cocos/2d/CCActionInstant.cpp:368
#24	0x0000000100a4a624 in cocos2d::Sequence::update(float) at /Users/liujun/Projects/Chariot/ChariotClient/frameworks/cocos2d-x/cocos/2d/CCActionInterval.cpp:433
#25	0x0000000100a4a49c in cocos2d::Sequence::update(float) at /Users/liujun/Projects/Chariot/ChariotClient/frameworks/cocos2d-x/cocos/2d/CCActionInterval.cpp:406
#26	0x0000000100a49464 in cocos2d::ActionInterval::step(float) at /Users/liujun/Projects/Chariot/ChariotClient/frameworks/cocos2d-x/cocos/2d/CCActionInterval.cpp:140
#27	0x0000000100a5d6f8 in cocos2d::ActionManager::update(float) at /Users/liujun/Projects/Chariot/ChariotClient/frameworks/cocos2d-x/cocos/2d/CCActionManager.cpp:454
#28	0x0000000100a2707c in void cocos2d::Scheduler::scheduleUpdate<cocos2d::ActionManager>(cocos2d::ActionManager*, int, bool)::'lambda'(float)::operator()(float) const at /Users/liujun/Projects/Chariot/ChariotClient/frameworks/cocos2d-x/build/../cocos/base/CCScheduler.h:287
#29	0x0000000100a2704c in decltype(std::__1::forward<cocos2d::ActionManager>(fp)(std::__1::forward<float>(fp0))) std::__1::__invoke<void cocos2d::Scheduler::scheduleUpdate<cocos2d::ActionManager>(cocos2d::ActionManager*, int, bool)::'lambda'(float)&, float>(cocos2d::ActionManager&&, float&&) [inlined] at /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/type_traits:4291
#30	0x0000000100a2702c in void std::__1::__invoke_void_return_wrapper<void>::__call<void cocos2d::Scheduler::scheduleUpdate<cocos2d::ActionManager>(cocos2d::ActionManager*, int, bool)::'lambda'(float)&, float>(void cocos2d::Scheduler::scheduleUpdate<cocos2d::ActionManager>(cocos2d::ActionManager*, int, bool)::'lambda'(float)&&&, float&&) at /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/__functional_base:359
#31	0x0000000100a26ea8 in std::__1::__function::__func<void cocos2d::Scheduler::scheduleUpdate<cocos2d::ActionManager>(cocos2d::ActionManager*, int, bool)::'lambda'(float), std::__1::allocator<void cocos2d::Scheduler::scheduleUpdate<cocos2d::ActionManager>(cocos2d::ActionManager*, int, bool)::'lambda'(float)>, void (float)>::operator()(float&&) at /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/functional:1552
#32	0x00000001009bc358 in std::__1::function<void (float)>::operator()(float) const at /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/functional:1903
#33	0x00000001009c8a68 in cocos2d::Scheduler::update(float) at /Users/liujun/Projects/Chariot/ChariotClient/frameworks/cocos2d-x/cocos/base/CCScheduler.cpp:843
#34	0x0000000100a1fb2c in cocos2d::Director::drawScene() at /Users/liujun/Projects/Chariot/ChariotClient/frameworks/cocos2d-x/cocos/base/CCDirector.cpp:312
#35	0x0000000100a246c0 in cocos2d::Director::mainLoop() at /Users/liujun/Projects/Chariot/ChariotClient/frameworks/cocos2d-x/cocos/base/CCDirector.cpp:1457
#36	0x0000000100ea8690 in ::-[CCDirectorCaller doCaller:](id) at /Users/liujun/Projects/Chariot/ChariotClient/frameworks/cocos2d-x/cocos/platform/ios/CCDirectorCaller-ios.mm:138
#37	0x0000000187d05094 in CA::Display::DisplayLinkItem::dispatch() ()
#38	0x0000000187d04f2c in CA::Display::DisplayLink::dispatch_items(unsigned long long, unsigned long long, unsigned long long) ()
#39	0x0000000184ced510 in IODispatchCalloutFromCFMessage ()
#40	0x0000000183af98dc in __CFMachPortPerform ()
#41	0x0000000183b0e548 in __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ ()
#42	0x0000000183b0e4a8 in __CFRunLoopDoSource1 ()
#43	0x0000000183b0c428 in __CFRunLoopRun ()
#44	0x0000000183a391f4 in CFRunLoopRunSpecific ()
#45	0x000000018ce5b6fc in GSEventRunModal ()
#46	0x00000001883ca10c in UIApplicationMain ()
#47	0x00000001000f9ec0 in main at /Users/liujun/Projects/Chariot/ChariotClient/frameworks/runtime-src/proj.ios_mac/ios/main.m:8
#48	0x00000001951b2a08 in start ()

后面会修复的

是不是说IOS上还不稳定?我想知道现状,免得瞎折腾。

算了,我还是先换SpiderMonkey吧,速度勉强可以接受。等IOS上的jsc的适配稳定下来再换。

奇怪,为何我发现在IOS上,我的应用,SpiderMonkey的运行比JSC快不少,这啥情况?

每个JS VM的优势不太一样,比如SpiderMonkey对native绑定的api调用速度就比jsc,v8块,而ios上jsc的js代码执行速度比SpiderMonkey快很多。

你确定是用了1.8.2版本?1.8.2是有修复 callfunc的问题的。这个有没有复现方法?

能否提供复现方式?目前静态分析很难定位到为题。

你用的版本也是1.8.2么?

我用的是1.8.2 不过我改动了不少代码。
算了,我自己分析吧,估计我改出来的问题。
复现问题太难了,工程太大。

恩,是182正式版的,这个在我这儿也不是必现,偶尔一两次联机调试的时候会发生,我也找不到一点头绪,但Android版确意外的稳定,唯一能确认的就是JSC环境的问题。主要是崩溃发生时,不知道运行了哪段js代码,如果能在引擎层面提供这些信息,我觉得调试就很方便了

不过现在发现,SpiderMonkey和JSC的性能,有时候还不一样,有时sm快,有时jsc快。不过整体上来看,jsc相对平稳,而spidermonkey在长时间运行后,会变慢,可能和GC的累积有关系。

是的,v8和jsc的gc性能是最好的,jsc的gc敏感度非常高,目前对引擎的绑定属于引擎接口的高级绑定,接口复杂度特别高,绑定代码哪里有一点考虑的不周全的地方就有可能在jsc上概率出现问题,而其他js引擎由于相对迟钝,特别是SpiderMonkey,所以比较难出现问题。这也解释了为什么1.6中没有出现的问题,在1.7以上版本ios比较容易概率的出现。这块后续会把绑定层级降低到渲染层面,最大可能降低复杂的绑定关系。

:clap:
总体上说JSB2.0是个好东西

IOS切换到SpiderMonkey性能还是不行,并且偶尔也会崩溃。我的都是Iphone6Plus了。并且,感觉当前版本的SpiderMonkey的性能还不如Cocos2d-x3.13中的SpiderMonkey的性能。我以前基于Cocos2d-x3.13的性能还是可以的。

Cocos Creator 与 Cocos2d-x 3.13 JSB 比较不太合理,Cocos2d-x 3.x 里面的 JSB 基本上没有框架层的 JS 代码,都是绑定 c++ 接口到 JS 层,JS 层的逻辑很少,而 Creator 的 Engine 层 JS 代码比较重,而且涉及渲染节点与逻辑节点的同步开销,整体开销肯定是比 3.x JSB 更大的。

-x 3.13 用的是 SpiderMonkey v33, Creator 1.6.2 之后是升级到 SpiderMonkey v52,之前的测试与反馈都是 v52 的性能会比v33好很多的。

对比需要做横向的,比如你用 creator 1.5.2 SpiderMonkey 与 creator 1.8.2 SpiderMonkey 比较,如果1.8.2 性能差距非常大,那么我们可能需要细查了。

在即将发布的 Creator 2.0 中,我们重写了渲染底层,性能应该能够达到 creator 历史以来的最好的水平,到时候可以测试一下。

也欢迎提供测试例给我们,以便我们发布前做更多的性能对比测试。谢谢。

即将发布是什么时间???