Bug 169647 - BytecodeGenerator should use the same function to determine if it needs to store the DerivedConstructor in an ArrowFunction lexical environment.
Summary: BytecodeGenerator should use the same function to determine if it needs to st...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: WebKit Local Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Mark Lam
URL:
Keywords: InRadar
Depends on:
Blocks: 169832
  Show dependency treegraph
 
Reported: 2017-03-14 17:03 PDT by Mark Lam
Modified: 2017-03-17 13:41 PDT (History)
6 users (show)

See Also:


Attachments
proposed patch. (5.21 KB, patch)
2017-03-14 17:12 PDT, Mark Lam
msaboff: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Mark Lam 2017-03-14 17:03:42 PDT
Patch coming.
Comment 1 Radar WebKit Bug Importer 2017-03-14 17:05:18 PDT
<rdar://problem/31051832>
Comment 2 Mark Lam 2017-03-14 17:12:29 PDT
Created attachment 304447 [details]
proposed patch.
Comment 3 Michael Saboff 2017-03-14 17:15:28 PDT
Comment on attachment 304447 [details]
proposed patch.

r=me
Comment 4 Mark Lam 2017-03-14 17:54:39 PDT
Thanks for the review.  Landed in r213966: <http://trac.webkit.org/r213966>.
Comment 5 Saam Barati 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.
Comment 6 GSkachkov 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.
Comment 7 GSkachkov 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.