Changeset 201176 in webkit
- Timestamp:
- May 19, 2016, 1:09:47 PM (9 years ago)
- Location:
- trunk/Source/JavaScriptCore
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r201172 r201176 1 2016-05-19 Saam barati <sbarati@apple.com> 2 3 arrow function lexical environment should reuse the same environment as the function's lexical environment where possible 4 https://bugs.webkit.org/show_bug.cgi?id=157908 5 6 Reviewed by Filip Pizlo. 7 8 We can safely combine these two environment when we have 9 a simple parameter list (no default parameters, no destructring parameters). 10 11 * bytecompiler/BytecodeGenerator.cpp: 12 (JSC::BytecodeGenerator::BytecodeGenerator): 13 (JSC::BytecodeGenerator::initializeDefaultParameterValuesAndSetupFunctionScopeStack): 14 (JSC::BytecodeGenerator::initializeArrowFunctionContextScopeIfNeeded): 15 * bytecompiler/BytecodeGenerator.h: 16 1 17 2016-05-19 Michael Saboff <msaboff@apple.com> 2 18 -
trunk/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp
r201122 r201176 576 576 577 577 if (needsToUpdateArrowFunctionContext() && !codeBlock->isArrowFunction()) { 578 initializeArrowFunctionContextScopeIfNeeded(); 578 bool canReuseLexicalEnvironment = isSimpleParameterList; 579 initializeArrowFunctionContextScopeIfNeeded(functionSymbolTable, canReuseLexicalEnvironment); 579 580 emitPutThisToArrowFunctionContextScope(); 580 581 emitPutNewTargetToArrowFunctionContextScope(); … … 894 895 } 895 896 896 void BytecodeGenerator::initializeArrowFunctionContextScopeIfNeeded( )897 void BytecodeGenerator::initializeArrowFunctionContextScopeIfNeeded(SymbolTable* functionSymbolTable, bool canReuseLexicalEnvironment) 897 898 { 898 899 ASSERT(!m_arrowFunctionContextLexicalEnvironmentRegister); 900 901 if (canReuseLexicalEnvironment && m_lexicalEnvironmentRegister) { 902 RELEASE_ASSERT(!m_codeBlock->isArrowFunction()); 903 RELEASE_ASSERT(functionSymbolTable); 904 905 m_arrowFunctionContextLexicalEnvironmentRegister = m_lexicalEnvironmentRegister; 906 907 ScopeOffset offset; 908 909 ConcurrentJITLocker locker(ConcurrentJITLocker::NoLockingNecessary); 910 if (isThisUsedInInnerArrowFunction()) { 911 offset = functionSymbolTable->takeNextScopeOffset(locker); 912 functionSymbolTable->set(locker, propertyNames().thisIdentifier.impl(), SymbolTableEntry(VarOffset(offset))); 913 } 914 915 if (m_codeType == FunctionCode && isNewTargetUsedInInnerArrowFunction()) { 916 offset = functionSymbolTable->takeNextScopeOffset(); 917 functionSymbolTable->set(locker, propertyNames().newTargetLocalPrivateName.impl(), SymbolTableEntry(VarOffset(offset))); 918 } 919 920 if (isConstructor() && constructorKind() == ConstructorKind::Derived && isSuperUsedInInnerArrowFunction()) { 921 offset = functionSymbolTable->takeNextScopeOffset(locker); 922 functionSymbolTable->set(locker, propertyNames().derivedConstructorPrivateName.impl(), SymbolTableEntry(VarOffset(offset))); 923 } 924 925 return; 926 } 899 927 900 928 VariableEnvironment environment; -
trunk/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.h
r201122 r201176 859 859 void initializeVarLexicalEnvironment(int symbolTableConstantIndex, SymbolTable* functionSymbolTable, bool hasCapturedVariables); 860 860 void initializeDefaultParameterValuesAndSetupFunctionScopeStack(FunctionParameters&, bool isSimpleParameterList, FunctionNode*, SymbolTable*, int symbolTableConstantIndex, const std::function<bool (UniquedStringImpl*)>& captures, bool shouldCreateArgumentsVariableInParameterScope); 861 void initializeArrowFunctionContextScopeIfNeeded( );861 void initializeArrowFunctionContextScopeIfNeeded(SymbolTable* functionSymbolTable = nullptr, bool canReuseLexicalEnvironment = false); 862 862 863 863 public:
Note:
See TracChangeset
for help on using the changeset viewer.