Title: [264504] trunk
Revision
264504
Author
[email protected]
Date
2020-07-17 04:55:52 -0700 (Fri, 17 Jul 2020)

Log Message

emitIsUndefined() should not special-case [[IsHTMLDDA]] objects
https://bugs.webkit.org/show_bug.cgi?id=214443

Reviewed by Yusuke Suzuki.

JSTests:

* microbenchmarks/default-value-destructuring-array.js: Added.
* microbenchmarks/default-value-destructuring-object.js: Added.
* microbenchmarks/default-value-function-parameters.js: Added.
* stress/default-value-masquerader.js: Added.
* test262/expectations.yaml: Mark 10 test cases as passing.

Source/_javascript_Core:

According to Annex B [1], there is only a handful of language constructs
that handle [[IsHTMLDDA]] objects: ToBoolean, abstract equality with `null`
or `undefined`, and `typeof`. Currently, op_is_undefined does special-case
masquarader objects, even though it is used beyond `typeof`.

With this change, emitIsUndefined() produces `=== undefined`, which meets
developer expectations and the spec for all its usages, while op_is_undefined
is renamed to op_typeof_is_undefined. New name offers better semantics and
clearly communicates the op should be avoided when implementing new features.

Apart from fixing default values with [[IsHTMLDDA]] objects [2], this change
brings significant speed-up: +50% for function parameters and +20% for
object destructuring (masqueradesAsUndefinedWatchpoint is not fired).

This patch also introduces similar emitIsNull() method to avoid breaking
masquarader object as superclass test262 case.

[1]: https://tc39.es/ecma262/#sec-IsHTMLDDA-internal-slot
[2]: https://tc39.es/ecma262/#sec-runtime-semantics-keyedbindinginitialization (step 2)

* bytecode/BytecodeList.rb:
* bytecode/BytecodeUseDef.cpp:
(JSC::computeUsesForBytecodeIndexImpl):
(JSC::computeDefsForBytecodeIndexImpl):
* bytecompiler/BytecodeGenerator.cpp:
(JSC::BytecodeGenerator::emitEqualityOpImpl):
(JSC::BytecodeGenerator::emitIsUndefined): Deleted.
* bytecompiler/BytecodeGenerator.h:
(JSC::BytecodeGenerator::emitIsNull):
(JSC::BytecodeGenerator::emitIsUndefined):
* bytecompiler/NodesCodegen.cpp:
(JSC::ForInNode::emitBytecode):
(JSC::ClassExprNode::emitBytecode):
* dfg/DFGAbstractInterpreterInlines.h:
(JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects):
* dfg/DFGByteCodeParser.cpp:
(JSC::DFG::ByteCodeParser::parseBlock):
* dfg/DFGCapabilities.cpp:
(JSC::DFG::capabilityLevel):
* dfg/DFGClobberize.h:
(JSC::DFG::clobberize):
* dfg/DFGDoesGC.cpp:
(JSC::DFG::doesGC):
* dfg/DFGFixupPhase.cpp:
(JSC::DFG::FixupPhase::fixupNode):
* dfg/DFGNodeType.h:
* dfg/DFGPredictionPropagationPhase.cpp:
* dfg/DFGSafeToExecute.h:
(JSC::DFG::safeToExecute):
* dfg/DFGSpeculativeJIT32_64.cpp:
(JSC::DFG::SpeculativeJIT::compile):
* dfg/DFGSpeculativeJIT64.cpp:
(JSC::DFG::SpeculativeJIT::compile):
* dfg/DFGWatchpointCollectionPhase.cpp:
(JSC::DFG::WatchpointCollectionPhase::handle):
* ftl/FTLCapabilities.cpp:
(JSC::FTL::canCompile):
* ftl/FTLLowerDFGToB3.cpp:
(JSC::FTL::DFG::LowerDFGToB3::compileNode):
(JSC::FTL::DFG::LowerDFGToB3::compileTypeOfIsUndefined):
(JSC::FTL::DFG::LowerDFGToB3::compileIsUndefined): Deleted.
* jit/JIT.cpp:
(JSC::JIT::privateCompileMainPass):
* jit/JIT.h:
* jit/JITOpcodes.cpp:
(JSC::JIT::emit_op_typeof_is_undefined):
(JSC::JIT::emit_op_is_undefined): Deleted.
* jit/JITOpcodes32_64.cpp:
(JSC::JIT::emit_op_typeof_is_undefined):
(JSC::JIT::emit_op_is_undefined): Deleted.
* llint/LowLevelInterpreter32_64.asm:
* llint/LowLevelInterpreter64.asm:

Modified Paths

Added Paths

Diff

Modified: trunk/JSTests/ChangeLog (264503 => 264504)


--- trunk/JSTests/ChangeLog	2020-07-17 11:46:24 UTC (rev 264503)
+++ trunk/JSTests/ChangeLog	2020-07-17 11:55:52 UTC (rev 264504)
@@ -1,3 +1,16 @@
+2020-07-17  Alexey Shvayka  <[email protected]>
+
+        emitIsUndefined() should not special-case [[IsHTMLDDA]] objects
+        https://bugs.webkit.org/show_bug.cgi?id=214443
+
+        Reviewed by Yusuke Suzuki.
+
+        * microbenchmarks/default-value-destructuring-array.js: Added.
+        * microbenchmarks/default-value-destructuring-object.js: Added.
+        * microbenchmarks/default-value-function-parameters.js: Added.
+        * stress/default-value-masquerader.js: Added.
+        * test262/expectations.yaml: Mark 10 test cases as passing.
+
 2020-07-16  Yusuke Suzuki  <[email protected]>
 
         [JSC] Use unvalidatedGet instead of get to access UnlinkedCodeBlock from CodeBlock destructor

Added: trunk/JSTests/microbenchmarks/default-value-destructuring-array.js (0 => 264504)


