Changeset 258824 in webkit


Ignore:
Timestamp:
Mar 22, 2020 5:40:46 PM (4 years ago)
Author:
ysuzuki@apple.com
Message:

[JSC] Add JSC::keepAlive(JSValue)
https://bugs.webkit.org/show_bug.cgi?id=209398

Reviewed by Mark Lam.

Add JSC::keepAlive(JSValue). This is useful to make some JSValue variable alive from GC.

  • heap/HeapCell.cpp:
  • runtime/JSCJSValue.cpp:

(JSC::keepAlive):

  • runtime/JSCJSValue.h:

(JSC::keepAlive):

Location:
trunk/Source/JavaScriptCore
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r258801 r258824  
     12020-03-22  Yusuke Suzuki  <ysuzuki@apple.com>
     2
     3        [JSC] Add JSC::keepAlive(JSValue)
     4        https://bugs.webkit.org/show_bug.cgi?id=209398
     5
     6        Reviewed by Mark Lam.
     7
     8        Add JSC::keepAlive(JSValue). This is useful to make some JSValue variable alive from GC.
     9
     10        * heap/HeapCell.cpp:
     11        * runtime/JSCJSValue.cpp:
     12        (JSC::keepAlive):
     13        * runtime/JSCJSValue.h:
     14        (JSC::keepAlive):
     15
    1162020-03-20  Ross Kirsling  <ross.kirsling@sony.com>
    217
  • trunk/Source/JavaScriptCore/heap/HeapCell.cpp

    r253074 r258824  
    4444
    4545#if !COMPILER(GCC_COMPATIBLE)
     46// This makes the argument opaque from the compiler.
    4647NEVER_INLINE void keepAlive(const void*)
    4748{
  • trunk/Source/JavaScriptCore/runtime/JSCJSValue.cpp

    r253648 r258824  
    428428}
    429429
     430#if !COMPILER(GCC_COMPATIBLE)
     431// This makes the argument opaque from the compiler.
     432NEVER_INLINE void keepAlive(JSValue)
     433{
     434}
     435#endif
     436
    430437} // namespace JSC
  • trunk/Source/JavaScriptCore/runtime/JSCJSValue.h

    r257399 r258824  
    638638bool sameValue(JSGlobalObject*, JSValue a, JSValue b);
    639639
     640#if COMPILER(GCC_COMPATIBLE)
     641ALWAYS_INLINE void keepAlive(JSValue value)
     642{
     643#if USE(JSVALUE64)
     644    asm volatile ("" : : "r"(bitwise_cast<uint64_t>(value)) : "memory");
     645#else
     646    asm volatile ("" : : "r"(value.payload()) : "memory");
     647#endif
     648}
     649#else
     650JS_EXPORT_PRIVATE void keepAlive(JSValue);
     651#endif
     652
    640653} // namespace JSC
Note: See TracChangeset for help on using the changeset viewer.