Commit Graph
3919 Commits
Author SHA1 Message Date
Thomas Weber bb64cd7ec8 Support "last key pressed" outside of compiler 2020-09-17 14:20:34 -05:00
Thomas Weber f380960e25 js: acos and asin can return NaN 2020-09-16 21:53:09 -05:00
Thomas Weber 1554781ee8 Remove extra whitespace 2020-09-16 21:53:01 -05:00
Thomas Weber 6a323615d5 ast+execute+js: compile sensing_distanceto 2020-09-16 21:49:24 -05:00
Thomas Weber 85afda866a js: Round size 2020-09-12 12:16:14 -05:00
Thomas Weber 16e749dabf ast: Less aggressively skip unnecessary analysis to fix errors from recursive functions 2020-09-12 00:19:08 -05:00
Thomas Weber 4608e339fe js: Use unshift() instead of splice() for insert at 1 of list 2020-09-11 15:27:47 -05:00
Thomas Weber e3f3bbe77c Use emitFast in some hotspots 2020-09-11 14:44:06 -05:00
Thomas Weber 954a88582e Add EventEmitter.emitFast 2020-09-11 14:43:41 -05:00
Thomas Weber f81aac7af2 ast+js: Direction recursion should yield (#18)
This is still not perfect, as Scratch will search the last 5 calls to determine if a function recurses.
However, this covers the 90% case without introducing significant overhead.
2020-09-11 13:41:07 -05:00
Thomas Weber 9e03e28c9b ast: Convert list.delete to list.deleteAll when input is constant "all" 2020-09-10 18:15:10 -05:00
Thomas Weber 0b3ac86385 js: Remove isConstantInput 2020-09-10 16:30:18 -05:00
Thomas Weber bca19a7efa js: Restore variable type inference with less bugs 2020-09-10 16:29:45 -05:00
Thomas Weber c7a4f4cde0 Revert "js: Optimize op.equals when comparing against a constant 0"
This reverts commit 3ed2fffa0b.
2020-09-10 12:16:36 -05:00
Thomas Weber 4a0d27af76 execute: Fix listIndex 2020-09-10 11:21:33 -05:00
Thomas Weber 5a2b3e115d Revert "js: Optimize op.less when right side is always a number"
This reverts commit 36ee6f65de.
2020-09-10 11:09:17 -05:00
Thomas Weber e8d1e449a9 execute: Optimize listIndex 2020-09-09 22:03:56 -05:00
Thomas Weber 80e0bccabc js: Use bitwise | 0 instead of Math.floor in list.get optimization
This is a lot more significant than I imagined it would be.
2020-09-09 22:03:24 -05:00
Thomas Weber 94f09e10b2 js+execute: Remove listGetFast
The ?? operator is used instead.
Older browsers now simply won't get this optimization.
2020-09-09 22:03:24 -05:00
Thomas Weber 36ee6f65de js: Optimize op.less when right side is always a number 2020-09-09 21:52:35 -05:00
Thomas Weber 3ed2fffa0b js: Optimize op.equals when comparing against a constant 0 2020-09-09 21:52:28 -05:00
Thomas Weber e5fa43b452 js: Improve sanitize 2020-09-09 14:42:31 -05:00
Thomas Weber eebd40fec4 Add Input.asNumberOrNaN
Might be used later
2020-09-09 14:29:50 -05:00
Thomas Weber f190934150 Merge branch 'develop' of https://github.com/llk/scratch-vm into develop 2020-09-03 15:13:06 -05:00
DD Liu 7c652246df Merge pull request #2356 from adroitwhiz/cast-to-black
Cast malformed color hex strings to RGBA 0,0,0,255 instead of null
2020-09-03 15:52:52 -04:00
Thomas Weber 7b739fc7f9 js: Nuke VariableInput and Frame 2020-08-31 21:20:59 -05:00
Thomas Weber a4f096ae8d js: remove inheritValues (#15)
The caching of VariableInputs was causing one stack to incorrectly affect another stack.
The fix is to remove inheritValues entirely until a better method of doing this can be found.
A third phase of compilation is the most likely thing.
2020-08-31 19:40:20 -05:00
Thomas Weber 25fc927522 Fix code style 2020-08-31 15:26:00 -05:00
Thomas Weber 37c313b3a1 Use new Function instead of eval when testing for nullish coalescing operator 2020-08-31 15:25:54 -05:00
Thomas Weber f999252917 execute: Cleanup some code 2020-08-31 15:23:19 -05:00
Thomas Weber c50aeaf740 Revert "js: Remove type from VariableInput"
This reverts commit 8f66924fe9.
2020-08-30 16:37:25 -05:00
Thomas Weber 8f66924fe9 js: Remove type from VariableInput 2020-08-30 16:25:14 -05:00
Thomas Weber 9e9b414620 js: Fix VariableInput infinite recursion 2020-08-30 16:09:56 -05:00
Thomas Weber c4bb8fabba js: Use Object.create(null) for variable input cache
This should fix some potential problems when a variable has an ID like toString
2020-08-30 12:48:28 -05:00
Thomas Weber 1ffdc1a2a4 js: Improve variable type analysis
Redundant type casts are now removed.
2020-08-30 12:39:59 -05:00
Thomas Weber 2d7579d6b2 js: Allow the new frame to inherit values from the old frame, if enabled. 2020-08-30 12:39:10 -05:00
Thomas Weber 38f325e73f js: Store the last value a variable was set to for use in analysis 2020-08-30 12:25:23 -05:00
Thomas Weber 14c04ad947 js: Cleanup descendVariable 2020-08-30 12:21:38 -05:00
Thomas Weber 559280f2d5 js: Add VariableInput
This adds a new type of Input for variables.
This input is cached in the current frame.
2020-08-30 12:21:05 -05:00
Thomas Weber 63a755c1f8 ast: remove var.change
var.change is replaced with a var.set
2020-08-30 11:58:03 -05:00
Thomas Weber 2b1b665952 js: Implement basic stack frame tracking 2020-08-30 11:53:39 -05:00
Thomas Weber 8906347ed6 Refactor script compiling
This moves most of JSCompiler into compile, where it should be anyways.
This will make more sense in the future if there is ever more than 1 code generator (asm.js? wasm? glsl? who knows)
2020-08-29 23:01:53 -05:00
Thomas Weber c980b780ed js: Add isConstantInput() helper 2020-08-29 22:41:15 -05:00
Thomas Weber a39701297a js: replace listGetFast with the nullish coalescing operator when supported 2020-08-29 21:06:53 -05:00
Thomas Weber fcd3f35995 js: Remove unused isAlwaysNumberOrNaN 2020-08-29 20:52:47 -05:00
Thomas Weber 1240c31b93 Merge branch 'optimize' into develop 2020-08-29 14:29:50 -05:00
Thomas Weber 2e79194da2 js: Remove some unsafe op.greater, op.less optimizations 2020-08-29 14:04:29 -05:00
Thomas Weber bf6cd9c977 js: Optimize op.greater and op.less similar to op.equals 2020-08-29 13:07:22 -05:00
Thomas Weber f4e97a9e3f js: We stores isAlwaysNumber in a variable, so let's use that instead of running it again 2020-08-29 12:42:26 -05:00
Thomas Weber 41d2084bbd js: Refactor non-zero constant checking out of op.equals 2020-08-29 12:40:59 -05:00