-
Notifications
You must be signed in to change notification settings - Fork 154
QuickJS #1764
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
QuickJS #1764
Changes from 7 commits
a73f0c0
ef45f07
691b4e4
61d4e2a
e64b188
7d88431
1a26706
797dbe0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -371,21 +371,36 @@ | |
| } | ||
| } | ||
|
|
||
| currentScene = eval(code + "\r\ncreateScene(engine)"); | ||
|
|
||
| if (currentScene.then) { | ||
| // Handle if createScene returns a promise | ||
| currentScene.then(function (scene) { | ||
| currentScene = scene; | ||
| processCurrentScene(test, referenceImage, done, compareFunction); | ||
| }).catch(function (e) { | ||
| console.error(e); | ||
| const pgCode = code + "\r\ncreateScene(engine)"; | ||
| // Defer scene construction to a fresh macrotask so | ||
| // eval()/createScene() run at a shallow native-stack | ||
| // depth instead of nested inside the native snippet | ||
| // load callback. Deep scenes otherwise pile onto the | ||
| // native XHR dispatch frames and can overflow engines | ||
| // with a small C stack (e.g. QuickJS). | ||
|
Comment on lines
+375
to
+380
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Wouldn't Babylon users hit the same problem? This isn't unique to validation tests, right?
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes, it's a stack overflow issue. This should happen with other JS engines as well. debug/release build also have influence on the number of stack element count. QuickJS stack elements are bigger so the overflow happens sooner. |
||
| setTimeout(function () { | ||
| try { | ||
| currentScene = eval(pgCode); | ||
|
|
||
| if (currentScene.then) { | ||
| // Handle if createScene returns a promise | ||
| currentScene.then(function (scene) { | ||
| currentScene = scene; | ||
| processCurrentScene(test, referenceImage, done, compareFunction); | ||
| }).catch(function (e) { | ||
| console.error(e); | ||
| failTest(done); | ||
| }); | ||
| } else { | ||
| // Handle if createScene returns a scene | ||
| processCurrentScene(test, referenceImage, done, compareFunction); | ||
| } | ||
| } | ||
| catch (e) { | ||
| console.error("Failed to evaluate playground snippet " + test.playgroundId + ": " + e); | ||
| failTest(done); | ||
| }); | ||
| } else { | ||
| // Handle if createScene returns a scene | ||
| processCurrentScene(test, referenceImage, done, compareFunction); | ||
| } | ||
| } | ||
| }, 0); | ||
| } | ||
| catch (e) { | ||
| console.error("Failed to evaluate playground snippet " + test.playgroundId + ": " + e); | ||
|
|
@@ -442,8 +457,23 @@ | |
| } | ||
| } | ||
|
|
||
| currentScene = eval(scriptToRun + test.functionToCall + "(engine)"); | ||
| processCurrentScene(test, renderImage, done, compareFunction); | ||
| const scriptCode = scriptToRun + test.functionToCall + "(engine)"; | ||
| // Defer scene construction to a fresh macrotask so | ||
| // eval()/<functionToCall>() run at a shallow native-stack | ||
| // depth instead of nested inside the native XHR | ||
| // completion callback. Deep scenes otherwise pile onto | ||
| // the native XHR dispatch frames and can overflow engines | ||
| // with a small C stack (e.g. QuickJS). | ||
| setTimeout(function () { | ||
| try { | ||
| currentScene = eval(scriptCode); | ||
| processCurrentScene(test, renderImage, done, compareFunction); | ||
| } | ||
| catch (e) { | ||
| console.error(e); | ||
| failTest(done); | ||
| } | ||
| }, 0); | ||
| } | ||
| catch (e) { | ||
| console.error(e); | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.