⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 211113 in webkit


Ignore:
Timestamp:
Jan 24, 2017, 3:24:35 PM (10 years ago)
Author:
fpizlo@apple.com
Message:

-0 is a valid array index and AtomicsObject should know this
https://bugs.webkit.org/show_bug.cgi?id=167386

Reviewed by Mark Lam.

JSTests:

  • stress/atomics-neg-zero.js: Added.

Source/JavaScriptCore:

  • runtime/AtomicsObject.cpp: The bug title really says it all.
Location:
trunk
Files:
1 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/JSTests/ChangeLog

    r211070 r211113  
     12017-01-24  Filip Pizlo  <fpizlo@apple.com>
     2
     3        -0 is a valid array index and AtomicsObject should know this
     4        https://bugs.webkit.org/show_bug.cgi?id=167386
     5
     6        Reviewed by Mark Lam.
     7
     8        * stress/atomics-neg-zero.js: Added.
     9
    1102017-01-23  Saam Barati  <sbarati@apple.com>
    211
  • trunk/Source/JavaScriptCore/ChangeLog

    r211112 r211113  
     12017-01-24  Filip Pizlo  <fpizlo@apple.com>
     2
     3        -0 is a valid array index and AtomicsObject should know this
     4        https://bugs.webkit.org/show_bug.cgi?id=167386
     5
     6        Reviewed by Mark Lam.
     7
     8        * runtime/AtomicsObject.cpp: The bug title really says it all.
     9
    1102017-01-24  Commit Queue  <commit-queue@webkit.org>
    211
  • trunk/Source/JavaScriptCore/runtime/AtomicsObject.cpp

    r208982 r211113  
    109109    JSValue accessIndexValue = exec->argument(1);
    110110    if (UNLIKELY(!accessIndexValue.isInt32())) {
    111         accessIndexValue = jsNumber(accessIndexValue.toNumber(exec));
     111        double accessIndexDouble = accessIndexValue.toNumber(exec);
    112112        RETURN_IF_EXCEPTION(scope, 0);
    113         if (!accessIndexValue.isInt32()) {
    114             throwRangeError(exec, scope, ASCIILiteral("Access index is not an integer."));
    115             return 0;
     113        if (accessIndexDouble == 0)
     114            accessIndexValue = jsNumber(0);
     115        else {
     116            accessIndexValue = jsNumber(accessIndexDouble);
     117            if (!accessIndexValue.isInt32()) {
     118                throwRangeError(exec, scope, ASCIILiteral("Access index is not an integer."));
     119                return 0;
     120            }
    116121        }
    117122    }
Note: See TracChangeset for help on using the changeset viewer.