Changeset 242500 in webkit


Ignore:
Timestamp:
Mar 5, 2019 1:20:33 PM (5 years ago)
Author:
ysuzuki@apple.com
Message:

[JSC] Should check exception for JSString::toExistingAtomicString
https://bugs.webkit.org/show_bug.cgi?id=195337

Reviewed by Keith Miller, Saam Barati, and Mark Lam.

We missed the exception check for JSString::toExistingAtomicString while it can resolve
a rope and throw an OOM exception. This patch adds necessary exception checks. This patch
fixes test failures in debug build, reported in https://bugs.webkit.org/show_bug.cgi?id=194375#c93.

  • dfg/DFGOperations.cpp:
  • jit/JITOperations.cpp:

(JSC::getByVal):

  • llint/LLIntSlowPaths.cpp:

(JSC::LLInt::getByVal):

  • runtime/CommonSlowPaths.cpp:

(JSC::SLOW_PATH_DECL):

Location:
trunk/Source/JavaScriptCore
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r242399 r242500  
     12019-03-05  Yusuke Suzuki  <ysuzuki@apple.com>
     2
     3        [JSC] Should check exception for JSString::toExistingAtomicString
     4        https://bugs.webkit.org/show_bug.cgi?id=195337
     5
     6        Reviewed by Keith Miller, Saam Barati, and Mark Lam.
     7
     8        We missed the exception check for JSString::toExistingAtomicString while it can resolve
     9        a rope and throw an OOM exception. This patch adds necessary exception checks. This patch
     10        fixes test failures in debug build, reported in https://bugs.webkit.org/show_bug.cgi?id=194375#c93.
     11
     12        * dfg/DFGOperations.cpp:
     13        * jit/JITOperations.cpp:
     14        (JSC::getByVal):
     15        * llint/LLIntSlowPaths.cpp:
     16        (JSC::LLInt::getByVal):
     17        * runtime/CommonSlowPaths.cpp:
     18        (JSC::SLOW_PATH_DECL):
     19
    1202019-03-04  Yusuke Suzuki  <ysuzuki@apple.com>
    221
  • trunk/Source/JavaScriptCore/dfg/DFGOperations.cpp

    r242252 r242500  
    690690            Structure& structure = *base->structure(vm);
    691691            if (JSCell::canUseFastGetOwnProperty(structure)) {
    692                 if (RefPtr<AtomicStringImpl> existingAtomicString = asString(property)->toExistingAtomicString(exec)) {
     692                RefPtr<AtomicStringImpl> existingAtomicString = asString(property)->toExistingAtomicString(exec);
     693                RETURN_IF_EXCEPTION(scope, encodedJSValue());
     694                if (existingAtomicString) {
    693695                    if (JSValue result = base->fastGetOwnProperty(vm, structure, existingAtomicString.get()))
    694696                        return JSValue::encode(result);
     
    725727        Structure& structure = *base->structure(vm);
    726728        if (JSCell::canUseFastGetOwnProperty(structure)) {
    727             if (RefPtr<AtomicStringImpl> existingAtomicString = asString(property)->toExistingAtomicString(exec)) {
     729            RefPtr<AtomicStringImpl> existingAtomicString = asString(property)->toExistingAtomicString(exec);
     730            RETURN_IF_EXCEPTION(scope, encodedJSValue());
     731            if (existingAtomicString) {
    728732                if (JSValue result = base->fastGetOwnProperty(vm, structure, existingAtomicString.get()))
    729733                    return JSValue::encode(result);
     
    14461450        Structure& structure = *baseValue.asCell()->structure(vm);
    14471451        if (JSCell::canUseFastGetOwnProperty(structure)) {
    1448             if (RefPtr<AtomicStringImpl> existingAtomicString = asString(subscript)->toExistingAtomicString(exec)) {
     1452            RefPtr<AtomicStringImpl> existingAtomicString = asString(subscript)->toExistingAtomicString(exec);
     1453            RETURN_IF_EXCEPTION(scope, encodedJSValue());
     1454            if (existingAtomicString) {
    14491455                if (JSValue result = baseValue.asCell()->fastGetOwnProperty(vm, structure, existingAtomicString.get()))
    14501456                    return JSValue::encode(result);
  • trunk/Source/JavaScriptCore/jit/JITOperations.cpp

    r242192 r242500  
    18071807        Structure& structure = *baseValue.asCell()->structure(vm);
    18081808        if (JSCell::canUseFastGetOwnProperty(structure)) {
    1809             if (RefPtr<AtomicStringImpl> existingAtomicString = asString(subscript)->toExistingAtomicString(exec)) {
     1809            RefPtr<AtomicStringImpl> existingAtomicString = asString(subscript)->toExistingAtomicString(exec);
     1810            RETURN_IF_EXCEPTION(scope, JSValue());
     1811            if (existingAtomicString) {
    18101812                if (JSValue result = baseValue.asCell()->fastGetOwnProperty(vm, structure, existingAtomicString.get())) {
    18111813                    ASSERT(exec->bytecodeOffset());
  • trunk/Source/JavaScriptCore/llint/LLIntSlowPaths.cpp

    r241582 r242500  
    943943        Structure& structure = *baseValue.asCell()->structure(vm);
    944944        if (JSCell::canUseFastGetOwnProperty(structure)) {
    945             if (RefPtr<AtomicStringImpl> existingAtomicString = asString(subscript)->toExistingAtomicString(exec)) {
     945            RefPtr<AtomicStringImpl> existingAtomicString = asString(subscript)->toExistingAtomicString(exec);
     946            RETURN_IF_EXCEPTION(scope, JSValue());
     947            if (existingAtomicString) {
    946948                if (JSValue result = baseValue.asCell()->fastGetOwnProperty(vm, structure, existingAtomicString.get()))
    947949                    return result;
  • trunk/Source/JavaScriptCore/runtime/CommonSlowPaths.cpp

    r241493 r242500  
    11261126        Structure& structure = *baseValue.asCell()->structure(vm);
    11271127        if (JSCell::canUseFastGetOwnProperty(structure)) {
    1128             if (RefPtr<AtomicStringImpl> existingAtomicString = asString(subscript)->toExistingAtomicString(exec)) {
     1128            RefPtr<AtomicStringImpl> existingAtomicString = asString(subscript)->toExistingAtomicString(exec);
     1129            CHECK_EXCEPTION();
     1130            if (existingAtomicString) {
    11291131                if (JSValue result = baseValue.asCell()->fastGetOwnProperty(vm, structure, existingAtomicString.get()))
    11301132                    RETURN_PROFILED(result);
Note: See TracChangeset for help on using the changeset viewer.