--- trunk/JSTests/microbenchmarks/default-value-destructuring-array.js	                        (rev 0)
+++ trunk/JSTests/microbenchmarks/default-value-destructuring-array.js	2020-07-17 11:55:52 UTC (rev 264504)
@@ -0,0 +1,23 @@
+var o = {};
+var a = [];
+var s = "str";
+
+for (var i = 0; i < 1e5; ++i) {
+    var [
+        k00 = 0, k01 = 1, k02 = 2, k03 = 3, k04 = 4, k05 = 5, k06 = 6, k07 = 7, k08 = 8, k09 = 9,
+        k10 = 0, k11 = 1, k12 = 2, k13 = 3, k14 = 4, k15 = 5, k16 = 6, k17 = 7, k18 = 8, k19 = 9,
+        k20 = 0, k21 = 1, k22 = 2, k23 = 3, k24 = 4, k25 = 5, k26 = 6, k27 = 7, k28 = 8, k29 = 9,
+        k30 = 0, k31 = 1, k32 = 2, k33 = 3, k34 = 4, k35 = 5, k36 = 6, k37 = 7, k38 = 8, k39 = 9,
+        k40 = 0, k41 = 1, k42 = 2, k43 = 3, k44 = 4, k45 = 5, k46 = 6, k47 = 7, k48 = 8, k49 = 9,
+        k50 = 0, k51 = 1, k52 = 2, k53 = 3, k54 = 4, k55 = 5, k56 = 6, k57 = 7, k58 = 8, k59 = 9,
+        k60 = 0, k61 = 1, k62 = 2, k63 = 3, k64 = 4, k65 = 5, k66 = 6, k67 = 7, k68 = 8, k69 = 9,
+        k70 = 0, k71 = 1, k72 = 2, k73 = 3, k74 = 4, k75 = 5, k76 = 6, k77 = 7, k78 = 8, k79 = 9,
+        k80 = 0, k81 = 1, k82 = 2, k83 = 3, k84 = 4, k85 = 5, k86 = 6, k87 = 7, k88 = 8, k89 = 9,
+        k90 = 0, k91 = 1, k92 = 2, k93 = 3, k94 = 4, k95 = 5, k96 = 6, k97 = 7, k98 = 8, k99 = 9
+    ] = [
+        o, a, s, o, a, s, o, a, s, o, a, s, o, a, s, o, o, s, o, a, s, o, o, s, o,
+        o, a, s, o, a, s, o, a, s, o, a, s, o, a, s, o, o, s, o, a, s, o, o, s, o,
+        o, a, s, o, a, s, o, a, s, o, a, s, o, a, s, o, o, s, o, a, s, o, o, s, o,
+        o, a, s, o, a, s, o, a, s, o, a, s, o, a, s, o, o, s, o, a, s, o, o, s, o
+    ];
+}

Added: trunk/JSTests/microbenchmarks/default-value-destructuring-object.js (0 => 264504)


--- trunk/JSTests/microbenchmarks/default-value-destructuring-object.js	                        (rev 0)
+++ trunk/JSTests/microbenchmarks/default-value-destructuring-object.js	2020-07-17 11:55:52 UTC (rev 264504)
@@ -0,0 +1,29 @@
+var o = {};
+var a = [];
+var s = "str";
+
+for (var i = 0; i < 1e5; ++i) {
+    var {
+        k00 = 0, k01 = 1, k02 = 2, k03 = 3, k04 = 4, k05 = 5, k06 = 6, k07 = 7, k08 = 8, k09 = 9,
+        k10 = 0, k11 = 1, k12 = 2, k13 = 3, k14 = 4, k15 = 5, k16 = 6, k17 = 7, k18 = 8, k19 = 9,
+        k20 = 0, k21 = 1, k22 = 2, k23 = 3, k24 = 4, k25 = 5, k26 = 6, k27 = 7, k28 = 8, k29 = 9,
+        k30 = 0, k31 = 1, k32 = 2, k33 = 3, k34 = 4, k35 = 5, k36 = 6, k37 = 7, k38 = 8, k39 = 9,
+        k40 = 0, k41 = 1, k42 = 2, k43 = 3, k44 = 4, k45 = 5, k46 = 6, k47 = 7, k48 = 8, k49 = 9,
+        k50 = 0, k51 = 1, k52 = 2, k53 = 3, k54 = 4, k55 = 5, k56 = 6, k57 = 7, k58 = 8, k59 = 9,
+        k60 = 0, k61 = 1, k62 = 2, k63 = 3, k64 = 4, k65 = 5, k66 = 6, k67 = 7, k68 = 8, k69 = 9,
+        k70 = 0, k71 = 1, k72 = 2, k73 = 3, k74 = 4, k75 = 5, k76 = 6, k77 = 7, k78 = 8, k79 = 9,
+        k80 = 0, k81 = 1, k82 = 2, k83 = 3, k84 = 4, k85 = 5, k86 = 6, k87 = 7, k88 = 8, k89 = 9,
+        k90 = 0, k91 = 1, k92 = 2, k93 = 3, k94 = 4, k95 = 5, k96 = 6, k97 = 7, k98 = 8, k99 = 9
+    } = {
+        k00: o, k01: a, k02: s, k03: o, k04: a, k05: s, k06: o, k07: a, k08: s, k09: o,
+        k10: o, k11: a, k12: s, k13: o, k14: a, k15: s, k16: o, k17: a, k18: s, k19: o,
+        k20: o, k21: a, k22: s, k23: o, k24: a, k25: s, k26: o, k27: a, k28: s, k29: o,
+        k30: o, k31: a, k32: s, k33: o, k34: a, k35: s, k36: o, k37: a, k38: s, k39: o,
+        k40: o, k41: a, k42: s, k43: o, k44: a, k45: s, k46: o, k47: a, k48: s, k49: o,
+        k50: o, k51: a, k52: s, k53: o, k54: a, k55: s, k56: o, k57: a, k58: s, k59: o,
+        k60: o, k61: a, k62: s, k63: o, k64: a, k65: s, k66: o, k67: a, k68: s, k69: o,
+        k70: o, k71: a, k72: s, k73: o, k74: a, k75: s, k76: o, k77: a, k78: s, k79: o,
+        k80: o, k81: a, k82: s, k83: o, k84: a, k85: s, k86: o, k87: a, k88: s, k89: o,
+        k90: o, k91: a, k92: s, k93: o, k94: a, k95: s, k96: o, k97: a, k98: s, k99: o
+    };
+}

