Title: [206104] trunk/Source/_javascript_Core
Revision
206104
Author
utatane....@gmail.com
Date
2016-09-19 11:46:07 -0700 (Mon, 19 Sep 2016)

Log 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:

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (206103 => 206104)


--- trunk/Source/_javascript_Core/ChangeLog	2016-09-19 18:38:15 UTC (rev 206103)
+++ trunk/Source/_javascript_Core/ChangeLog	2016-09-19 18:46:07 UTC (rev 206104)
@@ -1,3 +1,43 @@
+2016-09-19  Yusuke Suzuki  <utatane....@gmail.com>
+
+        [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:
+
 2016-09-19  Brian Burg  <bb...@apple.com>
 
         Web Replay: teach the replay inputs generator to encode and decode OptionSet<T>

Modified: trunk/Source/_javascript_Core/builtins/BuiltinNames.h (206103 => 206104)


--- trunk/Source/_javascript_Core/builtins/BuiltinNames.h	2016-09-19 18:38:15 UTC (rev 206103)
+++ trunk/Source/_javascript_Core/builtins/BuiltinNames.h	2016-09-19 18:46:07 UTC (rev 206104)
@@ -130,13 +130,10 @@
     macro(isArrayConstructor) \
     macro(isConstructor) \
     macro(isDerivedConstructor) \
-    macro(isRegExpObject) \
     macro(concatMemcpy) \
     macro(appendMemcpy) \
     macro(predictFinalLengthFromArgumunts) \
     macro(print) \
-    macro(isSet) \
-    macro(isMap) \
     macro(regExpCreate) \
     macro(SetIterator) \
     macro(setIteratorNext) \

Modified: trunk/Source/_javascript_Core/bytecode/BytecodeIntrinsicRegistry.h (206103 => 206104)


--- trunk/Source/_javascript_Core/bytecode/BytecodeIntrinsicRegistry.h	2016-09-19 18:38:15 UTC (rev 206103)
+++ trunk/Source/_javascript_Core/bytecode/BytecodeIntrinsicRegistry.h	2016-09-19 18:46:07 UTC (rev 206104)
@@ -45,6 +45,9 @@
     macro(isJSArray) \
     macro(isProxyObject) \
     macro(isDerivedArray) \
+    macro(isRegExpObject) \
+    macro(isMap) \
+    macro(isSet) \
     macro(tailCallForwardArguments) \
     macro(tryGetById) \
     macro(putByValDirect) \

Modified: trunk/Source/_javascript_Core/bytecode/SpeculatedType.cpp (206103 => 206104)


--- trunk/Source/_javascript_Core/bytecode/SpeculatedType.cpp	2016-09-19 18:38:15 UTC (rev 206103)
+++ trunk/Source/_javascript_Core/bytecode/SpeculatedType.cpp	2016-09-19 18:46:07 UTC (rev 206104)
@@ -484,6 +484,10 @@
         return SpecRegExpObject;
     case ProxyObjectType:
         return SpecProxyObject;
+    case JSMapType:
+        return SpecMapObject;
+    case JSSetType:
+        return SpecSetObject;
     default:
         ASSERT_NOT_REACHED();
     }

Modified: trunk/Source/_javascript_Core/bytecompiler/BytecodeGenerator.h (206103 => 206104)


--- trunk/Source/_javascript_Core/bytecompiler/BytecodeGenerator.h	2016-09-19 18:38:15 UTC (rev 206103)
+++ trunk/Source/_javascript_Core/bytecompiler/BytecodeGenerator.h	2016-09-19 18:46:07 UTC (rev 206104)
@@ -633,6 +633,9 @@
         RegisterID* emitIsCellWithType(RegisterID* dst, RegisterID* src, JSType);
         RegisterID* emitIsJSArray(RegisterID* dst, RegisterID* src) { return emitIsCellWithType(dst, src, ArrayType); }
         RegisterID* emitIsProxyObject(RegisterID* dst, RegisterID* src) { return emitIsCellWithType(dst, src, ProxyObjectType); }
+        RegisterID* emitIsRegExpObject(RegisterID* dst, RegisterID* src) { return emitIsCellWithType(dst, src, RegExpObjectType); }
+        RegisterID* emitIsMap(RegisterID* dst, RegisterID* src) { return emitIsCellWithType(dst, src, JSMapType); }
+        RegisterID* emitIsSet(RegisterID* dst, RegisterID* src) { return emitIsCellWithType(dst, src, JSSetType); }
         RegisterID* emitIsObject(RegisterID* dst, RegisterID* src);
         RegisterID* emitIsUndefined(RegisterID* dst, RegisterID* src);
         RegisterID* emitIsEmpty(RegisterID* dst, RegisterID* src);

