Bug 165429 - We should be able to throw exceptions from Wasm code and when Wasm frames are on the stack
Summary: We should be able to throw exceptions from Wasm code and when Wasm frames are...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Saam Barati
URL:
Keywords:
Depends on:
Blocks: 163351
  Show dependency treegraph
 
Reported: 2016-12-05 15:54 PST by Saam Barati
Modified: 2016-12-12 12:56 PST (History)
18 users (show)

See Also:


Attachments
WIP (73.48 KB, patch)
2016-12-05 20:18 PST, Saam Barati
no flags Details | Formatted Diff | Diff
WIP (83.17 KB, patch)
2016-12-06 14:33 PST, Saam Barati
no flags Details | Formatted Diff | Diff
WIP (65.80 KB, patch)
2016-12-09 18:19 PST, Saam Barati
no flags Details | Formatted Diff | Diff
patch (73.26 KB, patch)
2016-12-09 18:53 PST, Saam Barati
no flags Details | Formatted Diff | Diff
patch (71.88 KB, patch)
2016-12-09 19:00 PST, Saam Barati
no flags Details | Formatted Diff | Diff
patch (72.63 KB, patch)
2016-12-09 19:09 PST, Saam Barati
keith_miller: review+
Details | Formatted Diff | Diff
patch for landing (76.82 KB, patch)
2016-12-10 01:00 PST, Saam Barati
no flags Details | Formatted Diff | Diff
patch for landing (76.65 KB, patch)
2016-12-10 01:06 PST, Saam Barati
no flags Details | Formatted Diff | Diff
patch for landing (76.90 KB, patch)
2016-12-10 01:10 PST, Saam Barati
no flags Details | Formatted Diff | Diff
patch for landing (76.09 KB, patch)
2016-12-10 01:17 PST, Saam Barati
no flags Details | Formatted Diff | Diff
patch for landing (76.19 KB, patch)
2016-12-10 01:20 PST, Saam Barati
no flags Details | Formatted Diff | Diff
patch for landing (76.22 KB, patch)
2016-12-10 01:27 PST, Saam Barati
no flags Details | Formatted Diff | Diff
patch for landing (76.24 KB, patch)
2016-12-10 01:52 PST, Saam Barati
buildbot: commit-queue-
Details | Formatted Diff | Diff
Archive of layout-test-results from ews107 for mac-yosemite-wk2 (1.18 MB, application/zip)
2016-12-10 03:17 PST, Build Bot
no flags Details
Archive of layout-test-results from ews113 for mac-yosemite (2.13 MB, application/zip)
2016-12-10 03:26 PST, Build Bot
no flags Details
patch for landing (76.42 KB, patch)
2016-12-10 13:47 PST, Saam Barati
buildbot: commit-queue-
Details | Formatted Diff | Diff
Archive of layout-test-results from ews103 for mac-yosemite (1.34 MB, application/zip)
2016-12-10 17:24 PST, Build Bot
no flags Details
patch for landing (76.36 KB, patch)
2016-12-11 14:44 PST, Saam Barati
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Saam Barati 2016-12-05 15:54:30 PST
...
Comment 1 Saam Barati 2016-12-05 20:18:59 PST
Created attachment 296254 [details]
WIP

Most things are in place now, I just need to teach StackVisitor about wasm.
Comment 2 Saam Barati 2016-12-06 14:33:24 PST
Created attachment 296323 [details]
WIP

Just threw a wasm exception:


TypeError: Out of bounds memory access
------------------------
<wasm>@[wasm code]
<wasm>@[wasm code]
testWasmModuleFunctions@[native code]
module code@/Volumes/Data/WK/a/OpenSource/JSTests/wasm/function-tests/i32-load.js:27:32
evaluate@[native code]
moduleEvaluation@[native code]
[native code]
promiseReactionJob@[native code]
------------------------
Comment 3 Saam Barati 2016-12-09 18:19:39 PST
Created attachment 296760 [details]
WIP

might be done. I need to review the code and write a changelog.
Comment 4 Saam Barati 2016-12-09 18:53:39 PST
Created attachment 296765 [details]
patch
Comment 5 Saam Barati 2016-12-09 19:00:13 PST
Created attachment 296767 [details]
patch