Added: trunk/JSTests/microbenchmarks/default-value-function-parameters.js (0 => 264504)


--- trunk/JSTests/microbenchmarks/default-value-function-parameters.js	                        (rev 0)
+++ trunk/JSTests/microbenchmarks/default-value-function-parameters.js	2020-07-17 11:55:52 UTC (rev 264504)
@@ -0,0 +1,26 @@
+var o = {};
+var a = [];
+var s = "str";
+
+function test(
+    k00 = 0, k01 = 1, k02 = 2, k03 = 3, k04 = 4, k05 = 5, k06 = 6, k07 = 7, k08 = 8, k09 = 9,
+    k10 = 0, k11 = 1, k12 = 2, k13 = 3, k14 = 4, k15 = 5, k16 = 6, k17 = 7, k18 = 8, k19 = 9,
+    k20 = 0, k21 = 1, k22 = 2, k23 = 3, k24 = 4, k25 = 5, k26 = 6, k27 = 7, k28 = 8, k29 = 9,
+    k30 = 0, k31 = 1, k32 = 2, k33 = 3, k34 = 4, k35 = 5, k36 = 6, k37 = 7, k38 = 8, k39 = 9,
+    k40 = 0, k41 = 1, k42 = 2, k43 = 3, k44 = 4, k45 = 5, k46 = 6, k47 = 7, k48 = 8, k49 = 9,
+    k50 = 0, k51 = 1, k52 = 2, k53 = 3, k54 = 4, k55 = 5, k56 = 6, k57 = 7, k58 = 8, k59 = 9,
+    k60 = 0, k61 = 1, k62 = 2, k63 = 3, k64 = 4, k65 = 5, k66 = 6, k67 = 7, k68 = 8, k69 = 9,
+    k70 = 0, k71 = 1, k72 = 2, k73 = 3, k74 = 4, k75 = 5, k76 = 6, k77 = 7, k78 = 8, k79 = 9,
+    k80 = 0, k81 = 1, k82 = 2, k83 = 3, k84 = 4, k85 = 5, k86 = 6, k87 = 7, k88 = 8, k89 = 9,
+    k90 = 0, k91 = 1, k92 = 2, k93 = 3, k94 = 4, k95 = 5, k96 = 6, k97 = 7, k98 = 8, k99 = 9
+) {}
+noInline(test);
+
+for (var i = 0; i < 1e5; ++i) {
+    test(
+        o, a, s, o, a, s, o, a, s, o, a, s, o, a, s, o, o, s, o, a, s, o, o, s, o,
+        o, a, s, o, a, s, o, a, s, o, a, s, o, a, s, o, o, s, o, a, s, o, o, s, o,
+        o, a, s, o, a, s, o, a, s, o, a, s, o, a, s, o, o, s, o, a, s, o, o, s, o,
+        o, a, s, o, a, s, o, a, s, o, a, s, o, a, s, o, o, s, o, a, s, o, o, s, o
+    );
+}

Added: trunk/JSTests/stress/default-value-masquerader.js (0 => 264504)


--- trunk/JSTests/stress/default-value-masquerader.js	                        (rev 0)
+++ trunk/JSTests/stress/default-value-masquerader.js	2020-07-17 11:55:52 UTC (rev 264504)
@@ -0,0 +1,29 @@
+function shouldBe(actual, expected) {
+    if (actual !== expected)
+        throw new Error('bad value: ' + actual);
+}
+
+var masquerader = makeMasquerader();
+
+var test1 = (arg = 1) => arg;
+noInline(test1);
+for (var i = 0; i < 1e5; ++i)
+    shouldBe(test1(masquerader), masquerader);
+
+var test2 = obj => { var {key = 2} = obj; return key; };
+noInline(test2);
+for (var i = 0; i < 1e5; ++i) {
+    shouldBe(test2({key: masquerader}), masquerader);
+
+    var {key = 2} = {key: masquerader};
+    shouldBe(key, masquerader);
+}
+
+var test3 = arr => { var [item = 3] = arr; return item; };
+noInline(test3);
+for (var i = 0; i < 1e5; ++i) {
+    shouldBe(test3([masquerader]), masquerader);
+
+    var [item = 3] = [masquerader];
+    shouldBe(item, masquerader);
+}

Modified: trunk/JSTests/test262/expectations.yaml (264503 => 264504)


--- trunk/JSTests/test262/expectations.yaml	2020-07-17 11:46:24 UTC (rev 264503)
+++ trunk/JSTests/test262/expectations.yaml	2020-07-17 11:55:52 UTC (rev 264504)
@@ -295,12 +295,6 @@
   default: 'Test262Error: An initialized binding is not created following evaluation Expected a ReferenceError to be thrown but no exception was thrown at all'
 test/annexB/language/eval-code/indirect/global-switch-dflt-eval-global-skip-early-err-try.js:
   default: 'Test262Error: An initialized binding is not created prior to evaluation Expected a ReferenceError to be thrown but no exception was thrown at all'
-test/annexB/language/expressions/assignment/dstr/array-pattern-emulates-undefined.js:
-  default: 'Test262Error: Expected SameValue(«undefined», «[object Function]») to be true'
-  strict mode: 'Test262Error: Expected SameValue(«undefined», «[object Function]») to be true'
-test/annexB/language/expressions/assignment/dstr/object-pattern-emulates-undefined.js:
-  default: 'Test262Error: Expected SameValue(«undefined», «[object Function]») to be true'
-  strict mode: 'Test262Error: Expected SameValue(«undefined», «[object Function]») to be true'
 test/annexB/language/function-code/block-decl-func-skip-arguments.js:
   default: 'Test262Error: Expected SameValue(«function arguments() {}», «[object Arguments]») to be true'
 test/annexB/language/function-code/block-decl-func-skip-early-err-block.js:
