Ignore:
Timestamp:
Jul 23, 2020, 12:28:49 AM (5 years ago)
Author:
Alexey Shvayka
Message:

Remove emitIsUndefined() from ClassExprNode::emitBytecode()
https://bugs.webkit.org/show_bug.cgi?id=214645

Reviewed by Darin Adler.

This change removes superclass === undefined check because it's missing from
the spec [1] and isn't a common case. No behavior change: values except null are
passed to OpIsConstructor, resulting in the same error being thrown for undefined.

Test: LayoutTests/js/class-syntax-extends.html

[1]: https://tc39.es/ecma262/#sec-runtime-semantics-classdefinitionevaluation (step 5.e)

  • bytecompiler/NodesCodegen.cpp:

(JSC::ClassExprNode::emitBytecode):

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/bytecompiler/NodesCodegen.cpp

    r264504 r264748  
    48934893        RefPtr<RegisterID> tempRegister = generator.newTemporary();
    48944894
    4895         Ref<Label> superclassIsUndefinedLabel = generator.newLabel();
    4896         generator.emitJumpIfTrue(generator.emitIsUndefined(tempRegister.get(), superclass.get()), superclassIsUndefinedLabel.get());
    4897 
    48984895        Ref<Label> superclassIsNullLabel = generator.newLabel();
    48994896        generator.emitJumpIfTrue(generator.emitIsNull(tempRegister.get(), superclass.get()), superclassIsNullLabel.get());
     
    49014898        Ref<Label> superclassIsConstructorLabel = generator.newLabel();
    49024899        generator.emitJumpIfTrue(generator.emitIsConstructor(tempRegister.get(), superclass.get()), superclassIsConstructorLabel.get());
    4903         generator.emitLabel(superclassIsUndefinedLabel.get());
    49044900        generator.emitThrowTypeError("The superclass is not a constructor."_s);
    49054901        generator.emitLabel(superclassIsConstructorLabel.get());
Note: See TracChangeset for help on using the changeset viewer.