rebased
Comment 6 WebKit Commit Bot 2016-12-09 19:01:59 PST
Attachment 296767 [details] did not pass style-queue:


ERROR: Source/JavaScriptCore/wasm/WasmB3IRGenerator.cpp:47:  Alphabetical sorting problem.  [build/include_order] [4]
ERROR: Source/JavaScriptCore/wasm/js/JSWebAssemblyModule.h:34:  Alphabetical sorting problem.  [build/include_order] [4]
ERROR: Source/JavaScriptCore/interpreter/StackVisitor.cpp:33:  Alphabetical sorting problem.  [build/include_order] [4]
ERROR: Source/JavaScriptCore/runtime/JSCell.cpp:27:  Alphabetical sorting problem.  [build/include_order] [4]
ERROR: Source/JavaScriptCore/runtime/JSCell.cpp:32:  Alphabetical sorting problem.  [build/include_order] [4]
Total errors found: 5 in 37 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 7 Saam Barati 2016-12-09 19:09:05 PST
Created attachment 296768 [details]
patch

fix merge conflict compile error.
Comment 8 WebKit Commit Bot 2016-12-09 19:11:00 PST
Attachment 296768 [details] did not pass style-queue:


ERROR: Source/JavaScriptCore/wasm/WasmB3IRGenerator.cpp:47:  Alphabetical sorting problem.  [build/include_order] [4]
ERROR: Source/JavaScriptCore/wasm/js/JSWebAssemblyModule.h:34:  Alphabetical sorting problem.  [build/include_order] [4]
ERROR: Source/JavaScriptCore/interpreter/StackVisitor.cpp:33:  Alphabetical sorting problem.  [build/include_order] [4]
ERROR: Source/JavaScriptCore/runtime/JSCell.cpp:27:  Alphabetical sorting problem.  [build/include_order] [4]
ERROR: Source/JavaScriptCore/runtime/JSCell.cpp:32:  Alphabetical sorting problem.  [build/include_order] [4]
Total errors found: 5 in 37 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 9 JF Bastien 2016-12-09 19:15:48 PST
View in context: https://bugs.webkit.org/attachment.cgi?id=296767&action=review

lgtm, but I'm not super familiar with this code so it would be good to have another look.