@@ -609,15 +603,6 @@
   default: 'Test262Error: An initialized binding is not created prior to evaluation Expected a ReferenceError to be thrown but no exception was thrown at all'
 test/annexB/language/global-code/switch-dflt-global-skip-early-err.js:
   default: "SyntaxError: Cannot declare a function that shadows a let/const/class/function variable 'f' in strict mode."
-test/annexB/language/statements/const/dstr/array-pattern-emulates-undefined.js:
-  default: 'Test262Error: Expected SameValue(«undefined», «[object Function]») to be true'
-  strict mode: 'Test262Error: Expected SameValue(«undefined», «[object Function]») to be true'
-test/annexB/language/statements/const/dstr/object-pattern-emulates-undefined.js:
-  default: 'Test262Error: Expected SameValue(«undefined», «[object Function]») to be true'
-  strict mode: 'Test262Error: Expected SameValue(«undefined», «[object Function]») to be true'
-test/annexB/language/statements/function/default-parameters-emulates-undefined.js:
-  default: 'Test262Error: Expected SameValue(«undefined», «[object Function]») to be true'
-  strict mode: 'Test262Error: Expected SameValue(«undefined», «[object Function]») to be true'
 test/built-ins/ArrayBuffer/prototype/byteLength/detached-buffer.js:
   default: 'Test262Error: Expected a TypeError to be thrown but no exception was thrown at all'
   strict mode: 'Test262Error: Expected a TypeError to be thrown but no exception was thrown at all'

Modified: trunk/Source/_javascript_Core/ChangeLog (264503 => 264504)


--- trunk/Source/_javascript_Core/ChangeLog	2020-07-17 11:46:24 UTC (rev 264503)
+++ trunk/Source/_javascript_Core/ChangeLog	2020-07-17 11:55:52 UTC (rev 264504)
@@ -1,3 +1,83 @@
+2020-07-17  Alexey Shvayka  <[email protected]>
+
+        emitIsUndefined() should not special-case [[IsHTMLDDA]] objects
+        https://bugs.webkit.org/show_bug.cgi?id=214443
+
+        Reviewed by Yusuke Suzuki.
+
+        According to Annex B [1], there is only a handful of language constructs
+        that handle [[IsHTMLDDA]] objects: ToBoolean, abstract equality with `null`
+        or `undefined`, and `typeof`. Currently, op_is_undefined does special-case
+        masquarader objects, even though it is used beyond `typeof`.
+
+        With this change, emitIsUndefined() produces `=== undefined`, which meets
+        developer expectations and the spec for all its usages, while op_is_undefined
+        is renamed to op_typeof_is_undefined. New name offers better semantics and
+        clearly communicates the op should be avoided when implementing new features.
+
+        Apart from fixing default values with [[IsHTMLDDA]] objects [2], this change
+        brings significant speed-up: +50% for function parameters and +20% for
+        object destructuring (masqueradesAsUndefinedWatchpoint is not fired).
+
+        This patch also introduces similar emitIsNull() method to avoid breaking
+        masquarader object as superclass test262 case.
+
+        [1]: https://tc39.es/ecma262/#sec-IsHTMLDDA-internal-slot
+        [2]: https://tc39.es/ecma262/#sec-runtime-semantics-keyedbindinginitialization (step 2)
+
+        * bytecode/BytecodeList.rb:
+        * bytecode/BytecodeUseDef.cpp:
+        (JSC::computeUsesForBytecodeIndexImpl):
+        (JSC::computeDefsForBytecodeIndexImpl):
+        * bytecompiler/BytecodeGenerator.cpp:
+        (JSC::BytecodeGenerator::emitEqualityOpImpl):
+        (JSC::BytecodeGenerator::emitIsUndefined): Deleted.
+        * bytecompiler/BytecodeGenerator.h:
+        (JSC::BytecodeGenerator::emitIsNull):
+        (JSC::BytecodeGenerator::emitIsUndefined):
+        * bytecompiler/NodesCodegen.cpp:
+        (JSC::ForInNode::emitBytecode):
+        (JSC::ClassExprNode::emitBytecode):
+        * dfg/DFGAbstractInterpreterInlines.h:
+        (JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects):
+        * dfg/DFGByteCodeParser.cpp:
+        (JSC::DFG::ByteCodeParser::parseBlock):
+        * dfg/DFGCapabilities.cpp:
+        (JSC::DFG::capabilityLevel):
+        * dfg/DFGClobberize.h:
+        (JSC::DFG::clobberize):
+        * dfg/DFGDoesGC.cpp:
+        (JSC::DFG::doesGC):
+        * dfg/DFGFixupPhase.cpp:
+        (JSC::DFG::FixupPhase::fixupNode):
+        * dfg/DFGNodeType.h:
+        * dfg/DFGPredictionPropagationPhase.cpp:
+        * dfg/DFGSafeToExecute.h:
+        (JSC::DFG::safeToExecute):
+        * dfg/DFGSpeculativeJIT32_64.cpp:
+        (JSC::DFG::SpeculativeJIT::compile):
+        * dfg/DFGSpeculativeJIT64.cpp:
+        (JSC::DFG::SpeculativeJIT::compile):
+        * dfg/DFGWatchpointCollectionPhase.cpp:
+        (JSC::DFG::WatchpointCollectionPhase::handle):
+        * ftl/FTLCapabilities.cpp:
+        (JSC::FTL::canCompile):
+        * ftl/FTLLowerDFGToB3.cpp:
+        (JSC::FTL::DFG::LowerDFGToB3::compileNode):
+        (JSC::FTL::DFG::LowerDFGToB3::compileTypeOfIsUndefined):
+        (JSC::FTL::DFG::LowerDFGToB3::compileIsUndefined): Deleted.
+        * jit/JIT.cpp:
+        (JSC::JIT::privateCompileMainPass):
+        * jit/JIT.h:
+        * jit/JITOpcodes.cpp:
+        (JSC::JIT::emit_op_typeof_is_undefined):
+        (JSC::JIT::emit_op_is_undefined): Deleted.
+        * jit/JITOpcodes32_64.cpp:
+        (JSC::JIT::emit_op_typeof_is_undefined):
+        (JSC::JIT::emit_op_is_undefined): Deleted.
+        * llint/LowLevelInterpreter32_64.asm:
+        * llint/LowLevelInterpreter64.asm:
+
 2020-07-16  Yusuke Suzuki  <[email protected]>
 
         [JSC] Clean up Intl option parsing code by introducing intlOption<>

