Changeset 247194 in webkit


Ignore:
Timestamp:
Jul 6, 2019 6:34:51 AM (5 years ago)
Author:
msaboff@apple.com
Message:

switch(String) needs to check for exceptions when resolving the string
https://bugs.webkit.org/show_bug.cgi?id=199541

Reviewed by Mark Lam.

JSTests:

New tests.

  • stress/switch-string-oom.js: Added.

(test):
(testLowerTiers):
(testFTL):

Source/JavaScriptCore:

Added exception checks for resolved Strings in switch processing for all tiers.

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

(JSC::LLInt::LLINT_SLOW_PATH_DECL):

Location:
trunk
Files:
1 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/JSTests/ChangeLog

    r247183 r247194  
     12019-07-06  Michael Saboff  <msaboff@apple.com>
     2
     3        switch(String) needs to check for exceptions when resolving the string
     4        https://bugs.webkit.org/show_bug.cgi?id=199541
     5
     6        Reviewed by Mark Lam.
     7
     8        New tests.
     9
     10        * stress/switch-string-oom.js: Added.
     11        (test):
     12        (testLowerTiers):
     13        (testFTL):
     14
    1152019-07-05  Mark Lam  <mark.lam@apple.com>
    216
  • trunk/Source/JavaScriptCore/ChangeLog

    r247183 r247194  
     12019-07-06  Michael Saboff  <msaboff@apple.com>
     2
     3        switch(String) needs to check for exceptions when resolving the string
     4        https://bugs.webkit.org/show_bug.cgi?id=199541
     5
     6        Reviewed by Mark Lam.
     7
     8        Added exception checks for resolved Strings in switch processing for all tiers.
     9
     10        * dfg/DFGOperations.cpp:
     11        * jit/JITOperations.cpp:
     12        * llint/LLIntSlowPaths.cpp:
     13        (JSC::LLInt::LLINT_SLOW_PATH_DECL):
     14
    1152019-07-05  Mark Lam  <mark.lam@apple.com>
    216
  • trunk/Source/JavaScriptCore/dfg/DFGOperations.cpp

    r246490 r247194  
    24472447    VM& vm = exec->vm();
    24482448    NativeCallFrameTracer tracer(&vm, exec);
    2449 
    24502449    CodeBlock* codeBlock = exec->codeBlock();
    24512450    SimpleJumpTable& table = codeBlock->switchJumpTable(tableIndex);
     
    24632462    VM& vm = exec->vm();
    24642463    NativeCallFrameTracer tracer(&vm, exec);
    2465 
    2466     return exec->codeBlock()->stringSwitchJumpTable(tableIndex).ctiForValue(string->value(exec).impl()).executableAddress<char*>();
     2464    auto throwScope = DECLARE_THROW_SCOPE(vm);
     2465
     2466    StringImpl* strImpl = string->value(exec).impl();
     2467
     2468    RETURN_IF_EXCEPTION(throwScope, nullptr);
     2469
     2470    return exec->codeBlock()->stringSwitchJumpTable(tableIndex).ctiForValue(strImpl).executableAddress<char*>();
    24672471}
    24682472
     
    24712475    VM& vm = exec->vm();
    24722476    NativeCallFrameTracer tracer(&vm, exec);
    2473 
    2474     return exec->codeBlock()->stringSwitchJumpTable(tableIndex).offsetForValue(string->value(exec).impl(), std::numeric_limits<int32_t>::min());
     2477    auto throwScope = DECLARE_THROW_SCOPE(vm);
     2478
     2479    StringImpl* strImpl = string->value(exec).impl();
     2480
     2481    RETURN_IF_EXCEPTION(throwScope, 0);
     2482
     2483    return exec->codeBlock()->stringSwitchJumpTable(tableIndex).offsetForValue(strImpl, std::numeric_limits<int32_t>::min());
    24752484}
    24762485
  • trunk/Source/JavaScriptCore/jit/JITOperations.cpp

    r246490 r247194  
    23132313    JSValue key = JSValue::decode(encodedKey);
    23142314    CodeBlock* codeBlock = exec->codeBlock();
     2315    auto throwScope = DECLARE_THROW_SCOPE(vm);
    23152316
    23162317    void* result;
     
    23192320    if (key.isString()) {
    23202321        StringImpl* value = asString(key)->value(exec).impl();
     2322
     2323        RETURN_IF_EXCEPTION(throwScope, nullptr);
     2324
    23212325        result = jumpTable.ctiForValue(value).executableAddress();
    23222326    } else
  • trunk/Source/JavaScriptCore/llint/LLIntSlowPaths.cpp

    r246490 r247194  
    13181318        JUMP_TO(defaultOffset);
    13191319    else {
     1320        StringImpl* scrutineeStringImpl = asString(scrutinee)->value(exec).impl();
     1321
     1322        LLINT_CHECK_EXCEPTION();
     1323
    13201324        CodeBlock* codeBlock = exec->codeBlock();
    1321         JUMP_TO(codeBlock->stringSwitchJumpTable(bytecode.m_tableIndex).offsetForValue(asString(scrutinee)->value(exec).impl(), defaultOffset));
     1325
     1326        JUMP_TO(codeBlock->stringSwitchJumpTable(bytecode.m_tableIndex).offsetForValue(scrutineeStringImpl, defaultOffset));
    13221327    }
    13231328    LLINT_END();
Note: See TracChangeset for help on using the changeset viewer.