> Source/JavaScriptCore/API/JSContextRef.cpp:276
> +            if (visitor->hasLineAndColumnInfo()) {

Should we have a fix to collect wasm function number and index?

> Source/JavaScriptCore/interpreter/StackVisitor.cpp:162
> +#if ENABLE(WEBASSEMBLY)

Do you need these #if here and elsewhere? You're not using anything which isn't available if not wasm.

> Source/JavaScriptCore/interpreter/StackVisitor.cpp:329
> +        // FIXME:

This seems fine, why FIXME?

> Source/JavaScriptCore/runtime/JSCell.cpp:301
> +    return inherits(JSWebAssemblyCallee::info()) || inherits(WebAssemblyToJSCallee::info());

I added a function which does this in Repatch.cpp, we should share it.
Comment 10 Saam Barati 2016-12-09 20:23:06 PST
Looks like WebCore uses StackVisitor.
Comment 11 Keith Miller 2016-12-09 22:52:23 PST
Comment on attachment 296768 [details]
patch

I think this seems reasonable assuming you fix the WebCore build issues. Although, I don't fully understand why we would export StackVisitor to WebCore. It also, looks like you need to fix the Wasm-less builds too.
Comment 12 Saam Barati 2016-12-10 01:00:15 PST
Created attachment 296788 [details]
patch for landing
Comment 13 WebKit Commit Bot 2016-12-10 01:02:26 PST
Attachment 296788 [details] did not pass style-queue:


ERROR: Source/JavaScriptCore/wasm/WasmB3IRGenerator.cpp:47:  Alphabetical sorting problem.  [build/include_order] [4]
ERROR: Source/JavaScriptCore/wasm/js/JSWebAssemblyModule.h:34:  Alphabetical sorting problem.  [build/include_order] [4]
ERROR: Source/JavaScriptCore/interpreter/StackVisitor.cpp:33:  Alphabetical sorting problem.  [build/include_order] [4]
ERROR: Source/JavaScriptCore/runtime/JSCell.cpp:27:  Alphabetical sorting problem.  [build/include_order] [4]
ERROR: Source/JavaScriptCore/runtime/JSCell.cpp:32:  Alphabetical sorting problem.  [build/include_order] [4]
Total errors found: 5 in 42 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 14 Saam Barati 2016-12-10 01:06:10 PST
Created attachment 296791 [details]
patch for landing
Comment 15 Saam Barati 2016-12-10 01:10:59 PST
Created attachment 296792 [details]
patch for landing
Comment 16 WebKit Commit Bot 2016-12-10 01:12:05 PST
Attachment 296792 [details] did not pass style-queue:


ERROR: Source/JavaScriptCore/wasm/WasmB3IRGenerator.cpp:47:  Alphabetical sorting problem.  [build/include_order] [4]
ERROR: Source/JavaScriptCore/interpreter/CallFrame.cpp:188:  Multi line control clauses should use braces.  [whitespace/braces] [4]
ERROR: Source/JavaScriptCore/wasm/js/JSWebAssemblyModule.h:34:  Alphabetical sorting problem.  [build/include_order] [4]
ERROR: Source/JavaScriptCore/interpreter/StackVisitor.cpp:33:  Alphabetical sorting problem.  [build/include_order] [4]
ERROR: Source/JavaScriptCore/runtime/JSCell.cpp:27:  Alphabetical sorting problem.  [build/include_order] [4]
ERROR: Source/JavaScriptCore/runtime/JSCell.cpp:32:  Alphabetical sorting problem.  [build/include_order] [4]
Total errors found: 6 in 42 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 17 Saam Barati 2016-12-10 01:17:25 PST
Created attachment 296794 [details]
patch for landing
Comment 18 Saam Barati 2016-12-10 01:20:10 PST
Created attachment 296795 [details]
patch for landing
Comment 19 WebKit Commit Bot 2016-12-10 01:22:56 PST
Attachment 296795 [details] did not pass style-queue:


ERROR: Source/JavaScriptCore/interpreter/CallFrame.cpp:188:  Multi line control clauses should use braces.  [whitespace/braces] [4]
Total errors found: 1 in 41 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 20 Saam Barati 2016-12-10 01:27:36 PST
Created attachment 296796 [details]
patch for landing
Comment 21 WebKit Commit Bot 2016-12-10 01:29:57 PST
Attachment 296796 [details] did not pass style-queue:


ERROR: Source/JavaScriptCore/interpreter/CallFrame.cpp:188:  Multi line control clauses should use braces.  [whitespace/braces] [4]
Total errors found: 1 in 41 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 22 Saam Barati 2016-12-10 01:52:11 PST
Created attachment 296798 [details]
patch for landing
Comment 23 WebKit Commit Bot 2016-12-10 01:53:09 PST
Attachment 296798 [details] did not pass style-queue:


ERROR: Source/JavaScriptCore/interpreter/CallFrame.cpp:188:  Multi line control clauses should use braces.  [whitespace/braces] [4]
Total errors found: 1 in 41 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 24 Build Bot 2016-12-10 03:17:34 PST
Comment on attachment 296798 [details]
patch for landing

Attachment 296798 [details] did not pass mac-wk2-ews (mac-wk2):
Output: http://webkit-queues.webkit.org/results/2687180

New failing tests:
inspector/codemirror/prettyprinting-css-rules.html
Comment 25 Build Bot 2016-12-10 03:17:38 PST
Created attachment 296799 [details]
Archive of layout-test-results from ews107 for mac-yosemite-wk2

The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews.
Bot: ews107  Port: mac-yosemite-wk2  Platform: Mac OS X 10.10.5
Comment 26 Build Bot 2016-12-10 03:26:01 PST
Comment on attachment 296798 [details]
patch for landing

Attachment 296798 [details] did not pass mac-debug-ews (mac):
Output: http://webkit-queues.webkit.org/results/2687207

New failing tests:
imported/w3c/web-platform-tests/streams/readable-streams/templated.https.html
imported/w3c/web-platform-tests/streams/readable-streams/general.https.html
js/dom/Promise-static-all.html
imported/w3c/web-platform-tests/streams/byte-length-queuing-strategy.https.html
streams/readable-stream-pipeThrough.html
imported/w3c/web-platform-tests/streams/count-queuing-strategy.https.html
imported/w3c/web-platform-tests/streams/readable-streams/pipe-through.https.html
js/dom/Promise-static-race.html
Comment 27 Build Bot 2016-12-10 03:26:06 PST
Created attachment 296800 [details]
Archive of layout-test-results from ews113 for mac-yosemite

The attached test failures were seen while running run-webkit-tests on the mac-debug-ews.
Bot: ews113  Port: mac-yosemite  Platform: Mac OS X 10.10.5
Comment 28 Saam Barati 2016-12-10 13:47:42 PST
Created attachment 296822 [details]
patch for landing
Comment 29 WebKit Commit Bot 2016-12-10 13:50:07 PST
Attachment 296822 [details] did not pass style-queue:


ERROR: Source/JavaScriptCore/interpreter/CallFrame.cpp:188:  Multi line control clauses should use braces.  [whitespace/braces] [4]
Total errors found: 1 in 41 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 30 Build Bot 2016-12-10 17:24:02 PST
Comment on attachment 296822 [details]
patch for landing

Attachment 296822 [details] did not pass mac-ews (mac):
Output: http://webkit-queues.webkit.org/results/2692102

New failing tests:
inspector/codemirror/prettyprinting-javascript.html
Comment 31 Build Bot 2016-12-10 17:24:07 PST
Created attachment 296834 [details]
Archive of layout-test-results from ews103 for mac-yosemite

The attached test failures were seen while running run-webkit-tests on the mac-ews.
Bot: ews103  Port: mac-yosemite  Platform: Mac OS X 10.10.5
Comment 32 Saam Barati 2016-12-11 14:34:44 PST
(In reply to comment #31)
> Created attachment 296834 [details]
> Archive of layout-test-results from ews103 for mac-yosemite
> 
> The attached test failures were seen while running run-webkit-tests on the
> mac-ews.
> Bot: ews103  Port: mac-yosemite  Platform: Mac OS X 10.10.5

Hmmm, the crashes here don't look related to my patch. I'm going to rebase the patch and re-upload for EWS.
Comment 33 Saam Barati 2016-12-11 14:44:07 PST
Created attachment 296874 [details]
patch for landing
Comment 34 WebKit Commit Bot 2016-12-11 14:45:52 PST
Attachment 296874 [details] did not pass style-queue:


ERROR: Source/JavaScriptCore/interpreter/CallFrame.cpp:188:  Multi line control clauses should use braces.  [whitespace/braces] [4]
Total errors found: 1 in 41 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 35 WebKit Commit Bot 2016-12-11 19:11:51 PST
Comment on attachment 296874 [details]
patch for landing

Clearing flags on attachment: 296874

Committed r209696: <http://trac.webkit.org/changeset/209696>
Comment 36 WebKit Commit Bot 2016-12-11 19:11:58 PST
All reviewed patches have been landed.  Closing bug.
Comment 37 Csaba Osztrogonác 2016-12-11 23:17:57 PST
(In reply to comment #35)
> Comment on attachment 296874 [details]
> patch for landing
> 
> Clearing flags on attachment: 296874
> 
> Committed r209696: <http://trac.webkit.org/changeset/209696>

It broke the Linux builds, see build.webkit.org for details.
Comment 38 Saam Barati 2016-12-11 23:39:46 PST
(In reply to comment #37)
> (In reply to comment #35)
> > Comment on attachment 296874 [details]
> > patch for landing
> > 
> > Clearing flags on attachment: 296874
> > 
> > Committed r209696: <http://trac.webkit.org/changeset/209696>
> 
> It broke the Linux builds, see build.webkit.org for details.

About to land a speculative fix
Comment 39 Saam Barati 2016-12-11 23:47:12 PST
Tried to fix the build in:
https://trac.webkit.org/changeset/209702
Comment 40 Csaba Osztrogonác 2016-12-12 03:56:35 PST
cloop build is still broken:
https://build.webkit.org/builders/Apple%20Yosemite%20LLINT%20CLoop%20%28BuildAndTest%29/builds/22207
Comment 41 Saam Barati 2016-12-12 12:56:20 PST
(In reply to comment #40)
> cloop build is still broken:
> https://build.webkit.org/builders/
> Apple%20Yosemite%20LLINT%20CLoop%20%28BuildAndTest%29/builds/22207

Fix in:
https://trac.webkit.org/changeset/209722