Title: [214516] branches/safari-603-branch/Source/_javascript_Core

Diff

Modified: branches/safari-603-branch/Source/_javascript_Core/ChangeLog (214515 => 214516)


--- branches/safari-603-branch/Source/_javascript_Core/ChangeLog	2017-03-29 03:28:05 UTC (rev 214515)
+++ branches/safari-603-branch/Source/_javascript_Core/ChangeLog	2017-03-29 03:28:08 UTC (rev 214516)
@@ -1,3 +1,21 @@
+2017-03-28  Jason Marcell  <[email protected]>
+
+        Merge r213966. rdar://problem/31178551
+
+    2017-03-14  Mark Lam  <[email protected]>
+
+            BytecodeGenerator should use the same function to determine if it needs to store the DerivedConstructor in an ArrowFunction lexical environment.
+            https://bugs.webkit.org/show_bug.cgi?id=169647
+            <rdar://problem/31051832>
+
+            Reviewed by Michael Saboff.
+
+            * bytecompiler/BytecodeGenerator.cpp:
+            (JSC::BytecodeGenerator::usesDerivedConstructorInArrowFunctionLexicalEnvironment):
+            (JSC::BytecodeGenerator::initializeArrowFunctionContextScopeIfNeeded):
+            (JSC::BytecodeGenerator::emitPutDerivedConstructorToArrowFunctionContextScope):
+            * bytecompiler/BytecodeGenerator.h:
+
 2017-03-17  Jason Marcell  <[email protected]>
 
         Merge r214079. rdar://problem/31116372

Modified: branches/safari-603-branch/Source/_javascript_Core/bytecompiler/BytecodeGenerator.cpp (214515 => 214516)


--- branches/safari-603-branch/Source/_javascript_Core/bytecompiler/BytecodeGenerator.cpp	2017-03-29 03:28:05 UTC (rev 214515)
+++ branches/safari-603-branch/Source/_javascript_Core/bytecompiler/BytecodeGenerator.cpp	2017-03-29 03:28:08 UTC (rev 214516)
@@ -1030,6 +1030,15 @@
     }
 }
 
+bool BytecodeGenerator::needsDerivedConstructorInArrowFunctionLexicalEnvironment()
+{
+    if ((isConstructor() && constructorKind() == ConstructorKind::Extends) || m_codeBlock->isClassContext()) {
+        if (isSuperUsedInInnerArrowFunction())
+            return true;
+    }
+    return false;
+}
+
 void BytecodeGenerator::initializeArrowFunctionContextScopeIfNeeded(SymbolTable* functionSymbolTable, bool canReuseLexicalEnvironment)
 {
     ASSERT(!m_arrowFunctionContextLexicalEnvironmentRegister);
@@ -1052,7 +1061,7 @@
             functionSymbolTable->set(NoLockingNecessary, propertyNames().builtinNames().newTargetLocalPrivateName().impl(), SymbolTableEntry(VarOffset(offset)));
         }
         
-        if (isConstructor() && constructorKind() == ConstructorKind::Extends && isSuperUsedInInnerArrowFunction()) {
+        if (needsDerivedConstructorInArrowFunctionLexicalEnvironment()) {
             offset = functionSymbolTable->takeNextScopeOffset(NoLockingNecessary);
             functionSymbolTable->set(NoLockingNecessary, propertyNames().builtinNames().derivedConstructorPrivateName().impl(), SymbolTableEntry(VarOffset(offset)));
         }
@@ -1074,7 +1083,7 @@
         addTarget.iterator->value.setIsLet();
     }
 
-    if (isConstructor() && constructorKind() == ConstructorKind::Extends && isSuperUsedInInnerArrowFunction()) {
+    if (needsDerivedConstructorInArrowFunctionLexicalEnvironment()) {
         auto derivedConstructor = environment.add(propertyNames().builtinNames().derivedConstructorPrivateName());
         derivedConstructor.iterator->value.setIsCaptured();
         derivedConstructor.iterator->value.setIsLet();
@@ -4662,13 +4671,11 @@
     
 void BytecodeGenerator::emitPutDerivedConstructorToArrowFunctionContextScope()
 {
-    if ((isConstructor() && constructorKind() == ConstructorKind::Extends) || m_codeBlock->isClassContext()) {
-        if (isSuperUsedInInnerArrowFunction()) {
-            ASSERT(m_arrowFunctionContextLexicalEnvironmentRegister);
-            
-            Variable protoScope = variable(propertyNames().builtinNames().derivedConstructorPrivateName());
-            emitPutToScope(m_arrowFunctionContextLexicalEnvironmentRegister, protoScope, &m_calleeRegister, DoNotThrowIfNotFound, InitializationMode::Initialization);
-        }
+    if (needsDerivedConstructorInArrowFunctionLexicalEnvironment()) {
+        ASSERT(m_arrowFunctionContextLexicalEnvironmentRegister);
+
+        Variable protoScope = variable(propertyNames().builtinNames().derivedConstructorPrivateName());
+        emitPutToScope(m_arrowFunctionContextLexicalEnvironmentRegister, protoScope, &m_calleeRegister, DoNotThrowIfNotFound, InitializationMode::Initialization);
     }
 }
 

Modified: branches/safari-603-branch/Source/_javascript_Core/bytecompiler/BytecodeGenerator.h (214515 => 214516)


--- branches/safari-603-branch/Source/_javascript_Core/bytecompiler/BytecodeGenerator.h	2017-03-29 03:28:05 UTC (rev 214515)
+++ branches/safari-603-branch/Source/_javascript_Core/bytecompiler/BytecodeGenerator.h	2017-03-29 03:28:08 UTC (rev 214516)
@@ -882,6 +882,7 @@
         void initializeVarLexicalEnvironment(int symbolTableConstantIndex, SymbolTable* functionSymbolTable, bool hasCapturedVariables);
         void initializeDefaultParameterValuesAndSetupFunctionScopeStack(FunctionParameters&, bool isSimpleParameterList, FunctionNode*, SymbolTable*, int symbolTableConstantIndex, const std::function<bool (UniquedStringImpl*)>& captures, bool shouldCreateArgumentsVariableInParameterScope);
         void initializeArrowFunctionContextScopeIfNeeded(SymbolTable* functionSymbolTable = nullptr, bool canReuseLexicalEnvironment = false);
+        bool needsDerivedConstructorInArrowFunctionLexicalEnvironment();
 
     public:
         JSString* addStringConstant(const Identifier&);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to