Modified: trunk/Source/_javascript_Core/bytecode/BytecodeList.rb (264503 => 264504)


--- trunk/Source/_javascript_Core/bytecode/BytecodeList.rb	2020-07-17 11:46:24 UTC (rev 264503)
+++ trunk/Source/_javascript_Core/bytecode/BytecodeList.rb	2020-07-17 11:55:52 UTC (rev 264504)
@@ -327,7 +327,7 @@
         :to_string,
         :unsigned,
         :is_empty,
-        :is_undefined,
+        :typeof_is_undefined,
         :is_undefined_or_null,
         :is_boolean,
         :is_number,

Modified: trunk/Source/_javascript_Core/bytecode/BytecodeUseDef.cpp (264503 => 264504)


--- trunk/Source/_javascript_Core/bytecode/BytecodeUseDef.cpp	2020-07-17 11:46:24 UTC (rev 264503)
+++ trunk/Source/_javascript_Core/bytecode/BytecodeUseDef.cpp	2020-07-17 11:55:52 UTC (rev 264504)
@@ -182,7 +182,7 @@
     USES(OpInById, base)
     USES(OpTypeof, value)
     USES(OpIsEmpty, operand)
-    USES(OpIsUndefined, operand)
+    USES(OpTypeofIsUndefined, operand)
     USES(OpIsUndefinedOrNull, operand)
     USES(OpIsBoolean, operand)
     USES(OpIsNumber, operand)
@@ -489,7 +489,7 @@
     DEFS(OpTypeof, dst)
     DEFS(OpIdentityWithProfile, srcDst)
     DEFS(OpIsEmpty, dst)
-    DEFS(OpIsUndefined, dst)
+    DEFS(OpTypeofIsUndefined, dst)
     DEFS(OpIsUndefinedOrNull, dst)
     DEFS(OpIsBoolean, dst)
     DEFS(OpIsNumber, dst)

Modified: trunk/Source/_javascript_Core/bytecompiler/BytecodeGenerator.cpp (264503 => 264504)


--- trunk/Source/_javascript_Core/bytecompiler/BytecodeGenerator.cpp	2020-07-17 11:46:24 UTC (rev 264503)
+++ trunk/Source/_javascript_Core/bytecompiler/BytecodeGenerator.cpp	2020-07-17 11:55:52 UTC (rev 264504)
@@ -1681,7 +1681,7 @@
             const String& value = asString(m_codeBlock->constantRegister(src2->virtualRegister()).get())->tryGetValue();
             if (value == "undefined") {
                 rewind();
-                OpIsUndefined::emit(this, dst, op.m_value);
+                OpTypeofIsUndefined::emit(this, dst, op.m_value);
                 return true;
             }
             if (value == "boolean") {
@@ -4424,12 +4424,6 @@
     return dst;
 }
 
