Changeset 206104 in webkit


Ignore:
Timestamp:
Sep 19, 2016 11:46:07 AM (8 years ago)
Author:
Yusuke Suzuki
Message:

[JSC] Use is_cell_with_type for @isRegExpObject, @isMap, and @isSet
https://bugs.webkit.org/show_bug.cgi?id=162142

Reviewed by Michael Saboff.

Use is_cell_with_type for @isRegExpObject, @isMap and @isSet.
Previously, they were implemented as functions and only @isRegExpObject was handled in the DFG and FTL.
The recently added op_is_cell_with_type bytecode and DFG IsCellWithType node allows us to simplify the above checks in all JIT tiers.
Changed these checks to bytecode intrinsics using op_is_cell_with_type.

  • builtins/BuiltinNames.h:
  • bytecode/BytecodeIntrinsicRegistry.h:
  • bytecode/SpeculatedType.cpp:

(JSC::speculationFromJSType):

  • bytecompiler/BytecodeGenerator.h:

(JSC::BytecodeGenerator::emitIsRegExpObject):
(JSC::BytecodeGenerator::emitIsMap):
(JSC::BytecodeGenerator::emitIsSet):
(JSC::BytecodeGenerator::emitIsProxyObject): Deleted.

  • bytecompiler/NodesCodegen.cpp:

(JSC::BytecodeIntrinsicNode::emit_intrinsic_isRegExpObject):
(JSC::BytecodeIntrinsicNode::emit_intrinsic_isMap):
(JSC::BytecodeIntrinsicNode::emit_intrinsic_isSet):

  • dfg/DFGByteCodeParser.cpp:

(JSC::DFG::ByteCodeParser::handleIntrinsicCall):

  • runtime/ECMAScriptSpecInternalFunctions.cpp:

(JSC::esSpecIsRegExpObject): Deleted.

  • runtime/ECMAScriptSpecInternalFunctions.h:
  • runtime/Intrinsic.h:
  • runtime/JSGlobalObject.cpp:

(JSC::JSGlobalObject::init):

  • runtime/MapPrototype.cpp:

(JSC::privateFuncIsMap): Deleted.

  • runtime/MapPrototype.h:
  • runtime/SetPrototype.cpp:

(JSC::privateFuncIsSet): Deleted.

  • runtime/SetPrototype.h:
