Changeset 225891 in webkit
- Timestamp:
- Dec 13, 2017 8:10:02 PM (6 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JSTests/ChangeLog
r225845 r225891 1 2017-12-13 Saam Barati <sbarati@apple.com> 2 3 Arrow functions need their own structure because they have different properties than sloppy functions 4 https://bugs.webkit.org/show_bug.cgi?id=180779 5 <rdar://problem/35814591> 6 7 Reviewed by Mark Lam. 8 9 * stress/arrow-function-needs-its-own-structure.js: Added. 10 (assert): 11 (readPrototype): 12 (noInline.let.f1): 13 (noInline): 14 1 15 2017-12-13 Saam Barati <sbarati@apple.com> 2 16 -
trunk/Source/JavaScriptCore/ChangeLog
r225887 r225891 1 2017-12-13 Saam Barati <sbarati@apple.com> 2 3 Arrow functions need their own structure because they have different properties than sloppy functions 4 https://bugs.webkit.org/show_bug.cgi?id=180779 5 <rdar://problem/35814591> 6 7 Reviewed by Mark Lam. 8 9 We were using the same structure for sloppy functions and 10 arrow functions. This broke our IC caching machinery because 11 these two types of functions actually have different properties. 12 This patch gives them different structures. 13 14 * dfg/DFGAbstractInterpreterInlines.h: 15 (JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects): 16 * dfg/DFGSpeculativeJIT.cpp: 17 (JSC::DFG::SpeculativeJIT::compileNewFunction): 18 * ftl/FTLLowerDFGToB3.cpp: 19 (JSC::FTL::DFG::LowerDFGToB3::compileNewFunction): 20 * runtime/FunctionConstructor.cpp: 21 (JSC::constructFunctionSkippingEvalEnabledCheck): 22 * runtime/JSFunction.cpp: 23 (JSC::JSFunction::selectStructureForNewFuncExp): 24 (JSC::JSFunction::create): 25 * runtime/JSFunction.h: 26 * runtime/JSFunctionInlines.h: 27 (JSC::JSFunction::createWithInvalidatedReallocationWatchpoint): 28 * runtime/JSGlobalObject.cpp: 29 (JSC::JSGlobalObject::init): 30 (JSC::JSGlobalObject::visitChildren): 31 * runtime/JSGlobalObject.h: 32 (JSC::JSGlobalObject::arrowFunctionStructure const): 33 1 34 2017-12-12 Filip Pizlo <fpizlo@apple.com> 2 35 -
trunk/Source/JavaScriptCore/dfg/DFGAbstractInterpreterInlines.h
r225832 r225891 2299 2299 break; 2300 2300 2301 case NewFunction: 2302 if (node->castOperand<FunctionExecutable*>()->isStrictMode()) { 2303 forNode(node).set( 2304 m_graph, m_codeBlock->globalObjectFor(node->origin.semantic)->strictFunctionStructure()); 2305 } else { 2306 forNode(node).set( 2307 m_graph, m_codeBlock->globalObjectFor(node->origin.semantic)->sloppyFunctionStructure()); 2308 } 2309 break; 2301 case NewFunction: { 2302 JSGlobalObject* globalObject = m_codeBlock->globalObjectFor(node->origin.semantic); 2303 Structure* structure = JSFunction::selectStructureForNewFuncExp(globalObject, node->castOperand<FunctionExecutable*>()); 2304 forNode(node).set(m_graph, structure); 2305 break; 2306 } 2310 2307 2311 2308 case GetCallee: -
trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp
r225832 r225891 6783 6783 RegisteredStructure structure = m_jit.graph().registerStructure( 6784 6784 [&] () { 6785 JSGlobalObject* globalObject = m_jit.graph().globalObjectFor(node->origin.semantic); 6785 6786 switch (nodeType) { 6786 6787 case NewGeneratorFunction: 6787 return m_jit.graph().globalObjectFor(node->origin.semantic)->generatorFunctionStructure();6788 return globalObject->generatorFunctionStructure(); 6788 6789 case NewAsyncFunction: 6789 return m_jit.graph().globalObjectFor(node->origin.semantic)->asyncFunctionStructure();6790 return globalObject->asyncFunctionStructure(); 6790 6791 case NewAsyncGeneratorFunction: 6791 return m_jit.graph().globalObjectFor(node->origin.semantic)->asyncGeneratorFunctionStructure();6792 return globalObject->asyncGeneratorFunctionStructure(); 6792 6793 case NewFunction: 6793 if (node->castOperand<FunctionExecutable*>()->isStrictMode()) 6794 return m_jit.graph().globalObjectFor(node->origin.semantic)->strictFunctionStructure(); 6795 return m_jit.graph().globalObjectFor(node->origin.semantic)->sloppyFunctionStructure(); 6794 return JSFunction::selectStructureForNewFuncExp(globalObject, node->castOperand<FunctionExecutable*>()); 6796 6795 default: 6797 6796 RELEASE_ASSERT_NOT_REACHED(); -
trunk/Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp
r225832 r225891 4737 4737 return; 4738 4738 } 4739 4740 4739 4741 4740 RegisteredStructure structure = m_graph.registerStructure( 4742 4741 [&] () { 4742 JSGlobalObject* globalObject = m_graph.globalObjectFor(m_node->origin.semantic); 4743 4743 switch (m_node->op()) { 4744 4744 case NewGeneratorFunction: 4745 return m_graph.globalObjectFor(m_node->origin.semantic)->generatorFunctionStructure();4745 return globalObject->generatorFunctionStructure(); 4746 4746 case NewAsyncFunction: 4747 return m_graph.globalObjectFor(m_node->origin.semantic)->asyncFunctionStructure();4747 return globalObject->asyncFunctionStructure(); 4748 4748 case NewAsyncGeneratorFunction: 4749 return m_graph.globalObjectFor(m_node->origin.semantic)->asyncGeneratorFunctionStructure();4749 return globalObject->asyncGeneratorFunctionStructure(); 4750 4750 case NewFunction: 4751 if (m_node->castOperand<FunctionExecutable*>()->isStrictMode()) 4752 return m_graph.globalObjectFor(m_node->origin.semantic)->strictFunctionStructure(); 4753 return m_graph.globalObjectFor(m_node->origin.semantic)->sloppyFunctionStructure(); 4754 break; 4751 return JSFunction::selectStructureForNewFuncExp(globalObject, m_node->castOperand<FunctionExecutable*>()); 4755 4752 default: 4756 4753 RELEASE_ASSERT_NOT_REACHED(); -
trunk/Source/JavaScriptCore/runtime/FunctionConstructor.cpp
r225273 r225891 176 176 switch (functionConstructionMode) { 177 177 case FunctionConstructionMode::Function: 178 if (function->isStrictMode()) 179 structure = globalObject->strictFunctionStructure(); 180 else 181 structure = globalObject->sloppyFunctionStructure(); 178 structure = JSFunction::selectStructureForNewFuncExp(globalObject, function); 182 179 break; 183 180 case FunctionConstructionMode::Generator: -
trunk/Source/JavaScriptCore/runtime/JSFunction.cpp
r225845 r225891 66 66 } 67 67 68 Structure* JSFunction::selectStructureForNewFuncExp(JSGlobalObject* globalObject, FunctionExecutable* executable) 69 { 70 if (executable->isArrowFunction()) 71 return globalObject->arrowFunctionStructure(); 72 if (executable->isStrictMode()) 73 return globalObject->strictFunctionStructure(); 74 return globalObject->sloppyFunctionStructure(); 75 } 76 68 77 JSFunction* JSFunction::create(VM& vm, FunctionExecutable* executable, JSScope* scope) 69 78 { 70 Structure* structure = executable->isStrictMode() ? scope->globalObject(vm)->strictFunctionStructure() : scope->globalObject(vm)->sloppyFunctionStructure(); 71 return create(vm, executable, scope, structure); 79 return create(vm, executable, scope, selectStructureForNewFuncExp(scope->globalObject(vm), executable)); 72 80 } 73 81 -
trunk/Source/JavaScriptCore/runtime/JSFunction.h
r224927 r225891 71 71 } 72 72 73 static Structure* selectStructureForNewFuncExp(JSGlobalObject*, FunctionExecutable*); 74 73 75 JS_EXPORT_PRIVATE static JSFunction* create(VM&, JSGlobalObject*, int length, const String& name, NativeFunction, Intrinsic = NoIntrinsic, NativeFunction nativeConstructor = callHostFunctionAsConstructor, const DOMJIT::Signature* = nullptr); 74 76 -
trunk/Source/JavaScriptCore/runtime/JSFunctionInlines.h
r225273 r225891 36 36 { 37 37 ASSERT(executable->singletonFunction()->hasBeenInvalidated()); 38 Structure* structure = executable->isStrictMode() ? scope->globalObject(vm)->strictFunctionStructure() : scope->globalObject(vm)->sloppyFunctionStructure(); 39 return createImpl(vm, executable, scope, structure); 38 return createImpl(vm, executable, scope, selectStructureForNewFuncExp(scope->globalObject(vm), executable)); 40 39 } 41 40 -
trunk/Source/JavaScriptCore/runtime/JSGlobalObject.cpp
r225423 r225891 389 389 m_strictFunctionStructure.set(vm, this, JSFunction::createStructure(vm, this, m_functionPrototype.get())); 390 390 m_sloppyFunctionStructure.set(vm, this, JSFunction::createStructure(vm, this, m_functionPrototype.get())); 391 m_arrowFunctionStructure.set(vm, this, JSFunction::createStructure(vm, this, m_functionPrototype.get())); 391 392 m_customGetterSetterFunctionStructure.initLater( 392 393 [] (const Initializer<Structure>& init) { … … 1315 1316 visitor.append(thisObject->m_strictFunctionStructure); 1316 1317 visitor.append(thisObject->m_sloppyFunctionStructure); 1318 visitor.append(thisObject->m_arrowFunctionStructure); 1317 1319 thisObject->m_customGetterSetterFunctionStructure.visit(visitor); 1318 1320 thisObject->m_boundFunctionStructure.visit(visitor); -
trunk/Source/JavaScriptCore/runtime/JSGlobalObject.h
r225273 r225891 323 323 WriteBarrier<Structure> m_calleeStructure; 324 324 WriteBarrier<Structure> m_strictFunctionStructure; 325 WriteBarrier<Structure> m_arrowFunctionStructure; 325 326 WriteBarrier<Structure> m_sloppyFunctionStructure; 326 327 LazyProperty<JSGlobalObject, Structure> m_boundFunctionStructure; … … 632 633 Structure* strictFunctionStructure() const { return m_strictFunctionStructure.get(); } 633 634 Structure* sloppyFunctionStructure() const { return m_sloppyFunctionStructure.get(); } 635 Structure* arrowFunctionStructure() const { return m_arrowFunctionStructure.get(); } 634 636 Structure* boundFunctionStructure() const { return m_boundFunctionStructure.get(this); } 635 637 Structure* customGetterSetterFunctionStructure() const { return m_customGetterSetterFunctionStructure.get(this); }
Note: See TracChangeset
for help on using the changeset viewer.