Bug 129874 - Math.{max, min}() must return after first Exception value
Summary: Math.{max, min}() must return after first Exception value
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Oliver Hunt
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-03-07 02:58 PST by Tibor Mészáros
Modified: 2016-09-17 07:16 PDT (History)
7 users (show)

See Also:


Attachments
Patch v1 (1.76 KB, patch)
2014-03-07 03:00 PST, Tibor Mészáros
no flags Details | Formatted Diff | Diff
Patch (32.74 KB, patch)
2014-03-17 16:44 PDT, Oliver Hunt
buildbot: commit-queue-
Details | Formatted Diff | Diff
Archive of layout-test-results from webkit-ews-01 for mac-mountainlion (496.23 KB, application/zip)
2014-03-17 18:53 PDT, Build Bot
no flags Details
Archive of layout-test-results from webkit-ews-09 for mac-mountainlion-wk2 (469.18 KB, application/zip)
2014-03-17 19:09 PDT, Build Bot
no flags Details
Archive of layout-test-results from webkit-ews-07 for mac-mountainlion (609.99 KB, application/zip)
2014-03-17 19:33 PDT, Build Bot
no flags Details
Archive of layout-test-results from webkit-ews-03 for mac-mountainlion (609.96 KB, application/zip)
2014-03-17 20:29 PDT, Build Bot
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Tibor Mészáros 2014-03-07 02:58:54 PST
If there is more exception, it will not stop at the first, but the return value will be the first exception.
Comment 1 Tibor Mészáros 2014-03-07 03:00:52 PST
Created attachment 226105 [details]
Patch v1

If I add an if statement before the first if, we can check that there were any exception. If it was, drop a break, and the result will be this exception.
Comment 2 Oliver Hunt 2014-03-07 10:14:08 PST
It may be worth investigating implementing min/max in JS
Comment 3 Tibor Mészáros 2014-03-07 11:09:41 PST
(In reply to comment #2)
> It may be worth investigating implementing min/max in JS

I had tested that the original method will not stop at the first exception, but the return value will be the first. So the patch will fix this problem.
Comment 4 Darin Adler 2014-03-07 17:47:24 PST
Comment on attachment 226105 [details]
Patch v1

This fix looks just right. But we need to add a test case too, so someone doesn’t break it in the future.
Comment 5 Tibor Mészáros 2014-03-14 09:54:23 PDT
(In reply to comment #4)
> (From update of attachment 226105 [details])
> This fix looks just right. But we need to add a test case too, so someone doesn’t break it in the future.

Hi!

I'm sorry, but there is no way to show sideEffect, because the toNumber will return 0.0, after an exception, so complex objects will return 0.0 after an exception...

references are there:

http://trac.webkit.org/browser/trunk/Source/JavaScriptCore/runtime/JSObject.cpp?rev=164904&order=name#L1562

http://trac.webkit.org/browser/trunk/Source/JavaScriptCore/runtime/JSObject.cpp?rev=164904&order=name#L1350
Comment 6 Darin Adler 2014-03-15 17:19:22 PDT
(In reply to comment #5)
> I'm sorry, but there is no way to show sideEffect, because the toNumber will return 0.0, after an exception, so complex objects will return 0.0 after an exception...

That’s wrong. The issue is not about a return value. It’s about whether the valueOf code runs at all.
Comment 7 Oliver Hunt 2014-03-17 16:44:25 PDT
Created attachment 226977 [details]
Patch
Comment 8 Michael Saboff 2014-03-17 16:55:00 PDT
Comment on attachment 226977 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=226977&action=review

> Source/JavaScriptCore/ChangeLog:9
> +        This required fleching out a bit more of our builtins logic

*fleching*?

> Source/JavaScriptCore/builtins/Math.js:30
> +        value = +value;

Won't this mean that min(-0, +0) will return +0?  I think the spec says it should return -0.

> Source/JavaScriptCore/builtins/Math.js:47
> +        value = +value;

Won't this mean that min(-0, -1) will return +0?  I think the spec says it should return -0.
Comment 9 Build Bot 2014-03-17 18:53:50 PDT
Comment on attachment 226977 [details]
Patch

Attachment 226977 [details] did not pass mac-ews (mac):
Output: http://webkit-queues.appspot.com/results/5475724035096576

New failing tests:
js/math.html
Comment 10 Build Bot 2014-03-17 18:53:52 PDT
Created attachment 226998 [details]
Archive of layout-test-results from webkit-ews-01 for mac-mountainlion

The attached test failures were seen while running run-webkit-tests on the mac-ews.
Bot: webkit-ews-01  Port: mac-mountainlion  Platform: Mac OS X 10.8.5
Comment 11 Build Bot 2014-03-17 19:09:32 PDT
Comment on attachment 226977 [details]
Patch

Attachment 226977 [details] did not pass mac-wk2-ews (mac-wk2):
Output: http://webkit-queues.appspot.com/results/4663751877853184

New failing tests:
js/math.html
Comment 12 Build Bot 2014-03-17 19:09:35 PDT
Created attachment 227000 [details]
Archive of layout-test-results from webkit-ews-09 for mac-mountainlion-wk2

The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews.
Bot: webkit-ews-09  Port: mac-mountainlion-wk2  Platform: Mac OS X 10.8.5
Comment 13 Build Bot 2014-03-17 19:33:20 PDT
Comment on attachment 226977 [details]
Patch

Attachment 226977 [details] did not pass mac-ews (mac):
Output: http://webkit-queues.appspot.com/results/6182673236099072

New failing tests:
js/math.html
Comment 14 Build Bot 2014-03-17 19:33:24 PDT
Created attachment 227002 [details]
Archive of layout-test-results from webkit-ews-07 for mac-mountainlion

The attached test failures were seen while running run-webkit-tests on the mac-ews.
Bot: webkit-ews-07  Port: mac-mountainlion  Platform: Mac OS X 10.8.5
Comment 15 Build Bot 2014-03-17 20:29:43 PDT
Comment on attachment 226977 [details]
Patch

Attachment 226977 [details] did not pass mac-ews (mac):
Output: http://webkit-queues.appspot.com/results/4975311221424128

New failing tests:
js/math.html
Comment 16 Build Bot 2014-03-17 20:29:47 PDT
Created attachment 227004 [details]
Archive of layout-test-results from webkit-ews-03 for mac-mountainlion

The attached test failures were seen while running run-webkit-tests on the mac-ews.
Bot: webkit-ews-03  Port: mac-mountainlion  Platform: Mac OS X 10.8.5
Comment 17 Brent Fulgham 2016-08-22 11:29:49 PDT
Oliver: Is this something you plan on completing? Or should we close the bug as NTBF?
Comment 18 Michael Catanzaro 2016-09-17 07:16:36 PDT
Comment on attachment 226977 [details]
Patch

Hi,

Apologies that your patch was not reviewed in a timely manner. Since it's now quite old, I am removing it from the review request queue. Please consider rebasing it on trunk and resubmitting.

To increase the chances of getting a review, consider using 'Tools/Scripts/webkit-patch upload --suggest-reviewers' to CC reviewers who might be interested in this bug.