Location:
trunk/Source/JavaScriptCore
Files:
15 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r206099 r206104  
     12016-09-19  Yusuke Suzuki  <utatane.tea@gmail.com>
     2
     3        [JSC] Use is_cell_with_type for @isRegExpObject, @isMap, and @isSet
     4        https://bugs.webkit.org/show_bug.cgi?id=162142
     5
     6        Reviewed by Michael Saboff.
     7
     8        Use is_cell_with_type for @isRegExpObject, @isMap and @isSet.
     9        Previously, they were implemented as functions and only @isRegExpObject was handled in the DFG and FTL.
     10        The recently added op_is_cell_with_type bytecode and DFG IsCellWithType node allows us to simplify the above checks in all JIT tiers.
     11        Changed these checks to bytecode intrinsics using op_is_cell_with_type.
     12
     13        * builtins/BuiltinNames.h:
     14        * bytecode/BytecodeIntrinsicRegistry.h:
     15        * bytecode/SpeculatedType.cpp:
     16        (JSC::speculationFromJSType):
     17        * bytecompiler/BytecodeGenerator.h:
     18        (JSC::BytecodeGenerator::emitIsRegExpObject):
     19        (JSC::BytecodeGenerator::emitIsMap):
     20        (JSC::BytecodeGenerator::emitIsSet):
     21        (JSC::BytecodeGenerator::emitIsProxyObject): Deleted.
     22        * bytecompiler/NodesCodegen.cpp:
     23        (JSC::BytecodeIntrinsicNode::emit_intrinsic_isRegExpObject):
     24        (JSC::BytecodeIntrinsicNode::emit_intrinsic_isMap):
     25        (JSC::BytecodeIntrinsicNode::emit_intrinsic_isSet):
     26        * dfg/DFGByteCodeParser.cpp:
     27        (JSC::DFG::ByteCodeParser::handleIntrinsicCall):
     28        * runtime/ECMAScriptSpecInternalFunctions.cpp:
     29        (JSC::esSpecIsRegExpObject): Deleted.
     30        * runtime/ECMAScriptSpecInternalFunctions.h:
     31        * runtime/Intrinsic.h:
     32        * runtime/JSGlobalObject.cpp:
     33        (JSC::JSGlobalObject::init):
     34        * runtime/MapPrototype.cpp:
     35        (JSC::privateFuncIsMap): Deleted.
     36        * runtime/MapPrototype.h:
     37        * runtime/SetPrototype.cpp:
     38        (JSC::privateFuncIsSet): Deleted.
     39        * runtime/SetPrototype.h:
     40
    1412016-09-19  Brian Burg  <bburg@apple.com>
    242
  • trunk/Source/JavaScriptCore/builtins/BuiltinNames.h

    r206065 r206104  
    131131    macro(isConstructor) \
    132132    macro(isDerivedConstructor) \
    133     macro(isRegExpObject) \
    134133    macro(concatMemcpy) \
    135134    macro(appendMemcpy) \
    136135    macro(predictFinalLengthFromArgumunts) \
    137136    macro(print) \
    138     macro(isSet) \
    139     macro(isMap) \
    140137    macro(regExpCreate) \
    141138    macro(SetIterator) \
  • trunk/Source/JavaScriptCore/bytecode/BytecodeIntrinsicRegistry.h

    r206065 r206104  
    4646    macro(isProxyObject) \
    4747    macro(isDerivedArray) \
     48    macro(isRegExpObject) \
     49    macro(isMap) \
     50    macro(isSet) \
    4851    macro(tailCallForwardArguments) \
    4952    macro(tryGetById) \
  • trunk/Source/JavaScriptCore/bytecode/SpeculatedType.cpp

    r206098 r206104  
    485485    case ProxyObjectType:
    486486        return SpecProxyObject;
     487    case JSMapType:
     488        return SpecMapObject;
     489    case JSSetType:
     490        return SpecSetObject;
    487491    default:
    488492        ASSERT_NOT_REACHED();
  • trunk/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.h

    r206098 r206104  
    634634        RegisterID* emitIsJSArray(RegisterID* dst, RegisterID* src) { return emitIsCellWithType(dst, src, ArrayType); }
    635635        RegisterID* emitIsProxyObject(RegisterID* dst, RegisterID* src) { return emitIsCellWithType(dst, src, ProxyObjectType); }
     636        RegisterID* emitIsRegExpObject(RegisterID* dst, RegisterID* src) { return emitIsCellWithType(dst, src, RegExpObjectType); }
     637        RegisterID* emitIsMap(RegisterID* dst, RegisterID* src) { return emitIsCellWithType(dst, src, JSMapType); }
     638        RegisterID* emitIsSet(RegisterID* dst, RegisterID* src) { return emitIsCellWithType(dst, src, JSSetType); }
    636639        RegisterID* emitIsObject(RegisterID* dst, RegisterID* src);
    637640        RegisterID* emitIsUndefined(RegisterID* dst, RegisterID* src);
  • trunk/Source/JavaScriptCore/bytecompiler/NodesCodegen.cpp

    r206082 r206104  
    954954}
    955955
    956 RegisterID* BytecodeIntrinsicNode::emit_intrinsic_isObject(BytecodeGenerator& generator, RegisterID* dst)
     956RegisterID* BytecodeIntrinsicNode::emit_intrinsic_isRegExpObject(JSC::BytecodeGenerator& generator, JSC::RegisterID* dst)
    957957{
    958958    ArgumentListNode* node = m_args->m_listNode;
     
    960960    ASSERT(!node->m_next);
    961961
    962     return generator.moveToDestinationIfNeeded(dst, generator.emitIsObject(generator.tempDestination(dst), src.get()));
    963 }
    964 
    965 RegisterID* BytecodeIntrinsicNode::emit_intrinsic_isDerivedArray(JSC::BytecodeGenerator& generator, JSC::RegisterID* dst)
     962    return generator.moveToDestinationIfNeeded(dst, generator.emitIsRegExpObject(generator.tempDestination(dst), src.get()));
     963}
     964
     965RegisterID* BytecodeIntrinsicNode::emit_intrinsic_isObject(BytecodeGenerator& generator, RegisterID* dst)
    966966{
    967967    ArgumentListNode* node = m_args->m_listNode;
     
    969969    ASSERT(!node->m_next);
    970970
     971    return generator.moveToDestinationIfNeeded(dst, generator.emitIsObject(generator.tempDestination(dst), src.get()));
     972}
     973
     974RegisterID* BytecodeIntrinsicNode::emit_intrinsic_isDerivedArray(JSC::BytecodeGenerator& generator, JSC::RegisterID* dst)
     975{
     976    ArgumentListNode* node = m_args->m_listNode;
     977    RefPtr<RegisterID> src = generator.emitNode(node);
     978    ASSERT(!node->m_next);
     979
    971980    return generator.moveToDestinationIfNeeded(dst, generator.emitIsDerivedArray(generator.tempDestination(dst), src.get()));
     981}
     982
     983RegisterID* BytecodeIntrinsicNode::emit_intrinsic_isMap(JSC::BytecodeGenerator& generator, JSC::RegisterID* dst)
     984{
     985    ArgumentListNode* node = m_args->m_listNode;
     986    RefPtr<RegisterID> src = generator.emitNode(node);
     987    ASSERT(!node->m_next);
     988
     989    return generator.moveToDestinationIfNeeded(dst, generator.emitIsMap(generator.tempDestination(dst), src.get()));
     990}
     991
     992RegisterID* BytecodeIntrinsicNode::emit_intrinsic_isSet(JSC::BytecodeGenerator& generator, JSC::RegisterID* dst)
     993{
     994    ArgumentListNode* node = m_args->m_listNode;
     995    RefPtr<RegisterID> src = generator.emitNode(node);
     996    ASSERT(!node->m_next);
     997
     998    return generator.moveToDestinationIfNeeded(dst, generator.emitIsSet(generator.tempDestination(dst), src.get()));
    972999}
    9731000
  • trunk/Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp

    r206098 r206104  
    23602360        set(VirtualRegister(resultOperand), regExpExec);
    23612361       
    2362         return true;
    2363     }
    2364 
    2365     case IsRegExpObjectIntrinsic: {
    2366         ASSERT(argumentCountIncludingThis == 2);
    2367 
    2368         insertChecks();
    2369         Node* isRegExpObject = addToGraph(IsCellWithType, OpInfo(RegExpObjectType), get(virtualRegisterForArgument(1, registerOffset)));
    2370         set(VirtualRegister(resultOperand), isRegExpObject);
    23712362        return true;
    23722363    }
  • trunk/Source/JavaScriptCore/runtime/ECMAScriptSpecInternalFunctions.cpp

    r205462 r206104  
    4040}
    4141
    42 EncodedJSValue JSC_HOST_CALL esSpecIsRegExpObject(ExecState* exec)
    43 {
    44     JSValue value = exec->uncheckedArgument(0);
    45     if (value.isObject())
    46         return JSValue::encode(jsBoolean(value.getObject()->type() == RegExpObjectType));
    47     return JSValue::encode(jsBoolean(false));
    48 }
    49 
    5042} // namespace JSC
  • trunk/Source/JavaScriptCore/runtime/ECMAScriptSpecInternalFunctions.h

    r199748 r206104  
    3232
    3333EncodedJSValue JSC_HOST_CALL esSpecIsConstructor(ExecState*);
    34 EncodedJSValue JSC_HOST_CALL esSpecIsRegExpObject(ExecState*);
    3534
    3635} // namespace JSC
  • trunk/Source/JavaScriptCore/runtime/Intrinsic.h

    r205828 r206104  
    6161    FRoundIntrinsic,
    6262    TruncIntrinsic,
    63     IsRegExpObjectIntrinsic,
    6463    IsTypedArrayViewIntrinsic,
    6564    BoundThisNoArgsFunctionCallIntrinsic,
  • trunk/Source/JavaScriptCore/runtime/JSGlobalObject.cpp

    r206065 r206104  
    747747
    748748        GlobalPropertyInfo(vm.propertyNames->builtinNames().repeatCharacterPrivateName(), JSFunction::create(vm, this, 2, String(), stringProtoFuncRepeatCharacter), DontEnum | DontDelete | ReadOnly),
    749         GlobalPropertyInfo(vm.propertyNames->builtinNames().isSetPrivateName(), JSFunction::create(vm, this, 1, String(), privateFuncIsSet), DontEnum | DontDelete | ReadOnly),
    750749        GlobalPropertyInfo(vm.propertyNames->builtinNames().SetIteratorPrivateName(), JSFunction::create(vm, this, 1, String(), privateFuncSetIterator), DontEnum | DontDelete | ReadOnly),
    751750        GlobalPropertyInfo(vm.propertyNames->builtinNames().setIteratorNextPrivateName(), JSFunction::create(vm, this, 0, String(), privateFuncSetIteratorNext), DontEnum | DontDelete | ReadOnly),
    752         GlobalPropertyInfo(vm.propertyNames->builtinNames().isMapPrivateName(), JSFunction::create(vm, this, 1, String(), privateFuncIsMap), DontEnum | DontDelete | ReadOnly),
    753751        GlobalPropertyInfo(vm.propertyNames->builtinNames().isArrayPrivateName(), arrayConstructor->getDirect(vm, vm.propertyNames->isArray), DontEnum | DontDelete | ReadOnly),
    754752        GlobalPropertyInfo(vm.propertyNames->builtinNames().isArraySlowPrivateName(), privateFuncIsArraySlow, DontEnum | DontDelete | ReadOnly),
     
    771769
    772770        GlobalPropertyInfo(vm.propertyNames->builtinNames().isConstructorPrivateName(), JSFunction::create(vm, this, 1, String(), esSpecIsConstructor, NoIntrinsic), DontEnum | DontDelete | ReadOnly),
    773         GlobalPropertyInfo(vm.propertyNames->builtinNames().isRegExpObjectPrivateName(), JSFunction::create(vm, this, 1, String(), esSpecIsRegExpObject, IsRegExpObjectIntrinsic), DontEnum | DontDelete | ReadOnly),
    774771
    775772        GlobalPropertyInfo(vm.propertyNames->builtinNames().regExpProtoFlagsGetterPrivateName(), regExpProtoFlagsGetterObject, DontEnum | DontDelete | ReadOnly),
  • trunk/Source/JavaScriptCore/runtime/MapPrototype.cpp

    r205654 r206104  
    101101}
    102102
    103 EncodedJSValue JSC_HOST_CALL privateFuncIsMap(ExecState* exec)
    104 {
    105     JSValue value = exec->uncheckedArgument(0);
    106     return JSValue::encode(jsBoolean(value.isCell() && value.asCell()->type() == JSMapType));
    107 }
    108 
    109103EncodedJSValue JSC_HOST_CALL mapProtoFuncClear(CallFrame* callFrame)
    110104{
  • trunk/Source/JavaScriptCore/runtime/MapPrototype.h

    r201448 r206104  
    5959};
    6060
    61 EncodedJSValue JSC_HOST_CALL privateFuncIsMap(ExecState*);
    6261EncodedJSValue JSC_HOST_CALL privateFuncMapIterator(ExecState*);
    6362EncodedJSValue JSC_HOST_CALL privateFuncMapIteratorNext(ExecState*);
  • trunk/Source/JavaScriptCore/runtime/SetPrototype.cpp

    r205654 r206104  
    160160}
    161161
    162 EncodedJSValue JSC_HOST_CALL privateFuncIsSet(ExecState* exec)
    163 {
    164     return JSValue::encode(jsBoolean(jsDynamicCast<JSSet*>(exec->uncheckedArgument(0))));
    165 }
    166 
    167162EncodedJSValue JSC_HOST_CALL privateFuncSetIterator(ExecState* exec)
    168163{
  • trunk/Source/JavaScriptCore/runtime/SetPrototype.h

    r201448 r206104  
    5959};
    6060
    61 EncodedJSValue JSC_HOST_CALL privateFuncIsSet(ExecState*);
    6261EncodedJSValue JSC_HOST_CALL privateFuncSetIterator(ExecState*);
    6362EncodedJSValue JSC_HOST_CALL privateFuncSetIteratorNext(ExecState*);
Note: See TracChangeset for help on using the changeset viewer.