Modified: trunk/Source/_javascript_Core/bytecompiler/NodesCodegen.cpp (206103 => 206104)


--- trunk/Source/_javascript_Core/bytecompiler/NodesCodegen.cpp	2016-09-19 18:38:15 UTC (rev 206103)
+++ trunk/Source/_javascript_Core/bytecompiler/NodesCodegen.cpp	2016-09-19 18:46:07 UTC (rev 206104)
@@ -953,6 +953,15 @@
     return generator.moveToDestinationIfNeeded(dst, generator.emitIsProxyObject(generator.tempDestination(dst), src.get()));
 }
 
+RegisterID* BytecodeIntrinsicNode::emit_intrinsic_isRegExpObject(JSC::BytecodeGenerator& generator, JSC::RegisterID* dst)
+{
+    ArgumentListNode* node = m_args->m_listNode;
+    RefPtr<RegisterID> src = ""
+    ASSERT(!node->m_next);
+
+    return generator.moveToDestinationIfNeeded(dst, generator.emitIsRegExpObject(generator.tempDestination(dst), src.get()));
+}
+
 RegisterID* BytecodeIntrinsicNode::emit_intrinsic_isObject(BytecodeGenerator& generator, RegisterID* dst)
 {
     ArgumentListNode* node = m_args->m_listNode;
@@ -971,6 +980,24 @@
     return generator.moveToDestinationIfNeeded(dst, generator.emitIsDerivedArray(generator.tempDestination(dst), src.get()));
 }
 
+RegisterID* BytecodeIntrinsicNode::emit_intrinsic_isMap(JSC::BytecodeGenerator& generator, JSC::RegisterID* dst)
+{
+    ArgumentListNode* node = m_args->m_listNode;
+    RefPtr<RegisterID> src = ""
+    ASSERT(!node->m_next);
+
+    return generator.moveToDestinationIfNeeded(dst, generator.emitIsMap(generator.tempDestination(dst), src.get()));
+}
+
+RegisterID* BytecodeIntrinsicNode::emit_intrinsic_isSet(JSC::BytecodeGenerator& generator, JSC::RegisterID* dst)
+{
+    ArgumentListNode* node = m_args->m_listNode;
+    RefPtr<RegisterID> src = ""
+    ASSERT(!node->m_next);
+
+    return generator.moveToDestinationIfNeeded(dst, generator.emitIsSet(generator.tempDestination(dst), src.get()));
+}
+
 RegisterID* BytecodeIntrinsicNode::emit_intrinsic_newArrayWithSize(JSC::BytecodeGenerator& generator, JSC::RegisterID* dst)
 {
     ArgumentListNode* node = m_args->m_listNode;

Modified: trunk/Source/_javascript_Core/dfg/DFGByteCodeParser.cpp (206103 => 206104)


--- trunk/Source/_javascript_Core/dfg/DFGByteCodeParser.cpp	2016-09-19 18:38:15 UTC (rev 206103)
+++ trunk/Source/_javascript_Core/dfg/DFGByteCodeParser.cpp	2016-09-19 18:46:07 UTC (rev 206104)
@@ -2362,15 +2362,6 @@
         return true;
     }
 
-    case IsRegExpObjectIntrinsic: {
-        ASSERT(argumentCountIncludingThis == 2);
-
-        insertChecks();
-        Node* isRegExpObject = addToGraph(IsCellWithType, OpInfo(RegExpObjectType), get(virtualRegisterForArgument(1, registerOffset)));
-        set(VirtualRegister(resultOperand), isRegExpObject);
-        return true;
-    }
-
     case IsTypedArrayViewIntrinsic: {
         ASSERT(argumentCountIncludingThis == 2);
 

Modified: trunk/Source/_javascript_Core/runtime/ECMAScriptSpecInternalFunctions.cpp (206103 => 206104)


--- trunk/Source/_javascript_Core/runtime/ECMAScriptSpecInternalFunctions.cpp	2016-09-19 18:38:15 UTC (rev 206103)
+++ trunk/Source/_javascript_Core/runtime/ECMAScriptSpecInternalFunctions.cpp	2016-09-19 18:46:07 UTC (rev 206104)
@@ -39,12 +39,4 @@
     return JSValue::encode(jsBoolean(isConstructor));
 }
 