-RegisterID* BytecodeGenerator::emitIsUndefined(RegisterID* dst, RegisterID* src)
-{
-    OpIsUndefined::emit(this, dst, src);
-    return dst;
-}
-
 RegisterID* BytecodeGenerator::emitIsUndefinedOrNull(RegisterID* dst, RegisterID* src)
 {
     OpIsUndefinedOrNull::emit(this, dst, src);

Modified: trunk/Source/_javascript_Core/bytecompiler/BytecodeGenerator.h (264503 => 264504)


--- trunk/Source/_javascript_Core/bytecompiler/BytecodeGenerator.h	2020-07-17 11:46:24 UTC (rev 264503)
+++ trunk/Source/_javascript_Core/bytecompiler/BytecodeGenerator.h	2020-07-17 11:55:52 UTC (rev 264504)
@@ -929,7 +929,8 @@
         RegisterID* emitIsObject(RegisterID* dst, RegisterID* src);
         RegisterID* emitIsConstructor(RegisterID* dst, RegisterID* src);
         RegisterID* emitIsNumber(RegisterID* dst, RegisterID* src);
-        RegisterID* emitIsUndefined(RegisterID* dst, RegisterID* src);
+        RegisterID* emitIsNull(RegisterID* dst, RegisterID* src) { return emitEqualityOp<OpStricteq>(dst, src, emitLoad(nullptr, jsNull())); }
+        RegisterID* emitIsUndefined(RegisterID* dst, RegisterID* src) { return emitEqualityOp<OpStricteq>(dst, src, emitLoad(nullptr, jsUndefined())); }
         RegisterID* emitIsUndefinedOrNull(RegisterID* dst, RegisterID* src);
         RegisterID* emitIsEmpty(RegisterID* dst, RegisterID* src);
         RegisterID* emitIsDerivedArray(RegisterID* dst, RegisterID* src) { return emitIsCellWithType(dst, src, DerivedArrayType); }

Modified: trunk/Source/_javascript_Core/bytecompiler/NodesCodegen.cpp (264503 => 264504)


--- trunk/Source/_javascript_Core/bytecompiler/NodesCodegen.cpp	2020-07-17 11:46:24 UTC (rev 264503)
+++ trunk/Source/_javascript_Core/bytecompiler/NodesCodegen.cpp	2020-07-17 11:55:52 UTC (rev 264504)
@@ -3962,7 +3962,7 @@
         generator.emitLabel(loopStart.get());
         generator.emitLoopHint();
 
-        RefPtr<RegisterID> result = generator.emitUnaryOp<OpEqNull>(generator.newTemporary(), propertyName.get());
+        RefPtr<RegisterID> result = generator.emitIsNull(generator.newTemporary(), propertyName.get());
         generator.emitJumpIfTrue(result.get(), loopEnd.get());
         generator.emitHasStructureProperty(result.get(), base.get(), propertyName.get(), enumerator.get());
         generator.emitJumpIfFalse(result.get(), *scope->continueTarget());
@@ -4003,7 +4003,7 @@
         generator.emitLabel(loopStart.get());
         generator.emitLoopHint();
 
-        RefPtr<RegisterID> result = generator.emitUnaryOp<OpEqNull>(generator.newTemporary(), propertyName.get());
+        RefPtr<RegisterID> result = generator.emitIsNull(generator.newTemporary(), propertyName.get());
         generator.emitJumpIfTrue(result.get(), loopEnd.get());
 
         generator.emitHasGenericProperty(result.get(), base.get(), propertyName.get());
@@ -4896,7 +4896,7 @@
         generator.emitJumpIfTrue(generator.emitIsUndefined(tempRegister.get(), superclass.get()), superclassIsUndefinedLabel.get());
 
         Ref<Label> superclassIsNullLabel = generator.newLabel();
-        generator.emitJumpIfTrue(generator.emitUnaryOp<OpEqNull>(tempRegister.get(), superclass.get()), superclassIsNullLabel.get());
+        generator.emitJumpIfTrue(generator.emitIsNull(tempRegister.get(), superclass.get()), superclassIsNullLabel.get());
 
         Ref<Label> superclassIsConstructorLabel = generator.newLabel();
         generator.emitJumpIfTrue(generator.emitIsConstructor(tempRegister.get(), superclass.get()), superclassIsConstructorLabel.get());

Modified: trunk/Source/_javascript_Core/dfg/DFGAbstractInterpreterInlines.h (264503 => 264504)


--- trunk/Source/_javascript_Core/dfg/DFGAbstractInterpreterInlines.h	2020-07-17 11:46:24 UTC (rev 264503)
+++ trunk/Source/_javascript_Core/dfg/DFGAbstractInterpreterInlines.h	2020-07-17 11:55:52 UTC (rev 264504)
@@ -1449,7 +1449,7 @@
         break;
 
     case IsEmpty:
-    case IsUndefined:
+    case TypeOfIsUndefined:
     case IsUndefinedOrNull:
     case IsBoolean:
     case IsNumber:
@@ -1468,7 +1468,7 @@
             case IsCellWithType:
                 setConstant(node, jsBoolean(child.value().isCell() && child.value().asCell()->type() == node->queriedType()));
                 break;
-            case IsUndefined:
+            case TypeOfIsUndefined:
                 setConstant(node, jsBoolean(
                     child.value().isCell()
                     ? child.value().asCell()->structure(m_vm)->masqueradesAsUndefined(m_codeBlock->globalObjectFor(node->origin.semantic))
@@ -1591,7 +1591,7 @@
 
             break;
         }
-        case IsUndefined:
+        case TypeOfIsUndefined:
             // FIXME: Use the masquerades-as-undefined watchpoint thingy.
             // https://bugs.webkit.org/show_bug.cgi?id=144456
             

Modified: trunk/Source/_javascript_Core/dfg/DFGByteCodeParser.cpp (264503 => 264504)


--- trunk/Source/_javascript_Core/dfg/DFGByteCodeParser.cpp	2020-07-17 11:46:24 UTC (rev 264503)
+++ trunk/Source/_javascript_Core/dfg/DFGByteCodeParser.cpp	2020-07-17 11:55:52 UTC (rev 264504)
@@ -5736,10 +5736,10 @@
             set(bytecode.m_dst, addToGraph(IsEmpty, value));
             NEXT_OPCODE(op_is_empty);
         }
-        case op_is_undefined: {
-            auto bytecode = currentInstruction->as<OpIsUndefined>();
+        case op_typeof_is_undefined: {
+            auto bytecode = currentInstruction->as<OpTypeofIsUndefined>();
             Node* value = get(bytecode.m_operand);
-            set(bytecode.m_dst, addToGraph(IsUndefined, value));
+            set(bytecode.m_dst, addToGraph(TypeOfIsUndefined, value));
             NEXT_OPCODE(op_is_undefined);
         }
         case op_is_undefined_or_null: {

Modified: trunk/Source/_javascript_Core/dfg/DFGCapabilities.cpp (264503 => 264504)


--- trunk/Source/_javascript_Core/dfg/DFGCapabilities.cpp	2020-07-17 11:46:24 UTC (rev 264503)
+++ trunk/Source/_javascript_Core/dfg/DFGCapabilities.cpp	2020-07-17 11:55:52 UTC (rev 264504)
@@ -143,7 +143,7 @@
     case op_instanceof:
     case op_instanceof_custom:
     case op_is_empty:
-    case op_is_undefined:
+    case op_typeof_is_undefined:
     case op_is_undefined_or_null:
     case op_is_boolean:
     case op_is_number:

Modified: trunk/Source/_javascript_Core/dfg/DFGClobberize.h (264503 => 264504)


--- trunk/Source/_javascript_Core/dfg/DFGClobberize.h	2020-07-17 11:46:24 UTC (rev 264503)
+++ trunk/Source/_javascript_Core/dfg/DFGClobberize.h	2020-07-17 11:55:52 UTC (rev 264504)
@@ -224,7 +224,7 @@
     case CompareStrictEq:
     case SameValue:
     case IsEmpty:
-    case IsUndefined:
+    case TypeOfIsUndefined:
     case IsUndefinedOrNull:
     case IsBoolean:
     case IsNumber:

Modified: trunk/Source/_javascript_Core/dfg/DFGDoesGC.cpp (264503 => 264504)


--- trunk/Source/_javascript_Core/dfg/DFGDoesGC.cpp	2020-07-17 11:46:24 UTC (rev 264503)
+++ trunk/Source/_javascript_Core/dfg/DFGDoesGC.cpp	2020-07-17 11:55:52 UTC (rev 264504)
@@ -143,7 +143,7 @@
     case ProfileControlFlow:
     case OverridesHasInstance:
     case IsEmpty:
-    case IsUndefined:
+    case TypeOfIsUndefined:
     case IsUndefinedOrNull:
     case IsBoolean:
     case IsNumber:

Modified: trunk/Source/_javascript_Core/dfg/DFGFixupPhase.cpp (264503 => 264504)


--- trunk/Source/_javascript_Core/dfg/DFGFixupPhase.cpp	2020-07-17 11:46:24 UTC (rev 264503)
+++ trunk/Source/_javascript_Core/dfg/DFGFixupPhase.cpp	2020-07-17 11:55:52 UTC (rev 264504)
@@ -2713,7 +2713,7 @@
         case NewRegexp:
         case IsTypedArrayView:
         case IsEmpty:
-        case IsUndefined:
+        case TypeOfIsUndefined:
         case IsUndefinedOrNull:
         case IsBoolean:
         case IsNumber:

Modified: trunk/Source/_javascript_Core/dfg/DFGNodeType.h (264503 => 264504)


--- trunk/Source/_javascript_Core/dfg/DFGNodeType.h	2020-07-17 11:46:24 UTC (rev 264503)
+++ trunk/Source/_javascript_Core/dfg/DFGNodeType.h	2020-07-17 11:55:52 UTC (rev 264504)
@@ -392,7 +392,7 @@
     \
     macro(IsCellWithType, NodeResultBoolean) \
     macro(IsEmpty, NodeResultBoolean) \
-    macro(IsUndefined, NodeResultBoolean) \
+    macro(TypeOfIsUndefined, NodeResultBoolean) \
     macro(IsUndefinedOrNull, NodeResultBoolean) \
     macro(IsBoolean, NodeResultBoolean) \
     macro(IsNumber, NodeResultBoolean) \

Modified: trunk/Source/_javascript_Core/dfg/DFGPredictionPropagationPhase.cpp (264503 => 264504)


--- trunk/Source/_javascript_Core/dfg/DFGPredictionPropagationPhase.cpp	2020-07-17 11:46:24 UTC (rev 264503)
+++ trunk/Source/_javascript_Core/dfg/DFGPredictionPropagationPhase.cpp	2020-07-17 11:55:52 UTC (rev 264504)
@@ -1031,7 +1031,7 @@
         case InstanceOf:
         case InstanceOfCustom:
         case IsEmpty:
-        case IsUndefined:
+        case TypeOfIsUndefined:
         case IsUndefinedOrNull:
         case IsBoolean:
         case IsNumber:

Modified: trunk/Source/_javascript_Core/dfg/DFGSafeToExecute.h (264503 => 264504)


--- trunk/Source/_javascript_Core/dfg/DFGSafeToExecute.h	2020-07-17 11:46:24 UTC (rev 264503)
+++ trunk/Source/_javascript_Core/dfg/DFGSafeToExecute.h	2020-07-17 11:55:52 UTC (rev 264504)
@@ -256,7 +256,7 @@
     case ParseInt:
     case OverridesHasInstance:
     case IsEmpty:
-    case IsUndefined:
+    case TypeOfIsUndefined:
     case IsUndefinedOrNull:
     case IsBoolean:
     case IsNumber:

Modified: trunk/Source/_javascript_Core/dfg/DFGSpeculativeJIT32_64.cpp (264503 => 264504)


--- trunk/Source/_javascript_Core/dfg/DFGSpeculativeJIT32_64.cpp	2020-07-17 11:46:24 UTC (rev 264503)
+++ trunk/Source/_javascript_Core/dfg/DFGSpeculativeJIT32_64.cpp	2020-07-17 11:55:52 UTC (rev 264504)
@@ -3625,7 +3625,7 @@
         break;
     }
 
-    case IsUndefined: {
+    case TypeOfIsUndefined: {
         JSValueOperand value(this, node->child1());
         GPRTemporary result(this);
         GPRTemporary localGlobalObject(this);

Modified: trunk/Source/_javascript_Core/dfg/DFGSpeculativeJIT64.cpp (264503 => 264504)


--- trunk/Source/_javascript_Core/dfg/DFGSpeculativeJIT64.cpp	2020-07-17 11:46:24 UTC (rev 264503)
+++ trunk/Source/_javascript_Core/dfg/DFGSpeculativeJIT64.cpp	2020-07-17 11:55:52 UTC (rev 264504)
@@ -4242,7 +4242,7 @@
         break;
     }
         
-    case IsUndefined: {
+    case TypeOfIsUndefined: {
         JSValueOperand value(this, node->child1());
         GPRTemporary result(this);
         GPRTemporary localGlobalObject(this);

Modified: trunk/Source/_javascript_Core/dfg/DFGWatchpointCollectionPhase.cpp (264503 => 264504)


--- trunk/Source/_javascript_Core/dfg/DFGWatchpointCollectionPhase.cpp	2020-07-17 11:46:24 UTC (rev 264503)
+++ trunk/Source/_javascript_Core/dfg/DFGWatchpointCollectionPhase.cpp	2020-07-17 11:55:52 UTC (rev 264504)
@@ -71,7 +71,7 @@
     void handle()
     {
         switch (m_node->op()) {
-        case IsUndefined:
+        case TypeOfIsUndefined:
             handleMasqueradesAsUndefined();
             break;
             

Modified: trunk/Source/_javascript_Core/ftl/FTLCapabilities.cpp (264503 => 264504)


--- trunk/Source/_javascript_Core/ftl/FTLCapabilities.cpp	2020-07-17 11:46:24 UTC (rev 264503)
+++ trunk/Source/_javascript_Core/ftl/FTLCapabilities.cpp	2020-07-17 11:55:52 UTC (rev 264504)
@@ -257,7 +257,7 @@
     case WeakSetAdd:
     case WeakMapSet:
     case IsEmpty:
-    case IsUndefined:
+    case TypeOfIsUndefined:
     case IsUndefinedOrNull:
     case IsBoolean:
     case IsNumber:

Modified: trunk/Source/_javascript_Core/ftl/FTLLowerDFGToB3.cpp (264503 => 264504)


--- trunk/Source/_javascript_Core/ftl/FTLLowerDFGToB3.cpp	2020-07-17 11:46:24 UTC (rev 264503)
+++ trunk/Source/_javascript_Core/ftl/FTLLowerDFGToB3.cpp	2020-07-17 11:55:52 UTC (rev 264504)
@@ -1364,8 +1364,8 @@
         case IsEmpty:
             compileIsEmpty();
             break;
-        case IsUndefined:
-            compileIsUndefined();
+        case TypeOfIsUndefined:
+            compileTypeOfIsUndefined();
             break;
         case IsUndefinedOrNull:
             compileIsUndefinedOrNull();
@@ -10998,7 +10998,7 @@
         setBoolean(m_out.isZero64(lowJSValue(m_node->child1())));
     }
     
-    void compileIsUndefined()
+    void compileTypeOfIsUndefined()
     {
         setBoolean(equalNullOrUndefined(m_node->child1(), AllCellsAreFalse, EqualUndefined));
     }

Modified: trunk/Source/_javascript_Core/jit/JIT.cpp (264503 => 264504)


--- trunk/Source/_javascript_Core/jit/JIT.cpp	2020-07-17 11:46:24 UTC (rev 264503)
+++ trunk/Source/_javascript_Core/jit/JIT.cpp	2020-07-17 11:55:52 UTC (rev 264504)
@@ -362,7 +362,7 @@
         DEFINE_OP(op_instanceof)
         DEFINE_OP(op_instanceof_custom)
         DEFINE_OP(op_is_empty)
-        DEFINE_OP(op_is_undefined)
+        DEFINE_OP(op_typeof_is_undefined)
         DEFINE_OP(op_is_undefined_or_null)
         DEFINE_OP(op_is_boolean)
         DEFINE_OP(op_is_number)

Modified: trunk/Source/_javascript_Core/jit/JIT.h (264503 => 264504)


--- trunk/Source/_javascript_Core/jit/JIT.h	2020-07-17 11:46:24 UTC (rev 264503)
+++ trunk/Source/_javascript_Core/jit/JIT.h	2020-07-17 11:55:52 UTC (rev 264504)
@@ -535,7 +535,7 @@
         void emit_op_instanceof(const Instruction*);
         void emit_op_instanceof_custom(const Instruction*);
         void emit_op_is_empty(const Instruction*);
-        void emit_op_is_undefined(const Instruction*);
+        void emit_op_typeof_is_undefined(const Instruction*);
         void emit_op_is_undefined_or_null(const Instruction*);
         void emit_op_is_boolean(const Instruction*);
         void emit_op_is_number(const Instruction*);

Modified: trunk/Source/_javascript_Core/jit/JITOpcodes.cpp (264503 => 264504)


--- trunk/Source/_javascript_Core/jit/JITOpcodes.cpp	2020-07-17 11:46:24 UTC (rev 264503)
+++ trunk/Source/_javascript_Core/jit/JITOpcodes.cpp	2020-07-17 11:55:52 UTC (rev 264504)
@@ -206,9 +206,9 @@
     emitPutVirtualRegister(dst);
 }
 
-void JIT::emit_op_is_undefined(const Instruction* currentInstruction)
+void JIT::emit_op_typeof_is_undefined(const Instruction* currentInstruction)
 {
-    auto bytecode = currentInstruction->as<OpIsUndefined>();
+    auto bytecode = currentInstruction->as<OpTypeofIsUndefined>();
     VirtualRegister dst = bytecode.m_dst;
     VirtualRegister value = bytecode.m_operand;
     

Modified: trunk/Source/_javascript_Core/jit/JITOpcodes32_64.cpp (264503 => 264504)


--- trunk/Source/_javascript_Core/jit/JITOpcodes32_64.cpp	2020-07-17 11:46:24 UTC (rev 264503)
+++ trunk/Source/_javascript_Core/jit/JITOpcodes32_64.cpp	2020-07-17 11:55:52 UTC (rev 264504)
@@ -227,9 +227,9 @@
     emitStoreBool(dst, regT0);
 }
 
-void JIT::emit_op_is_undefined(const Instruction* currentInstruction)
+void JIT::emit_op_typeof_is_undefined(const Instruction* currentInstruction)
 {
-    auto bytecode = currentInstruction->as<OpIsUndefined>();
+    auto bytecode = currentInstruction->as<OpTypeofIsUndefined>();
     VirtualRegister dst = bytecode.m_dst;
     VirtualRegister value = bytecode.m_operand;
     

Modified: trunk/Source/_javascript_Core/llint/LowLevelInterpreter32_64.asm (264503 => 264504)


--- trunk/Source/_javascript_Core/llint/LowLevelInterpreter32_64.asm	2020-07-17 11:46:24 UTC (rev 264503)
+++ trunk/Source/_javascript_Core/llint/LowLevelInterpreter32_64.asm	2020-07-17 11:55:52 UTC (rev 264504)
@@ -1272,7 +1272,7 @@
 end)
 
 
-llintOpWithReturn(op_is_undefined, OpIsUndefined, macro (size, get, dispatch, return)
+llintOpWithReturn(op_typeof_is_undefined, OpTypeofIsUndefined, macro (size, get, dispatch, return)
     get(m_operand, t1)
     loadConstantOrVariable(size, t1, t2, t3)
     bieq t2, CellTag, .opIsUndefinedCell

Modified: trunk/Source/_javascript_Core/llint/LowLevelInterpreter64.asm (264503 => 264504)


--- trunk/Source/_javascript_Core/llint/LowLevelInterpreter64.asm	2020-07-17 11:46:24 UTC (rev 264503)
+++ trunk/Source/_javascript_Core/llint/LowLevelInterpreter64.asm	2020-07-17 11:55:52 UTC (rev 264504)
@@ -1301,7 +1301,7 @@
 end)
 
 
-llintOpWithReturn(op_is_undefined, OpIsUndefined, macro (size, get, dispatch, return)
+llintOpWithReturn(op_typeof_is_undefined, OpTypeofIsUndefined, macro (size, get, dispatch, return)
     get(m_operand, t1)
     loadConstantOrVariable(size, t1, t0)
     btqz t0, notCellMask, .opIsUndefinedCell
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to