RESOLVED FIXED 40214
Clean up error construction / throwing in JSC.
https://bugs.webkit.org/show_bug.cgi?id=40214
Summary Clean up error construction / throwing in JSC.
Gavin Barraclough
Reported 2010-06-06 15:30:12 PDT
The one egregious insanity here is that creating an error requires a VM-entry-esqe-host call (the string argument is wrapped as a JS object & pushed on the RegisterFile, then unwrapped back to a UString). Changing this also means you only require a global object, not an ExecState, to create an error. The methods to create error objects are also parameterized requiring a switch on the type, which can be made cleaner and faster by moving to a separate method per error type. Code to add divot information to error had been duplicated, and is coalesced back into a single function. Convenience methods added to create & throw type & syntax error with a default error message, since this is a common case. Also, errors are currently thrown either using "throwError(exec, error)" or "exec->setException(error)" - unify on the former, since this is more commonly used. Add "throwVMError(exec, error)" equivalents, as a convenience for cases where the result was being wrapped in "JSValue::encode(...)".
Attachments
The patch (202.32 KB, patch)
2010-06-06 15:36 PDT, Gavin Barraclough
sam: review+
Gavin Barraclough
Comment 1 2010-06-06 15:36:20 PDT
Created attachment 57983 [details] The patch
WebKit Review Bot
Comment 2 2010-06-06 15:38:21 PDT
Attachment 57983 [details] did not pass style-queue: Failed to run "['WebKitTools/Scripts/check-webkit-style', '--no-squash']" exit_code: 1 JavaScriptCore/runtime/Error.h:28: Alphabetical sorting problem. [build/include_order] [4] Total errors found: 1 in 87 files If any of these errors are false positives, please file a bug against check-webkit-style.
Sam Weinig
Comment 3 2010-06-06 15:51:29 PDT
Comment on attachment 57983 [details] The patch Looks good other than changing the type variable in op_new_error. r=me
WebKit Review Bot
Comment 4 2010-06-06 17:04:37 PDT
Gavin Barraclough
Comment 5 2010-06-06 17:09:28 PDT
Note You need to log in before you can comment on or make changes to this bug.