-EncodedJSValue JSC_HOST_CALL esSpecIsRegExpObject(ExecState* exec)
-{
-    JSValue value = exec->uncheckedArgument(0);
-    if (value.isObject())
-        return JSValue::encode(jsBoolean(value.getObject()->type() == RegExpObjectType));
-    return JSValue::encode(jsBoolean(false));
-}
-
 } // namespace JSC

Modified: trunk/Source/_javascript_Core/runtime/ECMAScriptSpecInternalFunctions.h (206103 => 206104)


--- trunk/Source/_javascript_Core/runtime/ECMAScriptSpecInternalFunctions.h	2016-09-19 18:38:15 UTC (rev 206103)
+++ trunk/Source/_javascript_Core/runtime/ECMAScriptSpecInternalFunctions.h	2016-09-19 18:46:07 UTC (rev 206104)
@@ -31,7 +31,6 @@
 namespace JSC {
 
 EncodedJSValue JSC_HOST_CALL esSpecIsConstructor(ExecState*);
-EncodedJSValue JSC_HOST_CALL esSpecIsRegExpObject(ExecState*);
 
 } // namespace JSC
 

Modified: trunk/Source/_javascript_Core/runtime/Intrinsic.h (206103 => 206104)


--- trunk/Source/_javascript_Core/runtime/Intrinsic.h	2016-09-19 18:38:15 UTC (rev 206103)
+++ trunk/Source/_javascript_Core/runtime/Intrinsic.h	2016-09-19 18:46:07 UTC (rev 206104)
@@ -60,7 +60,6 @@
     RandomIntrinsic,
     FRoundIntrinsic,
     TruncIntrinsic,
-    IsRegExpObjectIntrinsic,
     IsTypedArrayViewIntrinsic,
     BoundThisNoArgsFunctionCallIntrinsic,
     JSMapGetIntrinsic,

Modified: trunk/Source/_javascript_Core/runtime/JSGlobalObject.cpp (206103 => 206104)


--- trunk/Source/_javascript_Core/runtime/JSGlobalObject.cpp	2016-09-19 18:38:15 UTC (rev 206103)
+++ trunk/Source/_javascript_Core/runtime/JSGlobalObject.cpp	2016-09-19 18:46:07 UTC (rev 206104)
@@ -746,10 +746,8 @@
         GlobalPropertyInfo(vm.propertyNames->builtinNames().InternalPromisePrivateName(), internalPromiseConstructor, DontEnum | DontDelete | ReadOnly),
 
         GlobalPropertyInfo(vm.propertyNames->builtinNames().repeatCharacterPrivateName(), JSFunction::create(vm, this, 2, String(), stringProtoFuncRepeatCharacter), DontEnum | DontDelete | ReadOnly),
-        GlobalPropertyInfo(vm.propertyNames->builtinNames().isSetPrivateName(), JSFunction::create(vm, this, 1, String(), privateFuncIsSet), DontEnum | DontDelete | ReadOnly),
         GlobalPropertyInfo(vm.propertyNames->builtinNames().SetIteratorPrivateName(), JSFunction::create(vm, this, 1, String(), privateFuncSetIterator), DontEnum | DontDelete | ReadOnly),
         GlobalPropertyInfo(vm.propertyNames->builtinNames().setIteratorNextPrivateName(), JSFunction::create(vm, this, 0, String(), privateFuncSetIteratorNext), DontEnum | DontDelete | ReadOnly),
-        GlobalPropertyInfo(vm.propertyNames->builtinNames().isMapPrivateName(), JSFunction::create(vm, this, 1, String(), privateFuncIsMap), DontEnum | DontDelete | ReadOnly),
         GlobalPropertyInfo(vm.propertyNames->builtinNames().isArrayPrivateName(), arrayConstructor->getDirect(vm, vm.propertyNames->isArray), DontEnum | DontDelete | ReadOnly),
         GlobalPropertyInfo(vm.propertyNames->builtinNames().isArraySlowPrivateName(), privateFuncIsArraySlow, DontEnum | DontDelete | ReadOnly),
         GlobalPropertyInfo(vm.propertyNames->builtinNames().isArrayConstructorPrivateName(), privateFuncIsArrayConstructor, DontEnum | DontDelete | ReadOnly),
