Changeset 213367 in webkit


Ignore:
Timestamp:
Mar 3, 2017, 9:48:42 AM (8 years ago)
Author:
mark.lam@apple.com
Message:

We should only check for traps that we're able to handle.
https://bugs.webkit.org/show_bug.cgi?id=169136

Reviewed by Michael Saboff.

The execute methods in interpreter were checking for the existence of any traps
(without masking) and only handling a subset of those via a mask. This can
result in a failed assertion on debug builds.

This patch fixes this by applying the same mask for both the needTrapHandling()
check and the handleTraps() call. Also added a few assertions.

  • interpreter/Interpreter.cpp:

(JSC::Interpreter::executeProgram):
(JSC::Interpreter::executeCall):
(JSC::Interpreter::executeConstruct):
(JSC::Interpreter::execute):

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

(JSC::LLInt::LLINT_SLOW_PATH_DECL):

Location:
trunk/Source/JavaScriptCore
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r213356 r213367  
     12017-03-03  Mark Lam  <mark.lam@apple.com>
     2
     3        We should only check for traps that we're able to handle.
     4        https://bugs.webkit.org/show_bug.cgi?id=169136
     5
     6        Reviewed by Michael Saboff.
     7
     8        The execute methods in interpreter were checking for the existence of any traps
     9        (without masking) and only handling a subset of those via a mask.  This can
     10        result in a failed assertion on debug builds.
     11
     12        This patch fixes this by applying the same mask for both the needTrapHandling()
     13        check and the handleTraps() call.  Also added a few assertions.
     14
     15        * interpreter/Interpreter.cpp:
     16        (JSC::Interpreter::executeProgram):
     17        (JSC::Interpreter::executeCall):
     18        (JSC::Interpreter::executeConstruct):
     19        (JSC::Interpreter::execute):
     20        * jit/JITOperations.cpp:
     21        * llint/LLIntSlowPaths.cpp:
     22        (JSC::LLInt::LLINT_SLOW_PATH_DECL):
     23
    1242017-03-02  Carlos Garcia Campos  <cgarcia@igalia.com>
    225
  • trunk/Source/JavaScriptCore/interpreter/Interpreter.cpp

    r213295 r213367  
    861861    }
    862862
    863     if (UNLIKELY(vm.needTrapHandling())) {
    864         VMTraps::Mask mask(VMTraps::NeedTermination, VMTraps::NeedWatchdogCheck);
     863    VMTraps::Mask mask(VMTraps::NeedTermination, VMTraps::NeedWatchdogCheck);
     864    if (UNLIKELY(vm.needTrapHandling(mask))) {
    865865        vm.handleTraps(callFrame, mask);
    866866        RETURN_IF_EXCEPTION(throwScope, throwScope.exception());
     
    922922        newCodeBlock = 0;
    923923
    924     if (UNLIKELY(vm.needTrapHandling())) {
    925         VMTraps::Mask mask(VMTraps::NeedTermination, VMTraps::NeedWatchdogCheck);
     924    VMTraps::Mask mask(VMTraps::NeedTermination, VMTraps::NeedWatchdogCheck);
     925    if (UNLIKELY(vm.needTrapHandling(mask))) {
    926926        vm.handleTraps(callFrame, mask);
    927927        RETURN_IF_EXCEPTION(throwScope, throwScope.exception());
     
    988988        newCodeBlock = 0;
    989989
    990     if (UNLIKELY(vm.needTrapHandling())) {
    991         VMTraps::Mask mask(VMTraps::NeedTermination, VMTraps::NeedWatchdogCheck);
     990    VMTraps::Mask mask(VMTraps::NeedTermination, VMTraps::NeedWatchdogCheck);
     991    if (UNLIKELY(vm.needTrapHandling(mask))) {
    992992        vm.handleTraps(callFrame, mask);
    993993        RETURN_IF_EXCEPTION(throwScope, throwScope.exception());
     
    10531053    StackStats::CheckPoint stackCheckPoint;
    10541054
    1055     if (UNLIKELY(vm.needTrapHandling())) {
    1056         VMTraps::Mask mask(VMTraps::NeedTermination, VMTraps::NeedWatchdogCheck);
     1055    VMTraps::Mask mask(VMTraps::NeedTermination, VMTraps::NeedWatchdogCheck);
     1056    if (UNLIKELY(vm.needTrapHandling(mask))) {
    10571057        vm.handleTraps(closure.oldCallFrame, mask);
    10581058        RETURN_IF_EXCEPTION(throwScope, throwScope.exception());
     
    11571157    }
    11581158
    1159     if (UNLIKELY(vm.needTrapHandling())) {
    1160         VMTraps::Mask mask(VMTraps::NeedTermination, VMTraps::NeedWatchdogCheck);
     1159    VMTraps::Mask mask(VMTraps::NeedTermination, VMTraps::NeedWatchdogCheck);
     1160    if (UNLIKELY(vm.needTrapHandling(mask))) {
    11611161        vm.handleTraps(callFrame, mask);
    11621162        RETURN_IF_EXCEPTION(throwScope, throwScope.exception());
     
    11991199    }
    12001200
    1201     if (UNLIKELY(vm.needTrapHandling())) {
    1202         VMTraps::Mask mask(VMTraps::NeedTermination, VMTraps::NeedWatchdogCheck);
     1201    VMTraps::Mask mask(VMTraps::NeedTermination, VMTraps::NeedWatchdogCheck);
     1202    if (UNLIKELY(vm.needTrapHandling(mask))) {
    12031203        vm.handleTraps(callFrame, mask);
    12041204        RETURN_IF_EXCEPTION(throwScope, throwScope.exception());
  • trunk/Source/JavaScriptCore/jit/JITOperations.cpp

    r213107 r213367  
    12131213    VM& vm = exec->vm();
    12141214    NativeCallFrameTracer tracer(&vm, exec);
     1215    ASSERT(vm.needTrapHandling());
    12151216    vm.handleTraps(exec);
    12161217    return nullptr;
  • trunk/Source/JavaScriptCore/llint/LLIntSlowPaths.cpp

    r213107 r213367  
    14981498{
    14991499    LLINT_BEGIN_NO_SET_PC();
     1500    ASSERT(vm.needTrapHandling());
    15001501    vm.handleTraps(exec);
    15011502    LLINT_RETURN_TWO(throwScope.exception(), exec);
Note: See TracChangeset for help on using the changeset viewer.