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

Changeset 244057 in webkit


Ignore:
Timestamp:
Apr 8, 2019, 4:33:05 PM (7 years ago)
Author:
ysuzuki@apple.com
Message:

[JSC] to_index_string should not assume incoming value is Uint32
https://bugs.webkit.org/show_bug.cgi?id=196713

Reviewed by Saam Barati.

JSTests:

  • stress/to-index-string-should-not-assume-incoming-value-is-uint32.js: Added.

(foo):

Source/JavaScriptCore:

The slow path of to_index_string assumes that incoming value is Uint32. But we should not have
this assumption since DFG may decide we should have it double format. This patch removes this
assumption, and instead, we should assume that incoming value is AnyInt and the range of this
is within Uint32.

  • runtime/CommonSlowPaths.cpp:

(JSC::SLOW_PATH_DECL):

Location:
trunk
Files:
1 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/JSTests/ChangeLog

    r244049 r244057  
     12019-04-08  Yusuke Suzuki  <ysuzuki@apple.com>
     2
     3        [JSC] to_index_string should not assume incoming value is Uint32
     4        https://bugs.webkit.org/show_bug.cgi?id=196713
     5
     6        Reviewed by Saam Barati.
     7
     8        * stress/to-index-string-should-not-assume-incoming-value-is-uint32.js: Added.
     9        (foo):
     10
    1112019-04-08  Yusuke Suzuki  <ysuzuki@apple.com>
    212
  • trunk/Source/JavaScriptCore/ChangeLog

    r244050 r244057  
     12019-04-08  Yusuke Suzuki  <ysuzuki@apple.com>
     2
     3        [JSC] to_index_string should not assume incoming value is Uint32
     4        https://bugs.webkit.org/show_bug.cgi?id=196713
     5
     6        Reviewed by Saam Barati.
     7
     8        The slow path of to_index_string assumes that incoming value is Uint32. But we should not have
     9        this assumption since DFG may decide we should have it double format. This patch removes this
     10        assumption, and instead, we should assume that incoming value is AnyInt and the range of this
     11        is within Uint32.
     12
     13        * runtime/CommonSlowPaths.cpp:
     14        (JSC::SLOW_PATH_DECL):
     15
    1162019-04-08  Justin Fan  <justin_fan@apple.com>
    217
  • trunk/Source/JavaScriptCore/runtime/CommonSlowPaths.cpp

    r243280 r244057  
    996996    BEGIN();
    997997    auto bytecode = pc->as<OpToIndexString>();
    998     RETURN(jsString(exec, Identifier::from(exec, GET(bytecode.m_index).jsValue().asUInt32()).string()));
     998    JSValue indexValue = GET(bytecode.m_index).jsValue();
     999    ASSERT(indexValue.isAnyInt());
     1000    ASSERT(indexValue.asAnyInt() <= UINT32_MAX);
     1001    ASSERT(indexValue.asAnyInt() >= 0);
     1002    uint32_t index = static_cast<uint32_t>(indexValue.asAnyInt());
     1003    RETURN(jsString(exec, Identifier::from(exec, index).string()));
    9991004}
    10001005
Note: See TracChangeset for help on using the changeset viewer.