Changeset 254416 in webkit


Ignore:
Timestamp:
Jan 12, 2020 2:42:53 PM (4 years ago)
Author:
ysuzuki@apple.com
Message:

[WebCore] Reorganize JSType in WebCore to offer more bits to JSC
https://bugs.webkit.org/show_bug.cgi?id=206141

Reviewed by Keith Miller.

Source/JavaScriptCore:

  • runtime/JSType.h:

Source/WebCore:

This patch reorganize JSType a bit to offer more bits to JSC. Then JSC can use JSType for types easily.

  • bindings/js/JSDOMWrapper.h:
  • bindings/js/JSElementCustom.h:

(JSC::JSCastingHelpers::InheritsTraits<WebCore::JSElement>::inherits):

  • domjit/DOMJITHelpers.h:

(WebCore::DOMJIT::branchIfElement):
(WebCore::DOMJIT::branchIfNotElement):

Location:
trunk/Source
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r254396 r254416  
     12020-01-12  Yusuke Suzuki  <ysuzuki@apple.com>
     2
     3        [WebCore] Reorganize JSType in WebCore to offer more bits to JSC
     4        https://bugs.webkit.org/show_bug.cgi?id=206141
     5
     6        Reviewed by Keith Miller.
     7
     8        * runtime/JSType.h:
     9
    1102020-01-11  Yusuke Suzuki  <ysuzuki@apple.com>
    211
  • trunk/Source/JavaScriptCore/runtime/JSType.h

    r254252 r254416  
    138138
    139139static_assert(sizeof(JSType) == sizeof(uint8_t), "sizeof(JSType) is one byte.");
    140 static_assert(LastJSCObjectType < 128, "The highest bit is reserved for embedder's extension.");
     140static_assert(LastJSCObjectType < 0b11100000, "Embedder can use 0b11100000 or upper.");
    141141
    142142inline constexpr bool isTypedArrayType(JSType type)
  • trunk/Source/WebCore/ChangeLog

    r254414 r254416  
     12020-01-12  Yusuke Suzuki  <ysuzuki@apple.com>
     2
     3        [WebCore] Reorganize JSType in WebCore to offer more bits to JSC
     4        https://bugs.webkit.org/show_bug.cgi?id=206141
     5
     6        Reviewed by Keith Miller.
     7
     8        This patch reorganize JSType a bit to offer more bits to JSC. Then JSC can use JSType for types easily.
     9
     10        * bindings/js/JSDOMWrapper.h:
     11        * bindings/js/JSElementCustom.h:
     12        (JSC::JSCastingHelpers::InheritsTraits<WebCore::JSElement>::inherits):
     13        * domjit/DOMJITHelpers.h:
     14        (WebCore::DOMJIT::branchIfElement):
     15        (WebCore::DOMJIT::branchIfNotElement):
     16
    1172019-12-20  Darin Adler  <darin@apple.com>
    218
  • trunk/Source/WebCore/bindings/js/JSDOMWrapper.h

    r253443 r254416  
    3030class ScriptExecutionContext;
    3131
    32 // JSC allows us to extend JSType. If the highest bit is set, we can add any Object types and they are
     32// JSC allows us to extend JSType. If the highest 3 bits are set, we can add any Object types and they are
    3333// recognized as OtherObj in JSC. And we encode Node type into JSType if the given JSType is subclass of Node.
    34 // offset | 7 | 6 | 5   4 | 3   2   1   0  |
    35 // value  | 1 | 0 |  Non-node DOM types    |
     34// offset | 7 | 6 | 5 | 4  3   2   1   0  |
     35// value  | 1 | 1 | 1 | Non-node DOM types |
    3636// If the given JSType is a subclass of Node, the format is the following.
    37 // offset | 7 | 6 | 5   4 | 3   2   1   0  |
    38 // value  | 1 | 1 |  Kind |       NodeType |
     37// offset | 7 | 6 | 5 | 4 | 3   2   1   0  |
     38// value  | 1 | 1 | 1 | 1 |    NodeType    |
     39
     40static const uint8_t JSDOMWrapperType                = 0b11101110;
     41static const uint8_t JSEventType                     = 0b11101111;
     42static const uint8_t JSNodeType                      = 0b11110000;
    3943static const uint8_t JSNodeTypeMask                  = 0b00001111;
    40 
    41 static const uint8_t JSDOMWrapperType                = 0b10000000;
    42 static const uint8_t JSEventType                     = 0b10000001;
    43 static const uint8_t JSNodeType                      = 0b11000000;
    4444static const uint8_t JSTextNodeType                  = JSNodeType | NodeConstants::TEXT_NODE;
    4545static const uint8_t JSProcessingInstructionNodeType = JSNodeType | NodeConstants::PROCESSING_INSTRUCTION_NODE;
     
    5050static const uint8_t JSCDATASectionNodeType          = JSNodeType | NodeConstants::CDATA_SECTION_NODE;
    5151static const uint8_t JSAttrNodeType                  = JSNodeType | NodeConstants::ATTRIBUTE_NODE;
    52 static const uint8_t JSElementType                   = 0b11010000 | NodeConstants::ELEMENT_NODE;
     52static const uint8_t JSElementType                   = 0b11110000 | NodeConstants::ELEMENT_NODE;
    5353
    5454static_assert(JSDOMWrapperType > JSC::LastJSCObjectType, "JSC::JSType offers the highest bit.");
  • trunk/Source/WebCore/bindings/js/JSElementCustom.h

    r229416 r254416  
    3838    static inline bool inherits(VM&, From* from)
    3939    {
    40         return from->type() >= WebCore::JSElementType;
     40        return from->type() == WebCore::JSElementType;
    4141    }
    4242};
  • trunk/Source/WebCore/domjit/DOMJITHelpers.h

    r251518 r254416  
    142142{
    143143    return jit.branch8(
    144         CCallHelpers::AboveOrEqual,
     144        CCallHelpers::Equal,
    145145        CCallHelpers::Address(target, JSC::JSCell::typeInfoTypeOffset()),
    146146        CCallHelpers::TrustedImm32(JSC::JSType(JSElementType)));
     
    150150{
    151151    return jit.branch8(
    152         CCallHelpers::Below,
     152        CCallHelpers::NotEqual,
    153153        CCallHelpers::Address(target, JSC::JSCell::typeInfoTypeOffset()),
    154154        CCallHelpers::TrustedImm32(JSC::JSType(JSElementType)));
Note: See TracChangeset for help on using the changeset viewer.