Changeset 68348 in webkit


Ignore:
Timestamp:
Sep 26, 2010 2:38:31 PM (14 years ago)
Author:
commit-queue@webkit.org
Message:

2010-09-26 Mark Hahnenberg <mhahnenb@gmail.com>

Reviewed by Oliver Hunt.

valueOf called in wrong order in atan2 and date constructors.
https://bugs.webkit.org/show_bug.cgi?id=26978

Fixed the bug where the arguments to atan2 were being evaluated
out of order.

  • runtime/MathObject.cpp: (JSC::mathProtoFuncATan2):

2010-09-26 Mark Hahnenberg <mhahnenb@gmail.com>

Reviewed by Oliver Hunt.

valueOf called in wrong order in atan2 and date constructors.
https://bugs.webkit.org/show_bug.cgi?id=26978

Regression test for the issue where the arguments to atan2 were
evaluated out of order.

  • fast/js/math-expected.txt:
  • fast/js/script-tests/math.js: (v.valueOf): (w.valueOf):
Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/ChangeLog

    r68347 r68348  
     12010-09-26  Mark Hahnenberg  <mhahnenb@gmail.com>
     2
     3        Reviewed by Oliver Hunt.
     4
     5        valueOf called in wrong order in atan2 and date constructors.
     6        https://bugs.webkit.org/show_bug.cgi?id=26978
     7
     8        Fixed the bug where the arguments to atan2 were being evaluated
     9        out of order.
     10
     11        * runtime/MathObject.cpp:
     12        (JSC::mathProtoFuncATan2):
     13
    1142010-09-26  Mark Hahnenberg  <mhahnenb@gmail.com>
    215
  • trunk/JavaScriptCore/runtime/MathObject.cpp

    r65947 r68348  
    136136EncodedJSValue JSC_HOST_CALL mathProtoFuncATan2(ExecState* exec)
    137137{
    138     return JSValue::encode(jsDoubleNumber(exec, atan2(exec->argument(0).toNumber(exec), exec->argument(1).toNumber(exec))));
     138    double arg0 = exec->argument(0).toNumber(exec);
     139    double arg1 = exec->argument(1).toNumber(exec);
     140    return JSValue::encode(jsDoubleNumber(exec, atan2(arg0, arg1)));
    139141}
    140142
  • trunk/LayoutTests/ChangeLog

    r68347 r68348  
     12010-09-26  Mark Hahnenberg  <mhahnenb@gmail.com>
     2
     3        Reviewed by Oliver Hunt.
     4
     5        valueOf called in wrong order in atan2 and date constructors.
     6        https://bugs.webkit.org/show_bug.cgi?id=26978
     7
     8        Regression test for the issue where the arguments to atan2 were
     9        evaluated out of order.
     10
     11        * fast/js/math-expected.txt:
     12        * fast/js/script-tests/math.js:
     13        (v.valueOf):
     14        (w.valueOf):
     15
    1162010-09-26  Mark Hahnenberg  <mhahnenb@gmail.com>
    217
  • trunk/LayoutTests/fast/js/math-expected.txt

    r54198 r68348  
    4545PASS Math.atan2(Infinity, NaN) is NaN
    4646PASS Math.atan2(-Infinity, NaN) is NaN
     47PASS testStr is "onetwo"
    4748PASS Math.ceil(NaN) is NaN
    4849PASS Math.ceil(0) is 0
  • trunk/LayoutTests/fast/js/script-tests/math.js

    r54198 r68348  
    5050shouldBe("Math.atan2(Infinity, NaN)", "NaN");
    5151shouldBe("Math.atan2(-Infinity, NaN)", "NaN");
     52
     53// Regression test for Bug 26978 (https://bugs.webkit.org/show_bug.cgi?id=26978)
     54var testStr = "";
     55var v = { valueOf: function() { testStr += "one"; return 1; } };
     56var w = { valueOf: function() { testStr += "two"; return 2; } };
     57Math.atan2(v, w);
     58shouldBe('testStr', '\"onetwo\"');
    5259
    5360/*
Note: See TracChangeset for help on using the changeset viewer.