Bug 169647

Summary: BytecodeGenerator should use the same function to determine if it needs to store the DerivedConstructor in an ArrowFunction lexical environment.
Product: WebKit Reporter: Mark Lam <mark.lam>
Component: JavaScriptCoreAssignee: Mark Lam <mark.lam>
Status: RESOLVED FIXED    
Severity: Normal CC: commit-queue, gskachkov, keith_miller, msaboff, saam, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Local Build   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on:    
Bug Blocks: 169832    
Attachments:
Description Flags
proposed patch. msaboff: review+

Mark Lam
Reported 2017-03-14 17:03:42 PDT
Patch coming.
Attachments
proposed patch. (5.21 KB, patch)
2017-03-14 17:12 PDT, Mark Lam
msaboff: review+
Radar WebKit Bug Importer
Comment 1 2017-03-14 17:05:18 PDT
Mark Lam
Comment 2 2017-03-14 17:12:29 PDT
Created attachment 304447 [details] proposed patch.
Michael Saboff
Comment 3 2017-03-14 17:15:28 PDT
Comment on attachment 304447 [details] proposed patch. r=me
Mark Lam
Comment 4 2017-03-14 17:54:39 PDT
Thanks for the review. Landed in r213966: <http://trac.webkit.org/r213966>.
Saam Barati
Comment 5 2017-03-15 09:50:11 PDT
Comment on attachment 304447 [details] proposed patch. View in context: https://bugs.webkit.org/attachment.cgi?id=304447&action=review > Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp:1036 > + if ((isConstructor() && constructorKind() == ConstructorKind::Extends) || m_codeBlock->isClassContext()) { I wonder about the first part of this check: It seems like: (isConstructor() && kind == Extends) => isClassContext So perhaps checking it is redundant. But I'm basing this off our naming scheme. I'd have to look more closely at the code to know for sure.
GSkachkov
Comment 6 2017-03-16 11:09:15 PDT
Comment on attachment 304447 [details] proposed patch. View in context: https://bugs.webkit.org/attachment.cgi?id=304447&action=review >> Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp:1036 >> + if ((isConstructor() && constructorKind() == ConstructorKind::Extends) || m_codeBlock->isClassContext()) { > > I wonder about the first part of this check: > It seems like: (isConstructor() && kind == Extends) => isClassContext > So perhaps checking it is redundant. But I'm basing this off our naming scheme. I'd have to look more closely at the code to know for sure. Yeah, it seems that condition '(isConstructor() && constructorKind() == ConstructorKind::Extends)' is already covered by m_codeBlock->isClassContext(). Unfortunately I'll manage to check this condition only this weekend (currently very busy on job), if it unnecessary I'll create issue and provide patch.
GSkachkov
Comment 7 2017-03-17 13:36:44 PDT
Comment on attachment 304447 [details] proposed patch. View in context: https://bugs.webkit.org/attachment.cgi?id=304447&action=review >>> Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp:1036 >>> + if ((isConstructor() && constructorKind() == ConstructorKind::Extends) || m_codeBlock->isClassContext()) { >> >> I wonder about the first part of this check: >> It seems like: (isConstructor() && kind == Extends) => isClassContext >> So perhaps checking it is redundant. But I'm basing this off our naming scheme. I'd have to look more closely at the code to know for sure. > > Yeah, it seems that condition '(isConstructor() && constructorKind() == ConstructorKind::Extends)' is already covered by m_codeBlock->isClassContext(). > Unfortunately I'll manage to check this condition only this weekend (currently very busy on job), if it unnecessary I'll create issue and provide patch. You are right, isConstructor() && constructorKind() == ConstructorKind::Extends is covered by m_codeBlock->isClassContext(). isClassContext is just executable->superBinding() == SuperBinding::Needed; also I've checked Parser.cpp and found out following lines in parserFunctionInfo: if (m_defaultConstructorKind != ConstructorKind::None) { constructorKind = m_defaultConstructorKind; expectedSuperBinding = m_defaultConstructorKind == ConstructorKind::Extends ? SuperBinding::Needed : SuperBinding::NotNeeded; } From that I made conclusion that function that is constructor already has value isClassContext, so I'll prepare patch to remove condition.
Note You need to log in before you can comment on or make changes to this bug.