Changeset 213966 in webkit
- Timestamp:
- Mar 14, 2017 5:53:17 PM (7 years ago)
- Location:
- trunk/Source/JavaScriptCore
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r213960 r213966 1 2017-03-14 Mark Lam <mark.lam@apple.com> 2 3 BytecodeGenerator should use the same function to determine if it needs to store the DerivedConstructor in an ArrowFunction lexical environment. 4 https://bugs.webkit.org/show_bug.cgi?id=169647 5 <rdar://problem/31051832> 6 7 Reviewed by Michael Saboff. 8 9 * bytecompiler/BytecodeGenerator.cpp: 10 (JSC::BytecodeGenerator::usesDerivedConstructorInArrowFunctionLexicalEnvironment): 11 (JSC::BytecodeGenerator::initializeArrowFunctionContextScopeIfNeeded): 12 (JSC::BytecodeGenerator::emitPutDerivedConstructorToArrowFunctionContextScope): 13 * bytecompiler/BytecodeGenerator.h: 14 1 15 2017-03-14 Brian Burg <bburg@apple.com> 2 16 -
trunk/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp
r213697 r213966 1032 1032 } 1033 1033 1034 bool BytecodeGenerator::needsDerivedConstructorInArrowFunctionLexicalEnvironment() 1035 { 1036 if ((isConstructor() && constructorKind() == ConstructorKind::Extends) || m_codeBlock->isClassContext()) { 1037 if (isSuperUsedInInnerArrowFunction()) 1038 return true; 1039 } 1040 return false; 1041 } 1042 1034 1043 void BytecodeGenerator::initializeArrowFunctionContextScopeIfNeeded(SymbolTable* functionSymbolTable, bool canReuseLexicalEnvironment) 1035 1044 { … … 1054 1063 } 1055 1064 1056 if ( isConstructor() && constructorKind() == ConstructorKind::Extends && isSuperUsedInInnerArrowFunction()) {1065 if (needsDerivedConstructorInArrowFunctionLexicalEnvironment()) { 1057 1066 offset = functionSymbolTable->takeNextScopeOffset(NoLockingNecessary); 1058 1067 functionSymbolTable->set(NoLockingNecessary, propertyNames().builtinNames().derivedConstructorPrivateName().impl(), SymbolTableEntry(VarOffset(offset))); … … 1076 1085 } 1077 1086 1078 if ( isConstructor() && constructorKind() == ConstructorKind::Extends && isSuperUsedInInnerArrowFunction()) {1087 if (needsDerivedConstructorInArrowFunctionLexicalEnvironment()) { 1079 1088 auto derivedConstructor = environment.add(propertyNames().builtinNames().derivedConstructorPrivateName()); 1080 1089 derivedConstructor.iterator->value.setIsCaptured(); … … 4571 4580 void BytecodeGenerator::emitPutDerivedConstructorToArrowFunctionContextScope() 4572 4581 { 4573 if ((isConstructor() && constructorKind() == ConstructorKind::Extends) || m_codeBlock->isClassContext()) { 4574 if (isSuperUsedInInnerArrowFunction()) { 4575 ASSERT(m_arrowFunctionContextLexicalEnvironmentRegister); 4576 4577 Variable protoScope = variable(propertyNames().builtinNames().derivedConstructorPrivateName()); 4578 emitPutToScope(m_arrowFunctionContextLexicalEnvironmentRegister, protoScope, &m_calleeRegister, DoNotThrowIfNotFound, InitializationMode::Initialization); 4579 } 4582 if (needsDerivedConstructorInArrowFunctionLexicalEnvironment()) { 4583 ASSERT(m_arrowFunctionContextLexicalEnvironmentRegister); 4584 4585 Variable protoScope = variable(propertyNames().builtinNames().derivedConstructorPrivateName()); 4586 emitPutToScope(m_arrowFunctionContextLexicalEnvironmentRegister, protoScope, &m_calleeRegister, DoNotThrowIfNotFound, InitializationMode::Initialization); 4580 4587 } 4581 4588 } -
trunk/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.h
r213697 r213966 1026 1026 void initializeDefaultParameterValuesAndSetupFunctionScopeStack(FunctionParameters&, bool isSimpleParameterList, FunctionNode*, SymbolTable*, int symbolTableConstantIndex, const std::function<bool (UniquedStringImpl*)>& captures, bool shouldCreateArgumentsVariableInParameterScope); 1027 1027 void initializeArrowFunctionContextScopeIfNeeded(SymbolTable* functionSymbolTable = nullptr, bool canReuseLexicalEnvironment = false); 1028 bool needsDerivedConstructorInArrowFunctionLexicalEnvironment(); 1028 1029 1029 1030 public:
Note: See TracChangeset
for help on using the changeset viewer.