Ignore:
Timestamp:
Jan 28, 2019, 8:33:33 PM (6 years ago)
Author:
[email protected]
Message:

[JSC] Reduce size of memory used for ShadowChicken
https://bugs.webkit.org/show_bug.cgi?id=193546

Reviewed by Mark Lam.

This patch lazily instantiate ShadowChicken. We do not need this until we start logging ShadowChicken packets.
The removal of ShadowChicken saves 55KB memory.

  • debugger/DebuggerCallFrame.cpp:

(JSC::DebuggerCallFrame::create):

  • ftl/FTLLowerDFGToB3.cpp:

(JSC::FTL::DFG::LowerDFGToB3::ensureShadowChickenPacket):

  • heap/Heap.cpp:

(JSC::Heap::stopThePeriphery):
(JSC::Heap::addCoreConstraints):

  • jit/CCallHelpers.cpp:

(JSC::CCallHelpers::ensureShadowChickenPacket):

  • jit/JITExceptions.cpp:

(JSC::genericUnwind):

  • jit/JITOpcodes.cpp:

(JSC::JIT::emit_op_log_shadow_chicken_prologue):
(JSC::JIT::emit_op_log_shadow_chicken_tail):

  • jit/JITOpcodes32_64.cpp:

(JSC::JIT::emit_op_log_shadow_chicken_prologue):
(JSC::JIT::emit_op_log_shadow_chicken_tail):

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

(JSC::LLInt::LLINT_SLOW_PATH_DECL):

  • runtime/JSGlobalObject.cpp:

(JSC::JSGlobalObject::setDebugger):

  • runtime/JSGlobalObject.h:

(JSC::JSGlobalObject::setDebugger): Deleted.

  • runtime/VM.cpp:

(JSC::VM::VM):
(JSC::VM::ensureShadowChicken):

  • runtime/VM.h:

(JSC::VM::shadowChicken):

  • tools/JSDollarVM.cpp:

(JSC::functionShadowChickenFunctionsOnStack):
(JSC::changeDebuggerModeWhenIdle):

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/tools/JSDollarVM.cpp

    r239427 r240637  
    19331933{
    19341934    VM& vm = exec->vm();
    1935     return JSValue::encode(vm.shadowChicken().functionsOnStack(exec));
     1935    auto scope = DECLARE_THROW_SCOPE(vm);
     1936    if (auto* shadowChicken = vm.shadowChicken())
     1937        return JSValue::encode(shadowChicken->functionsOnStack(exec));
     1938
     1939    JSArray* result = constructEmptyArray(exec, 0);
     1940    RETURN_IF_EXCEPTION(scope, { });
     1941    StackVisitor::visit(exec, &vm, [&] (StackVisitor& visitor) -> StackVisitor::Status {
     1942        if (visitor->isInlinedFrame())
     1943            return StackVisitor::Continue;
     1944        if (visitor->isWasmFrame())
     1945            return StackVisitor::Continue;
     1946        result->push(exec, jsCast<JSObject*>(visitor->callee().asCell()));
     1947        scope.releaseAssertNoException(); // This function is only called from tests.
     1948        return StackVisitor::Continue;
     1949    });
     1950    return JSValue::encode(result);
    19361951}
    19371952
     
    20482063        Options::forceDebuggerBytecodeGeneration() = newDebuggerMode;
    20492064        vm->deleteAllCode(PreventCollectionAndDeleteAllCode);
     2065        if (mode == DebuggerMode::DebuggerOn)
     2066            vm->ensureShadowChicken();
    20502067    });
    20512068    return JSValue::encode(jsUndefined());
Note: See TracChangeset for help on using the changeset viewer.