Ignore:
Timestamp:
Mar 3, 2017, 9:48:42 AM (8 years ago)
Author:
[email protected]
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):

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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());
Note: See TracChangeset for help on using the changeset viewer.