Ignore:
Timestamp:
Oct 22, 2019, 10:16:51 PM (6 years ago)
Author:
[email protected]
Message:

Make JSGlobalObject* threading change more stabilized by adding tests and assertions
https://bugs.webkit.org/show_bug.cgi?id=203274

Reviewed by Saam Barati.

Source/JavaScriptCore:

This patch does some follow-up changes after r251425.

  1. Add tests that tests vm.topCallFrame from C++ world to ensure that vm.topCallFrame is kept nullptr if it is accessed from C++ world even after executing some scripts.
  2. Add assertion to ensure that DECLARE_CALL_FRAME is only called in JIT operation's prologue.
  3. Remove some of ExecState::deprecatedVM call.
  4. Define USE(BUILTIN_FRAME_ADDRESS) when using builtin_frame_address to get CallFrame.
  • API/tests/testapi.cpp:

(TestAPI::topCallFrameAccess):
(testCAPIViaCpp):

  • interpreter/CallFrame.cpp:

(JSC::isFromJSCode):

  • interpreter/CallFrame.h:
  • jit/CCallHelpers.h:

(JSC::CCallHelpers::prepareCallOperation):

  • tools/VMInspector.cpp:

(JSC::VMInspector::dumpRegisters):

Source/WTF:

  • wtf/Platform.h:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/interpreter/CallFrame.h

    r251468 r251475  
    325325// Helper function to get VM& from JSGlobalObject* if JSGlobalObject.h is not included.
    326326VM& getVM(JSGlobalObject*);
    327 
    328 #if COMPILER(GCC_COMPATIBLE) && (CPU(ARM64) || CPU(X86_64)) && (OS(LINUX) || OS(DARWIN))
    329 #define DECLARE_CALL_FRAME(vm) (bitwise_cast<JSC::CallFrame*>(__builtin_frame_address(1)))
     327JS_EXPORT_PRIVATE bool isFromJSCode(void* returnAddress);
     328
     329#if USE(BUILTIN_FRAME_ADDRESS)
     330#define DECLARE_CALL_FRAME(vm) \
     331    ({ \
     332        ASSERT(JSC::isFromJSCode(removeCodePtrTag<void*>(__builtin_return_address(0)))); \
     333        bitwise_cast<JSC::CallFrame*>(__builtin_frame_address(1)); \
     334    })
    330335#else
    331336#define DECLARE_CALL_FRAME(vm) ((vm).topCallFrame)
Note: See TracChangeset for help on using the changeset viewer.