Changeset 193606 in webkit for trunk/Source/JavaScriptCore/bytecompiler/NodesCodegen.cpp
- Timestamp:
- Dec 6, 2015, 5:54:43 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/bytecompiler/NodesCodegen.cpp
r193584 r193606 147 147 RegisterID* ThisNode::emitBytecode(BytecodeGenerator& generator, RegisterID* dst) 148 148 { 149 if (generator.constructorKind() == ConstructorKind::Derived && generator.needsToUpdateArrowFunctionContext()) 150 generator.emitLoadThisFromArrowFunctionLexicalEnvironment(); 151 152 if (m_shouldAlwaysEmitTDZCheck || generator.constructorKind() == ConstructorKind::Derived || generator.generatorThisMode() == GeneratorThisMode::Empty || generator.isDerivedConstructorContext()) 149 if (m_shouldAlwaysEmitTDZCheck || generator.constructorKind() == ConstructorKind::Derived || generator.generatorThisMode() == GeneratorThisMode::Empty) 153 150 generator.emitTDZCheck(generator.thisRegister()); 154 151 … … 168 165 if (dst == generator.ignoredResult()) 169 166 return 0; 170 171 if (generator.isDerivedConstructorContext())172 return generator.emitGetById(generator.finalDestination(dst), generator.emitLoadDerivedConstructorFromArrowFunctionLexicalEnvironment(), generator.propertyNames().underscoreProto);173 167 174 168 RegisterID callee; … … 703 697 RegisterID* EvalFunctionCallNode::emitBytecode(BytecodeGenerator& generator, RegisterID* dst) 704 698 { 705 // We need try to load 'this' before call eval in constructor, because 'this' can created by 'super' in some of the arrow function706 // var A = class A {707 // constructor () { this.id = 'A'; }708 // }709 //710 // var B = class B extend A {711 // constructor () {712 // var arrow = () => super();713 // arrow();714 // eval("this.id = 'B'");715 // }716 // }717 if (generator.constructorKind() == ConstructorKind::Derived && generator.needsToUpdateArrowFunctionContext())718 generator.emitLoadThisFromArrowFunctionLexicalEnvironment();719 720 699 Variable var = generator.variable(generator.propertyNames().eval); 721 700 if (RegisterID* local = var.local()) { … … 745 724 CallArguments callArguments(generator, m_args); 746 725 if (m_expr->isSuperNode()) { 747 ASSERT(generator.isConstructor() || generator.isDerivedConstructorContext());748 ASSERT(generator.constructorKind() == ConstructorKind::Derived || generator.isDerivedConstructorContext());726 ASSERT(generator.isConstructor()); 727 ASSERT(generator.constructorKind() == ConstructorKind::Derived); 749 728 generator.emitMove(callArguments.thisRegister(), generator.newTarget()); 750 729 RegisterID* ret = generator.emitConstruct(returnValue.get(), func.get(), NoExpectedFunction, callArguments, divot(), divotStart(), divotEnd()); 751 730 generator.emitMove(generator.thisRegister(), ret); 752 753 bool isConstructorKindDerived = generator.constructorKind() == ConstructorKind::Derived;754 if (generator.isDerivedConstructorContext() || (isConstructorKindDerived && generator.needsToUpdateArrowFunctionContext()))755 generator.emitPutThisToArrowFunctionContextScope();756 757 731 return ret; 758 732 } … … 3079 3053 // If there is no return we must automatically insert one. 3080 3054 if (!returnNode) { 3081 if (generator.constructorKind() == ConstructorKind::Derived && generator.needsToUpdateArrowFunctionContext())3082 generator.emitLoadThisFromArrowFunctionLexicalEnvironment(); // Arrow function can invoke 'super' in constructor and before leave constructor we need load 'this' from lexical arrow function environment3083 3084 3055 RegisterID* r0 = generator.isConstructor() ? generator.thisRegister() : generator.emitLoad(0, jsUndefined()); 3085 3056 generator.emitProfileType(r0, ProfileTypeBytecodeFunctionReturnStatement); // Do not emit expression info for this profile because it's not in the user's source code.
Note:
See TracChangeset
for help on using the changeset viewer.