@@ -770,7 +768,6 @@
 #endif // ENABLE(INTL)
 
         GlobalPropertyInfo(vm.propertyNames->builtinNames().isConstructorPrivateName(), JSFunction::create(vm, this, 1, String(), esSpecIsConstructor, NoIntrinsic), DontEnum | DontDelete | ReadOnly),
-        GlobalPropertyInfo(vm.propertyNames->builtinNames().isRegExpObjectPrivateName(), JSFunction::create(vm, this, 1, String(), esSpecIsRegExpObject, IsRegExpObjectIntrinsic), DontEnum | DontDelete | ReadOnly),
 
         GlobalPropertyInfo(vm.propertyNames->builtinNames().regExpProtoFlagsGetterPrivateName(), regExpProtoFlagsGetterObject, DontEnum | DontDelete | ReadOnly),
         GlobalPropertyInfo(vm.propertyNames->builtinNames().regExpProtoGlobalGetterPrivateName(), regExpProtoGlobalGetterObject, DontEnum | DontDelete | ReadOnly),

Modified: trunk/Source/_javascript_Core/runtime/MapPrototype.cpp (206103 => 206104)


--- trunk/Source/_javascript_Core/runtime/MapPrototype.cpp	2016-09-19 18:38:15 UTC (rev 206103)
+++ trunk/Source/_javascript_Core/runtime/MapPrototype.cpp	2016-09-19 18:46:07 UTC (rev 206104)
@@ -100,12 +100,6 @@
     return nullptr;
 }
 
-EncodedJSValue JSC_HOST_CALL privateFuncIsMap(ExecState* exec)
-{
-    JSValue value = exec->uncheckedArgument(0);
-    return JSValue::encode(jsBoolean(value.isCell() && value.asCell()->type() == JSMapType));
-}
-
 EncodedJSValue JSC_HOST_CALL mapProtoFuncClear(CallFrame* callFrame)
 {
     JSMap* map = getMap(callFrame, callFrame->thisValue());

Modified: trunk/Source/_javascript_Core/runtime/MapPrototype.h (206103 => 206104)


--- trunk/Source/_javascript_Core/runtime/MapPrototype.h	2016-09-19 18:38:15 UTC (rev 206103)
+++ trunk/Source/_javascript_Core/runtime/MapPrototype.h	2016-09-19 18:46:07 UTC (rev 206104)
@@ -58,7 +58,6 @@
     void finishCreation(VM&, JSGlobalObject*);
 };
 
-EncodedJSValue JSC_HOST_CALL privateFuncIsMap(ExecState*);
 EncodedJSValue JSC_HOST_CALL privateFuncMapIterator(ExecState*);
 EncodedJSValue JSC_HOST_CALL privateFuncMapIteratorNext(ExecState*);
 

Modified: trunk/Source/_javascript_Core/runtime/SetPrototype.cpp (206103 => 206104)


--- trunk/Source/_javascript_Core/runtime/SetPrototype.cpp	2016-09-19 18:38:15 UTC (rev 206103)
+++ trunk/Source/_javascript_Core/runtime/SetPrototype.cpp	2016-09-19 18:46:07 UTC (rev 206104)
@@ -159,11 +159,6 @@
     return JSValue::encode(JSSetIterator::create(vm, callFrame->callee()->globalObject()->setIteratorStructure(), thisObj, IterateKeyValue));
 }
 
-EncodedJSValue JSC_HOST_CALL privateFuncIsSet(ExecState* exec)
-{
-    return JSValue::encode(jsBoolean(jsDynamicCast<JSSet*>(exec->uncheckedArgument(0))));
-}
-
 EncodedJSValue JSC_HOST_CALL privateFuncSetIterator(ExecState* exec)
 {
     ASSERT(jsDynamicCast<JSSet*>(exec->uncheckedArgument(0)));

Modified: trunk/Source/_javascript_Core/runtime/SetPrototype.h (206103 => 206104)


--- trunk/Source/_javascript_Core/runtime/SetPrototype.h	2016-09-19 18:38:15 UTC (rev 206103)
+++ trunk/Source/_javascript_Core/runtime/SetPrototype.h	2016-09-19 18:46:07 UTC (rev 206104)
@@ -58,7 +58,6 @@
     void finishCreation(VM&, JSGlobalObject*);
 };
 
-EncodedJSValue JSC_HOST_CALL privateFuncIsSet(ExecState*);
 EncodedJSValue JSC_HOST_CALL privateFuncSetIterator(ExecState*);
 EncodedJSValue JSC_HOST_CALL privateFuncSetIteratorNext(ExecState*);
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to