|
| 1 | +2020-06-15 Alexey Shvayka <shvaikalesh@gmail.com> |
| 2 | + |
| 3 | + super should not depend on __proto__ |
| 4 | + https://bugs.webkit.org/show_bug.cgi?id=157972 |
| 5 | + |
| 6 | + Reviewed by Saam Barati. |
| 7 | + |
| 8 | + Before this change, both super() call [1] and super.property [2] relied on |
| 9 | + Object.prototype.__proto__ to acquire super base, which was observable and |
| 10 | + incorrect if __proto__ gets removed. |
| 11 | + |
| 12 | + This patch introduces get_prototype_of bytecode, ensuring returned values |
| 13 | + are profiled so the op can be wired to existing DFG and FTL implementations. |
| 14 | + In order to avoid performance regression w/o DFG (__proto__ is optimized via |
| 15 | + IntrinsicGetterAccessCase), fast paths for LLInt and baseline JIT are added |
| 16 | + (64-bit only), utilizing OverridesGetPrototypeOutOfLine type info flag. |
| 17 | + |
| 18 | + This change aligns JSC with V8 and SpiderMonkey, progressing microbenchmarks/ |
| 19 | + super-get-by-{id,val}-with-this-monomorphic.js by 7-10%. SixSpeed is neutral. |
| 20 | + |
| 21 | + Also, extracts JSValue::getPrototype() method to avoid code duplication and |
| 22 | + utilizes it in objectConstructorGetPrototypeOf(), advancing provided |
| 23 | + microbenchmark by 40%. |
| 24 | + |
| 25 | + [1]: https://tc39.es/ecma262/#sec-getsuperconstructor (step 5) |
| 26 | + [2]: https://tc39.es/ecma262/#sec-getsuperbase (step 5) |
| 27 | + |
| 28 | + * builtins/BuiltinNames.h: |
| 29 | + * bytecode/BytecodeIntrinsicRegistry.h: |
| 30 | + * bytecode/BytecodeList.rb: |
| 31 | + * bytecode/BytecodeUseDef.cpp: |
| 32 | + (JSC::computeUsesForBytecodeIndexImpl): |
| 33 | + (JSC::computeDefsForBytecodeIndexImpl): |
| 34 | + * bytecode/CodeBlock.cpp: |
| 35 | + (JSC::CodeBlock::finishCreation): |
| 36 | + * bytecode/Opcode.h: |
| 37 | + * bytecompiler/BytecodeGenerator.cpp: |
| 38 | + (JSC::BytecodeGenerator::emitGetPrototypeOf): |
| 39 | + * bytecompiler/BytecodeGenerator.h: |
| 40 | + * bytecompiler/NodesCodegen.cpp: |
| 41 | + (JSC::emitSuperBaseForCallee): |
| 42 | + (JSC::emitGetSuperFunctionForConstruct): |
| 43 | + (JSC::BytecodeIntrinsicNode::emit_intrinsic_getPrototypeOf): |
| 44 | + * dfg/DFGAbstractInterpreterInlines.h: |
| 45 | + (JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects): |
| 46 | + * dfg/DFGByteCodeParser.cpp: |
| 47 | + (JSC::DFG::ByteCodeParser::handleIntrinsicGetter): |
| 48 | + (JSC::DFG::ByteCodeParser::parseBlock): |
| 49 | + * dfg/DFGCapabilities.cpp: |
| 50 | + (JSC::DFG::capabilityLevel): |
| 51 | + * dfg/DFGOperations.cpp: |
| 52 | + * jit/IntrinsicEmitter.cpp: |
| 53 | + (JSC::IntrinsicGetterAccessCase::canEmitIntrinsicGetter): |
| 54 | + * jit/JIT.cpp: |
| 55 | + (JSC::JIT::privateCompileMainPass): |
| 56 | + (JSC::JIT::privateCompileSlowCases): |
| 57 | + * jit/JIT.h: |
| 58 | + * jit/JITOpcodes.cpp: |
| 59 | + (JSC::JIT::emit_op_get_prototype_of): |
| 60 | + * llint/LowLevelInterpreter.asm: |
| 61 | + * llint/LowLevelInterpreter64.asm: |
| 62 | + * runtime/CommonSlowPaths.cpp: |
| 63 | + (JSC::SLOW_PATH_DECL): |
| 64 | + * runtime/CommonSlowPaths.h: |
| 65 | + * runtime/JSCJSValue.h: |
| 66 | + * runtime/JSCJSValueInlines.h: |
| 67 | + (JSC::JSValue::getPrototype const): |
| 68 | + * runtime/JSGlobalObjectFunctions.cpp: |
| 69 | + (JSC::globalFuncProtoGetter): |
| 70 | + * runtime/JSObject.cpp: |
| 71 | + (JSC::JSObject::calculatedClassName): |
| 72 | + * runtime/JSObject.h: |
| 73 | + (JSC::JSObject::getPrototype): |
| 74 | + * runtime/JSObjectInlines.h: |
| 75 | + (JSC::JSObject::canPerformFastPutInlineExcludingProto): |
| 76 | + (JSC::JSObject::getPropertySlot): |
| 77 | + (JSC::JSObject::getNonIndexPropertySlot): |
| 78 | + * runtime/JSProxy.h: |
| 79 | + * runtime/JSTypeInfo.h: |
| 80 | + (JSC::TypeInfo::overridesGetPrototype const): |
| 81 | + * runtime/ObjectConstructor.cpp: |
| 82 | + (JSC::objectConstructorGetPrototypeOf): |
| 83 | + * runtime/ProxyObject.h: |
| 84 | + * runtime/Structure.h: |
| 85 | + * runtime/Structure.cpp: |
| 86 | + (JSC::Structure::validateFlags): |
| 87 | + |
1 | 88 | 2020-06-13 Devin Rousso <drousso@apple.com> |
2 | 89 |
|
3 | 90 | Make `errors` an own property of `AggregateError` instead of a prototype accessor |
|
0 commit comments