Changeset 194449 in webkit
- Timestamp:
- Dec 30, 2015 1:08:16 PM (8 years ago)
- Location:
- trunk
- Files:
-
- 4 added
- 19 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r194441 r194449 1 2015-12-30 Skachkov Oleksandr <gskachkov@gmail.com> 2 3 [ES6] Arrow function syntax. Arrow function specific features. Lexical bind "super" 4 https://bugs.webkit.org/show_bug.cgi?id=149615 5 6 Reviewed by Saam Barati. 7 8 * js/arrowfunction-superproperty-expected.txt: Added. 9 * js/arrowfunction-superproperty.html: Added. 10 * js/script-tests/arrowfunction-superproperty.js: Added. 11 1 12 2015-12-29 Andy VanWagoner <andy@instructure.com> 2 13 -
trunk/Source/JavaScriptCore/ChangeLog
r194436 r194449 1 2015-12-30 Aleksandr Skachkov <gskachkov@gmail.com> 2 3 [ES6] Arrow function syntax. Arrow function specific features. Lexical bind "super" 4 https://bugs.webkit.org/show_bug.cgi?id=149615 5 6 Reviewed by Saam Barati. 7 8 Implemented lexical bind "super" property for arrow function. 'super' property can be accessed 9 inside of the arrow function in case if arrow function is nested in constructor, method, 10 getter or setter of class. In current patch using 'super' in arrow function, that declared out of the 11 class, lead to wrong type of error, should be SyntaxError(https://bugs.webkit.org/show_bug.cgi?id=150893) 12 and this will be fixed in separete patch. 13 14 * builtins/BuiltinExecutables.cpp: 15 (JSC::createExecutableInternal): 16 * bytecode/EvalCodeCache.h: 17 (JSC::EvalCodeCache::getSlow): 18 * bytecode/ExecutableInfo.h: 19 (JSC::ExecutableInfo::ExecutableInfo): 20 (JSC::ExecutableInfo::derivedContextType): 21 (JSC::ExecutableInfo::isClassContext): 22 * bytecode/UnlinkedCodeBlock.cpp: 23 (JSC::UnlinkedCodeBlock::UnlinkedCodeBlock): 24 * bytecode/UnlinkedCodeBlock.h: 25 (JSC::UnlinkedCodeBlock::derivedContextType): 26 (JSC::UnlinkedCodeBlock::isClassContext): 27 * bytecode/UnlinkedFunctionExecutable.cpp: 28 (JSC::generateUnlinkedFunctionCodeBlock): 29 (JSC::UnlinkedFunctionExecutable::UnlinkedFunctionExecutable): 30 * bytecode/UnlinkedFunctionExecutable.h: 31 * bytecompiler/BytecodeGenerator.cpp: 32 (JSC::BytecodeGenerator::BytecodeGenerator): 33 (JSC::BytecodeGenerator::emitPutDerivedConstructorToArrowFunctionContextScope): 34 * bytecompiler/BytecodeGenerator.h: 35 (JSC::BytecodeGenerator::derivedContextType): 36 (JSC::BytecodeGenerator::isDerivedConstructorContext): 37 (JSC::BytecodeGenerator::isDerivedClassContext): 38 (JSC::BytecodeGenerator::isArrowFunction): 39 (JSC::BytecodeGenerator::makeFunction): 40 * bytecompiler/NodesCodegen.cpp: 41 (JSC::emitHomeObjectForCallee): 42 (JSC::FunctionCallValueNode::emitBytecode): 43 * debugger/DebuggerCallFrame.cpp: 44 (JSC::DebuggerCallFrame::evaluate): 45 * interpreter/Interpreter.cpp: 46 (JSC::eval): 47 * runtime/CodeCache.cpp: 48 (JSC::CodeCache::getFunctionExecutableFromGlobalCode): 49 * runtime/Executable.cpp: 50 (JSC::ScriptExecutable::ScriptExecutable): 51 (JSC::EvalExecutable::create): 52 (JSC::EvalExecutable::EvalExecutable): 53 (JSC::ProgramExecutable::ProgramExecutable): 54 (JSC::ModuleProgramExecutable::ModuleProgramExecutable): 55 (JSC::FunctionExecutable::FunctionExecutable): 56 * runtime/Executable.h: 57 (JSC::ScriptExecutable::derivedContextType): 58 * runtime/JSGlobalObjectFunctions.cpp: 59 (JSC::globalFuncEval): 60 * tests/es6.yaml: 61 * tests/stress/arrowfunction-lexical-bind-superproperty.js: Added. 62 1 63 2015-12-29 Yusuke Suzuki <utatane.tea@gmail.com> 2 64 -
trunk/Source/JavaScriptCore/builtins/BuiltinExecutables.cpp
r194435 r194449 116 116 metadata->overrideName(name); 117 117 VariableEnvironment dummyTDZVariables; 118 UnlinkedFunctionExecutable* functionExecutable = UnlinkedFunctionExecutable::create(&vm, source, metadata, kind, constructAbility, dummyTDZVariables, false, WTF::move(sourceOverride));118 UnlinkedFunctionExecutable* functionExecutable = UnlinkedFunctionExecutable::create(&vm, source, metadata, kind, constructAbility, dummyTDZVariables, DerivedContextType::None, WTF::move(sourceOverride)); 119 119 functionExecutable->setNameValue(vm, jsString(&vm, name.string())); 120 120 return functionExecutable; -
trunk/Source/JavaScriptCore/bytecode/EvalCodeCache.h
r193766 r194449 56 56 } 57 57 58 EvalExecutable* getSlow(ExecState* exec, JSCell* owner, bool inStrictContext, ThisTDZMode thisTDZMode, bool isDerivedConstructorContext, bool isArrowFunctionContext, const SourceCode& evalSource, JSScope* scope)58 EvalExecutable* getSlow(ExecState* exec, JSCell* owner, bool inStrictContext, ThisTDZMode thisTDZMode, DerivedContextType derivedContextType, bool isArrowFunctionContext, const SourceCode& evalSource, JSScope* scope) 59 59 { 60 60 VariableEnvironment variablesUnderTDZ; 61 61 JSScope::collectVariablesUnderTDZ(scope, variablesUnderTDZ); 62 EvalExecutable* evalExecutable = EvalExecutable::create(exec, evalSource, inStrictContext, thisTDZMode, isDerivedConstructorContext, isArrowFunctionContext, &variablesUnderTDZ);62 EvalExecutable* evalExecutable = EvalExecutable::create(exec, evalSource, inStrictContext, thisTDZMode, derivedContextType, isArrowFunctionContext, &variablesUnderTDZ); 63 63 64 64 if (!evalExecutable) -
trunk/Source/JavaScriptCore/bytecode/ExecutableInfo.h
r194435 r194449 30 30 31 31 namespace JSC { 32 33 enum class DerivedContextType { None, DerivedConstructorContext, DerivedMethodContext }; 32 34 33 35 // FIXME: These flags, ParserModes and propagation to XXXCodeBlocks should be reorganized. 34 36 // https://bugs.webkit.org/show_bug.cgi?id=151547 35 37 struct ExecutableInfo { 36 ExecutableInfo(bool needsActivation, bool usesEval, bool isStrictMode, bool isConstructor, bool isBuiltinFunction, ConstructorKind constructorKind, SuperBinding superBinding, SourceParseMode parseMode, bool isDerivedConstructorContext, bool isArrowFunctionContext)38 ExecutableInfo(bool needsActivation, bool usesEval, bool isStrictMode, bool isConstructor, bool isBuiltinFunction, ConstructorKind constructorKind, SuperBinding superBinding, SourceParseMode parseMode, DerivedContextType derivedContextType, bool isArrowFunctionContext, bool isClassContext) 37 39 : m_needsActivation(needsActivation) 38 40 , m_usesEval(usesEval) … … 43 45 , m_superBinding(static_cast<unsigned>(superBinding)) 44 46 , m_parseMode(parseMode) 45 , m_ isDerivedConstructorContext(isDerivedConstructorContext)47 , m_derivedContextType(static_cast<unsigned>(derivedContextType)) 46 48 , m_isArrowFunctionContext(isArrowFunctionContext) 49 , m_isClassContext(isClassContext) 47 50 { 48 51 ASSERT(m_constructorKind == static_cast<unsigned>(constructorKind)); … … 58 61 SuperBinding superBinding() const { return static_cast<SuperBinding>(m_superBinding); } 59 62 SourceParseMode parseMode() const { return m_parseMode; } 60 bool isDerivedConstructorContext() const { return m_isDerivedConstructorContext; }63 DerivedContextType derivedContextType() const { return static_cast<DerivedContextType>(m_derivedContextType); } 61 64 bool isArrowFunctionContext() const { return m_isArrowFunctionContext; } 65 bool isClassContext() const { return m_isClassContext; } 62 66 63 67 private: … … 70 74 unsigned m_superBinding : 1; 71 75 SourceParseMode m_parseMode; 72 unsigned m_ isDerivedConstructorContext : 1;76 unsigned m_derivedContextType : 2; 73 77 unsigned m_isArrowFunctionContext : 1; 78 unsigned m_isClassContext : 1; 74 79 }; 75 80 -
trunk/Source/JavaScriptCore/bytecode/UnlinkedCodeBlock.cpp
r194435 r194449 67 67 , m_constructorKind(static_cast<unsigned>(info.constructorKind())) 68 68 , m_superBinding(static_cast<unsigned>(info.superBinding())) 69 , m_ isDerivedConstructorContext(info.isDerivedConstructorContext())69 , m_derivedContextType(static_cast<unsigned>(info.derivedContextType())) 70 70 , m_isArrowFunctionContext(info.isArrowFunctionContext()) 71 , m_isClassContext(info.isClassContext()) 71 72 , m_firstLine(0) 72 73 , m_lineCount(0) -
trunk/Source/JavaScriptCore/bytecode/UnlinkedCodeBlock.h
r194435 r194449 120 120 SourceParseMode parseMode() const { return m_parseMode; } 121 121 bool isArrowFunction() const { return m_parseMode == SourceParseMode::ArrowFunctionMode; } 122 bool isDerivedConstructorContext() const { return m_isDerivedConstructorContext; }122 DerivedContextType derivedContextType() const { return static_cast<DerivedContextType>(m_derivedContextType); } 123 123 bool isArrowFunctionContext() const { return m_isArrowFunctionContext; } 124 bool isClassContext() const { return m_isClassContext; } 124 125 125 126 bool needsFullScopeChain() const { return m_needsFullScopeChain; } … … 394 395 unsigned m_constructorKind : 2; 395 396 unsigned m_superBinding : 1; 396 unsigned m_ isDerivedConstructorContext : 1;397 unsigned m_derivedContextType : 2; 397 398 unsigned m_isArrowFunctionContext : 1; 398 399 unsigned m_isClassContext : 1; 399 400 unsigned m_firstLine; 400 401 unsigned m_lineCount; -
trunk/Source/JavaScriptCore/bytecode/UnlinkedFunctionExecutable.cpp
r194435 r194449 66 66 function->finishParsing(executable->name(), executable->functionMode()); 67 67 executable->recordParse(function->features(), function->hasCapturedVariables()); 68 68 69 bool isClassContext = executable->superBinding() == SuperBinding::Needed; 70 69 71 UnlinkedFunctionCodeBlock* result = UnlinkedFunctionCodeBlock::create(&vm, FunctionCode, 70 ExecutableInfo(function->needsActivation(), function->usesEval(), function->isStrictMode(), kind == CodeForConstruct, functionKind == UnlinkedBuiltinFunction, executable->constructorKind(), executable->superBinding(), parseMode, executable->isDerivedConstructorContext(), false));72 ExecutableInfo(function->needsActivation(), function->usesEval(), function->isStrictMode(), kind == CodeForConstruct, functionKind == UnlinkedBuiltinFunction, executable->constructorKind(), executable->superBinding(), parseMode, executable->derivedContextType(), false, isClassContext)); 71 73 72 74 auto generator(std::make_unique<BytecodeGenerator>(vm, function.get(), result, debuggerMode, profilerMode, executable->parentScopeTDZVariables())); … … 77 79 } 78 80 79 UnlinkedFunctionExecutable::UnlinkedFunctionExecutable(VM* vm, Structure* structure, const SourceCode& source, RefPtr<SourceProvider>&& sourceOverride, FunctionMetadataNode* node, UnlinkedFunctionKind kind, ConstructAbility constructAbility, VariableEnvironment& parentScopeTDZVariables, bool isDerivedConstructorContext)81 UnlinkedFunctionExecutable::UnlinkedFunctionExecutable(VM* vm, Structure* structure, const SourceCode& source, RefPtr<SourceProvider>&& sourceOverride, FunctionMetadataNode* node, UnlinkedFunctionKind kind, ConstructAbility constructAbility, VariableEnvironment& parentScopeTDZVariables, DerivedContextType derivedContextType) 80 82 : Base(*vm, structure) 81 83 , m_name(node->ident()) … … 102 104 , m_functionMode(node->functionMode()) 103 105 , m_superBinding(static_cast<unsigned>(node->superBinding())) 104 , m_ isDerivedConstructorContext(isDerivedConstructorContext)106 , m_derivedContextType(static_cast<unsigned>(derivedContextType)) 105 107 { 106 108 ASSERT(m_constructorKind == static_cast<unsigned>(node->constructorKind())); -
trunk/Source/JavaScriptCore/bytecode/UnlinkedFunctionExecutable.h
r194435 r194449 31 31 #include "CodeType.h" 32 32 #include "ConstructAbility.h" 33 #include "ExecutableInfo.h" 33 34 #include "ExpressionRangeInfo.h" 34 35 #include "HandlerInfo.h" … … 66 67 static const unsigned StructureFlags = Base::StructureFlags | StructureIsImmortal; 67 68 68 static UnlinkedFunctionExecutable* create(VM* vm, const SourceCode& source, FunctionMetadataNode* node, UnlinkedFunctionKind unlinkedFunctionKind, ConstructAbility constructAbility, VariableEnvironment& parentScopeTDZVariables, bool isDerivedConstructorContext, RefPtr<SourceProvider>&& sourceOverride = nullptr)69 static UnlinkedFunctionExecutable* create(VM* vm, const SourceCode& source, FunctionMetadataNode* node, UnlinkedFunctionKind unlinkedFunctionKind, ConstructAbility constructAbility, VariableEnvironment& parentScopeTDZVariables, DerivedContextType derivedContextType, RefPtr<SourceProvider>&& sourceOverride = nullptr) 69 70 { 70 71 UnlinkedFunctionExecutable* instance = new (NotNull, allocateCell<UnlinkedFunctionExecutable>(vm->heap)) 71 UnlinkedFunctionExecutable(vm, vm->unlinkedFunctionExecutableStructure.get(), source, WTF::move(sourceOverride), node, unlinkedFunctionKind, constructAbility, parentScopeTDZVariables, isDerivedConstructorContext);72 UnlinkedFunctionExecutable(vm, vm->unlinkedFunctionExecutableStructure.get(), source, WTF::move(sourceOverride), node, unlinkedFunctionKind, constructAbility, parentScopeTDZVariables, derivedContextType); 72 73 instance->finishCreation(*vm); 73 74 return instance; … … 129 130 130 131 bool isArrowFunction() const { return m_parseMode == SourceParseMode::ArrowFunctionMode; } 131 bool isDerivedConstructorContext() const {return m_isDerivedConstructorContext; }132 132 133 JSC::DerivedContextType derivedContextType() const {return static_cast<JSC::DerivedContextType>(m_derivedContextType); } 134 133 135 private: 134 UnlinkedFunctionExecutable(VM*, Structure*, const SourceCode&, RefPtr<SourceProvider>&& sourceOverride, FunctionMetadataNode*, UnlinkedFunctionKind, ConstructAbility, VariableEnvironment&, bool isDerivedConstructorContext);135 136 UnlinkedFunctionExecutable(VM*, Structure*, const SourceCode&, RefPtr<SourceProvider>&& sourceOverride, FunctionMetadataNode*, UnlinkedFunctionKind, ConstructAbility, VariableEnvironment&, JSC::DerivedContextType); 137 136 138 WriteBarrier<UnlinkedFunctionCodeBlock> m_unlinkedCodeBlockForCall; 137 139 WriteBarrier<UnlinkedFunctionCodeBlock> m_unlinkedCodeBlockForConstruct; … … 164 166 unsigned m_functionMode : 1; // FunctionMode 165 167 unsigned m_superBinding : 1; 166 unsigned m_ isDerivedConstructorContext : 1;168 unsigned m_derivedContextType: 2; 167 169 168 170 protected: -
trunk/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp
r194435 r194449 158 158 , m_codeType(GlobalCode) 159 159 , m_vm(&vm) 160 , m_isDerivedConstructorContext(false)161 160 , m_needsToUpdateArrowFunctionContext(programNode->usesArrowFunction() || programNode->usesEval()) 162 161 { … … 212 211 // https://bugs.webkit.org/show_bug.cgi?id=148819 213 212 , m_inTailPosition(Options::useTailCalls() && !isConstructor() && constructorKind() == ConstructorKind::None && isStrictMode() && !m_shouldEmitProfileHooks) 214 , m_isDerivedConstructorContext(codeBlock->isDerivedConstructorContext())215 213 , m_needsToUpdateArrowFunctionContext(functionNode->usesArrowFunction() || functionNode->usesEval()) 214 , m_derivedContextType(codeBlock->derivedContextType()) 216 215 { 217 216 for (auto& constantRegister : m_linkTimeConstantRegisters) … … 572 571 // because that function sets up the SymbolTable stack and emitLoadThisFromArrowFunctionLexicalEnvironment() 573 572 // consults the SymbolTable stack 574 if ( parseMode == SourceParseMode::ArrowFunctionMode && functionNode->usesThis())573 if (SourceParseMode::ArrowFunctionMode == parseMode && (functionNode->usesThis() || isDerivedClassContext() || isDerivedConstructorContext())) 575 574 emitLoadThisFromArrowFunctionLexicalEnvironment(); 576 575 577 576 if (needsToUpdateArrowFunctionContext() && !codeBlock->isArrowFunction()) { 578 577 initializeArrowFunctionContextScopeIfNeeded(functionSymbolTable); … … 594 593 , m_vm(&vm) 595 594 , m_usesNonStrictEval(codeBlock->usesEval() && !codeBlock->isStrictMode()) 596 , m_isDerivedConstructorContext(codeBlock->isDerivedConstructorContext())597 595 , m_needsToUpdateArrowFunctionContext(evalNode->usesArrowFunction() || evalNode->usesEval()) 596 , m_derivedContextType(codeBlock->derivedContextType()) 598 597 { 599 598 for (auto& constantRegister : m_linkTimeConstantRegisters) … … 645 644 , m_vm(&vm) 646 645 , m_usesNonStrictEval(false) 647 , m_isDerivedConstructorContext(false)648 646 , m_needsToUpdateArrowFunctionContext(moduleProgramNode->usesArrowFunction() || moduleProgramNode->usesEval()) 649 647 { … … 4048 4046 void BytecodeGenerator::emitPutDerivedConstructorToArrowFunctionContextScope() 4049 4047 { 4050 if ( isConstructor() && constructorKind() == ConstructorKind::Derived) {4048 if ((isConstructor() && constructorKind() == ConstructorKind::Derived) || m_codeBlock->isClassContext()) { 4051 4049 ASSERT(m_arrowFunctionContextLexicalEnvironmentRegister); 4052 4050 … … 4055 4053 } 4056 4054 } 4057 4055 4058 4056 void BytecodeGenerator::emitPutThisToArrowFunctionContextScope() 4059 4057 { -
trunk/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.h
r194435 r194449 282 282 283 283 bool isConstructor() const { return m_codeBlock->isConstructor(); } 284 bool isDerivedConstructorContext() const { return m_codeBlock->isDerivedConstructorContext(); }284 DerivedContextType derivedContextType() const { return m_derivedContextType; } 285 285 bool usesArrowFunction() const { return m_scopeNode->usesArrowFunction(); } 286 286 bool needsToUpdateArrowFunctionContext() const { return m_needsToUpdateArrowFunctionContext; } … … 698 698 699 699 OpcodeID lastOpcodeID() const { return m_lastOpcodeID; } 700 701 bool isDerivedConstructorContext() { return m_derivedContextType == DerivedContextType::DerivedConstructorContext; } 702 bool isDerivedClassContext() { return m_derivedContextType == DerivedContextType::DerivedMethodContext; } 703 bool isArrowFunction() { return m_codeBlock->isArrowFunction(); } 700 704 701 705 enum class TDZCheckOptimization { Optimize, DoNotOptimize }; … … 795 799 UnlinkedFunctionExecutable* makeFunction(FunctionMetadataNode* metadata) 796 800 { 797 bool newisDerivedConstructorContext = constructorKind() == ConstructorKind::Derived || (m_isDerivedConstructorContext && metadata->parseMode() == SourceParseMode::ArrowFunctionMode); 801 DerivedContextType newDerivedContextType = DerivedContextType::None; 802 803 if (metadata->parseMode() == SourceParseMode::ArrowFunctionMode) { 804 if (constructorKind() == ConstructorKind::Derived || isDerivedConstructorContext()) 805 newDerivedContextType = DerivedContextType::DerivedConstructorContext; 806 else if (m_codeBlock->isClassContext() || isDerivedClassContext()) 807 newDerivedContextType = DerivedContextType::DerivedMethodContext; 808 } 798 809 799 810 VariableEnvironment variablesUnderTDZ; … … 809 820 constructAbility = ConstructAbility::CannotConstruct; 810 821 811 return UnlinkedFunctionExecutable::create(m_vm, m_scopeNode->source(), metadata, isBuiltinFunction() ? UnlinkedBuiltinFunction : UnlinkedNormalFunction, constructAbility, variablesUnderTDZ, new isDerivedConstructorContext);822 return UnlinkedFunctionExecutable::create(m_vm, m_scopeNode->source(), metadata, isBuiltinFunction() ? UnlinkedBuiltinFunction : UnlinkedNormalFunction, constructAbility, variablesUnderTDZ, newDerivedContextType); 812 823 } 813 824 … … 919 930 bool m_usesNonStrictEval { false }; 920 931 bool m_inTailPosition { false }; 921 bool m_isDerivedConstructorContext { false };922 932 bool m_needsToUpdateArrowFunctionContext; 923 933 bool m_isNewTargetLoadedInArrowFunction { false }; 934 DerivedContextType m_derivedContextType { DerivedContextType::None }; 924 935 }; 925 936 -
trunk/Source/JavaScriptCore/bytecompiler/NodesCodegen.cpp
r194435 r194449 174 174 RegisterID callee; 175 175 callee.setIndex(JSStack::Callee); 176 177 176 return generator.emitGetById(generator.finalDestination(dst), &callee, generator.propertyNames().underscoreProto); 178 177 } … … 180 179 static RegisterID* emitHomeObjectForCallee(BytecodeGenerator& generator) 181 180 { 181 if (generator.isDerivedClassContext() || generator.isDerivedConstructorContext()) { 182 RegisterID* derivedConstructor = generator.emitLoadDerivedConstructorFromArrowFunctionLexicalEnvironment(); 183 return generator.emitGetById(generator.newTemporary(), derivedConstructor, generator.propertyNames().homeObjectPrivateName); 184 } 185 182 186 RegisterID callee; 183 187 callee.setIndex(JSStack::Callee); … … 750 754 CallArguments callArguments(generator, m_args); 751 755 if (m_expr->isSuperNode()) { 752 ASSERT(generator.isConstructor() || generator. isDerivedConstructorContext());753 ASSERT(generator.constructorKind() == ConstructorKind::Derived || generator. isDerivedConstructorContext());756 ASSERT(generator.isConstructor() || generator.derivedContextType() == DerivedContextType::DerivedConstructorContext); 757 ASSERT(generator.constructorKind() == ConstructorKind::Derived || generator.derivedContextType() == DerivedContextType::DerivedConstructorContext); 754 758 generator.emitMove(callArguments.thisRegister(), generator.newTarget()); 755 759 RegisterID* ret = generator.emitConstruct(returnValue.get(), func.get(), NoExpectedFunction, callArguments, divot(), divotStart(), divotEnd()); -
trunk/Source/JavaScriptCore/debugger/DebuggerCallFrame.cpp
r194247 r194449 193 193 JSScope::collectVariablesUnderTDZ(scope()->jsScope(), variablesUnderTDZ); 194 194 195 EvalExecutable* eval = EvalExecutable::create(callFrame, makeSource(script), codeBlock.isStrictMode(), thisTDZMode, codeBlock.unlinkedCodeBlock()-> isDerivedConstructorContext(), codeBlock.unlinkedCodeBlock()->isArrowFunction(), &variablesUnderTDZ);195 EvalExecutable* eval = EvalExecutable::create(callFrame, makeSource(script), codeBlock.isStrictMode(), thisTDZMode, codeBlock.unlinkedCodeBlock()->derivedContextType(), codeBlock.unlinkedCodeBlock()->isArrowFunction(), &variablesUnderTDZ); 196 196 if (vm.exception()) { 197 197 exception = vm.exception(); -
trunk/Source/JavaScriptCore/interpreter/Interpreter.cpp
r194435 r194449 184 184 ASSERT(!callFrame->vm().exception()); 185 185 186 eval = callerCodeBlock->evalCodeCache().getSlow(callFrame, callerCodeBlock, callerCodeBlock->isStrictMode(), thisTDZMode, callerCodeBlock->unlinkedCodeBlock()-> isDerivedConstructorContext(), callerCodeBlock->unlinkedCodeBlock()->isArrowFunction(), sourceCode, callerScopeChain);186 eval = callerCodeBlock->evalCodeCache().getSlow(callFrame, callerCodeBlock, callerCodeBlock->isStrictMode(), thisTDZMode, callerCodeBlock->unlinkedCodeBlock()->derivedContextType(), callerCodeBlock->unlinkedCodeBlock()->isArrowFunction(), sourceCode, callerScopeChain); 187 187 188 188 if (!eval) -
trunk/Source/JavaScriptCore/runtime/CodeCache.cpp
r194435 r194449 189 189 // The Function constructor only has access to global variables, so no variables will be under TDZ. 190 190 VariableEnvironment emptyTDZVariables; 191 UnlinkedFunctionExecutable* functionExecutable = UnlinkedFunctionExecutable::create(&vm, source, metadata, UnlinkedNormalFunction, ConstructAbility::CanConstruct, emptyTDZVariables, false); 191 UnlinkedFunctionExecutable* functionExecutable = UnlinkedFunctionExecutable::create(&vm, source, metadata, UnlinkedNormalFunction, ConstructAbility::CanConstruct, emptyTDZVariables, DerivedContextType::None); 192 192 193 functionExecutable->m_nameValue.set(vm, functionExecutable, jsString(&vm, name.string())); 193 194 -
trunk/Source/JavaScriptCore/runtime/Executable.cpp
r193766 r194449 132 132 const ClassInfo ScriptExecutable::s_info = { "ScriptExecutable", &ExecutableBase::s_info, 0, CREATE_METHOD_TABLE(ScriptExecutable) }; 133 133 134 ScriptExecutable::ScriptExecutable(Structure* structure, VM& vm, const SourceCode& source, bool isInStrictContext, bool isInDerivedConstructorContext, bool isInArrowFunctionContext)134 ScriptExecutable::ScriptExecutable(Structure* structure, VM& vm, const SourceCode& source, bool isInStrictContext, DerivedContextType derivedContextType, bool isInArrowFunctionContext) 135 135 : ExecutableBase(vm, structure, NUM_PARAMETERS_NOT_COMPILED) 136 136 , m_source(source) … … 139 139 , m_neverInline(false) 140 140 , m_didTryToEnterInLoop(false) 141 , m_ isDerivedConstructorContext(isInDerivedConstructorContext)141 , m_derivedContextType(derivedContextType) 142 142 , m_isArrowFunctionContext(isInArrowFunctionContext) 143 143 , m_overrideLineNumber(-1) … … 415 415 const ClassInfo EvalExecutable::s_info = { "EvalExecutable", &ScriptExecutable::s_info, 0, CREATE_METHOD_TABLE(EvalExecutable) }; 416 416 417 EvalExecutable* EvalExecutable::create(ExecState* exec, const SourceCode& source, bool isInStrictContext, ThisTDZMode thisTDZMode, bool isDerivedConstructorContext, bool isArrowFunctionContext, const VariableEnvironment* variablesUnderTDZ)417 EvalExecutable* EvalExecutable::create(ExecState* exec, const SourceCode& source, bool isInStrictContext, ThisTDZMode thisTDZMode, DerivedContextType derivedContextType, bool isArrowFunctionContext, const VariableEnvironment* variablesUnderTDZ) 418 418 { 419 419 JSGlobalObject* globalObject = exec->lexicalGlobalObject(); … … 423 423 } 424 424 425 EvalExecutable* executable = new (NotNull, allocateCell<EvalExecutable>(*exec->heap())) EvalExecutable(exec, source, isInStrictContext, isDerivedConstructorContext, isArrowFunctionContext);425 EvalExecutable* executable = new (NotNull, allocateCell<EvalExecutable>(*exec->heap())) EvalExecutable(exec, source, isInStrictContext, derivedContextType, isArrowFunctionContext); 426 426 executable->finishCreation(exec->vm()); 427 427 … … 435 435 } 436 436 437 EvalExecutable::EvalExecutable(ExecState* exec, const SourceCode& source, bool inStrictContext, bool isDerivedConstructorContext, bool isArrowFunctionContext)438 : ScriptExecutable(exec->vm().evalExecutableStructure.get(), exec->vm(), source, inStrictContext, isDerivedConstructorContext, isArrowFunctionContext)437 EvalExecutable::EvalExecutable(ExecState* exec, const SourceCode& source, bool inStrictContext, DerivedContextType derivedContextType, bool isArrowFunctionContext) 438 : ScriptExecutable(exec->vm().evalExecutableStructure.get(), exec->vm(), source, inStrictContext, derivedContextType, isArrowFunctionContext) 439 439 { 440 440 } … … 448 448 449 449 ProgramExecutable::ProgramExecutable(ExecState* exec, const SourceCode& source) 450 : ScriptExecutable(exec->vm().programExecutableStructure.get(), exec->vm(), source, false, false, false)450 : ScriptExecutable(exec->vm().programExecutableStructure.get(), exec->vm(), source, false, DerivedContextType::None, false) 451 451 { 452 452 m_typeProfilingStartOffset = 0; … … 464 464 465 465 ModuleProgramExecutable::ModuleProgramExecutable(ExecState* exec, const SourceCode& source) 466 : ScriptExecutable(exec->vm().moduleProgramExecutableStructure.get(), exec->vm(), source, false, false, false)466 : ScriptExecutable(exec->vm().moduleProgramExecutableStructure.get(), exec->vm(), source, false, DerivedContextType::None, false) 467 467 { 468 468 m_typeProfilingStartOffset = 0; … … 496 496 497 497 FunctionExecutable::FunctionExecutable(VM& vm, const SourceCode& source, UnlinkedFunctionExecutable* unlinkedExecutable, unsigned firstLine, unsigned lastLine, unsigned startColumn, unsigned endColumn) 498 : ScriptExecutable(vm.functionExecutableStructure.get(), vm, source, unlinkedExecutable->isInStrictContext(), unlinkedExecutable-> isDerivedConstructorContext(), false)498 : ScriptExecutable(vm.functionExecutableStructure.get(), vm, source, unlinkedExecutable->isInStrictContext(), unlinkedExecutable->derivedContextType(), false) 499 499 , m_unlinkedExecutable(vm, this, unlinkedExecutable) 500 500 { -
trunk/Source/JavaScriptCore/runtime/Executable.h
r194435 r194449 347 347 bool isArrowFunctionContext() const { return m_isArrowFunctionContext; } 348 348 bool isStrictMode() const { return m_features & StrictModeFeature; } 349 bool isDerivedConstructorContext() const { return m_isDerivedConstructorContext; } 349 DerivedContextType derivedContextType() const { return m_derivedContextType; } 350 350 351 ECMAMode ecmaMode() const { return isStrictMode() ? StrictMode : NotStrictMode; } 351 352 … … 396 397 397 398 protected: 398 ScriptExecutable(Structure*, VM&, const SourceCode&, bool isInStrictContext, bool isInDerivedConstructorContext, bool isInArrowFunctionContext);399 ScriptExecutable(Structure*, VM&, const SourceCode&, bool isInStrictContext, DerivedContextType, bool isInArrowFunctionContext); 399 400 400 401 void finishCreation(VM& vm) … … 415 416 bool m_neverOptimize { false }; 416 417 bool m_didTryToEnterInLoop; 417 bool m_isDerivedConstructorContext;418 DerivedContextType m_derivedContextType; 418 419 bool m_isArrowFunctionContext; 419 420 int m_overrideLineNumber; … … 439 440 } 440 441 441 static EvalExecutable* create(ExecState*, const SourceCode&, bool isInStrictContext, ThisTDZMode, bool isDerivedConstructorContext, bool isArrowFunctionContext, const VariableEnvironment*);442 static EvalExecutable* create(ExecState*, const SourceCode&, bool isInStrictContext, ThisTDZMode, DerivedContextType, bool isArrowFunctionContext, const VariableEnvironment*); 442 443 443 444 PassRefPtr<JITCode> generatedJITCode() … … 453 454 DECLARE_INFO; 454 455 455 456 ExecutableInfo executableInfo() const { return ExecutableInfo(needsActivation(), usesEval(), isStrictMode(), false, false, ConstructorKind::None, SuperBinding::NotNeeded, SourceParseMode::ProgramMode, isDerivedConstructorContext(), isArrowFunctionContext()); } 456 ExecutableInfo executableInfo() const { return ExecutableInfo(needsActivation(), usesEval(), isStrictMode(), false, false, ConstructorKind::None, SuperBinding::NotNeeded, SourceParseMode::ProgramMode, derivedContextType(), isArrowFunctionContext() , false); } 457 457 458 458 unsigned numVariables() { return m_unlinkedEvalCodeBlock->numVariables(); } … … 462 462 friend class ExecutableBase; 463 463 friend class ScriptExecutable; 464 EvalExecutable(ExecState*, const SourceCode&, bool inStrictContext, bool isDerivedConstructorContext, bool isArrowFunctionContext); 464 465 EvalExecutable(ExecState*, const SourceCode&, bool inStrictContext, DerivedContextType, bool isArrowFunctionContext); 465 466 466 467 static void visitChildren(JSCell*, SlotVisitor&); … … 507 508 DECLARE_INFO; 508 509 509 ExecutableInfo executableInfo() const { return ExecutableInfo(needsActivation(), usesEval(), isStrictMode(), false, false, ConstructorKind::None, SuperBinding::NotNeeded, SourceParseMode::ProgramMode, isDerivedConstructorContext(), false); }510 ExecutableInfo executableInfo() const { return ExecutableInfo(needsActivation(), usesEval(), isStrictMode(), false, false, ConstructorKind::None, SuperBinding::NotNeeded, SourceParseMode::ProgramMode, derivedContextType(), isArrowFunctionContext(), false); } 510 511 511 512 private: … … 548 549 DECLARE_INFO; 549 550 550 ExecutableInfo executableInfo() const { return ExecutableInfo(needsActivation(), usesEval(), isStrictMode(), false, false, ConstructorKind::None, SuperBinding::NotNeeded, SourceParseMode::ModuleEvaluateMode, isDerivedConstructorContext(), false); }551 ExecutableInfo executableInfo() const { return ExecutableInfo(needsActivation(), usesEval(), isStrictMode(), false, false, ConstructorKind::None, SuperBinding::NotNeeded, SourceParseMode::ModuleEvaluateMode, derivedContextType(), isArrowFunctionContext(), false); } 551 552 552 553 UnlinkedModuleProgramCodeBlock* unlinkedModuleProgramCodeBlock() { return m_unlinkedModuleProgramCodeBlock.get(); } … … 658 659 ConstructAbility constructAbility() const { return m_unlinkedExecutable->constructAbility(); } 659 660 bool isArrowFunction() const { return parseMode() == SourceParseMode::ArrowFunctionMode; } 660 bool isDerivedConstructorContext() const { return m_unlinkedExecutable->isDerivedConstructorContext(); }661 DerivedContextType derivedContextType() const { return m_unlinkedExecutable->derivedContextType(); } 661 662 bool isClassConstructorFunction() const { return m_unlinkedExecutable->isClassConstructorFunction(); } 662 663 const Identifier& name() { return m_unlinkedExecutable->name(); } -
trunk/Source/JavaScriptCore/runtime/JSGlobalObjectFunctions.cpp
r194310 r194449 588 588 JSGlobalObject* calleeGlobalObject = exec->callee()->globalObject(); 589 589 VariableEnvironment emptyTDZVariables; // Indirect eval does not have access to the lexical scope. 590 EvalExecutable* eval = EvalExecutable::create(exec, makeSource(s), false, ThisTDZMode::CheckIfNeeded, false, false, &emptyTDZVariables);590 EvalExecutable* eval = EvalExecutable::create(exec, makeSource(s), false, ThisTDZMode::CheckIfNeeded, DerivedContextType::None, false, &emptyTDZVariables); 591 591 if (!eval) 592 592 return JSValue::encode(jsUndefined()); -
trunk/Source/JavaScriptCore/tests/es6.yaml
r194248 r194449 748 748 cmd: runES6 :normal 749 749 - path: es6/arrow_functions_lexical_super_binding.js 750 cmd: runES6 : fail750 cmd: runES6 :normal 751 751 - path: es6/arrow_functions_no_prototype_property.js 752 752 cmd: runES6 :normal
Note: See TracChangeset
for help on using the changeset viewer.